Bonjour à tous,
Alors voici mon problème j'ai un fichier .jps qui fait appel a une datasource avec ce code :
mais il me sort une erreur que je n'ai trouvé nul part sur internet
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6 <% Context initContext = new InitialContext(); Context envContext = (Context)initContext.lookup("java:/comp/env"); DataSource ds = (DataSource)envContext.lookup("jdbc/hpcDS"); Connection conn = ds.getConnection(); %>
la voici :
Eception
Cause mère :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5 org.apache.jasper.JasperException: org.apache.commons.dbcp.BasicDataSource org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:372) org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292) org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236) javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
et voici mes fichier context.xml ( placer dans META-INF) et web.xml
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5 java.lang.ClassCastException: org.apache.commons.dbcp.BasicDataSource org.apache.jsp.WebRubis_jsp._jspService(WebRubis_jsp.java:81) org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:94) javax.servlet.http.HttpServlet.service(HttpServlet.java:802) org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:324)
context.xml :
web.xml :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13 <Context> <Resource auth="Container" description="jdbc/hpcDS" driverClassName="oracle.jdbc.driver.OracleDriver" maxActive="4" maxIdle="2" maxWait="5000" name="jdbc/hpcDS" password="***" type="javax.sql.DataSource" url="jdbc:oracle:thin:***" username="***"/> <WatchedResource>WEB-INF/web.xml</WatchedResource> <ResourceLink global="jdbc/hpcDS" name="jdbc/hpcDS" type="javax.sql.DataSource" /> </Context>
J'utilise Easy Eclipse server avec un serveur tomcat 5.
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6 <resource-ref> <description>Oracle Datasource</description> <res-ref-name>jdbc/hpcDS</res-ref-name> <res-type>javax.sql.DataSource</res-type> <res-auth>Container</res-auth> </resource-ref>
En vous remerciant de l'attention que vous portez à ce post.
Cordialement.Charles.
Partager