IPB

Bienvenue invité ( Connexion | Inscription )

[ En ligne ] · Standard · Linéaire+

> Pb Tomcat : Cannot Create Jdbc Driver Of Class

Ryle
post 29/10/2004 14:06
Message #1


Elfe
****

Groupe : Membres
Messages : 2,282
Inscrit le : 16/05/2002 23:00
Lieu : .gif
Membre no. 10



Ceci est un problème classique, répertorié dans de nombreux sites Web, cependant nulle part je n'ai pu trouver de réponse précise et qui m'eût été d'une quelconque utilité. Donc je m'adresse à vous pour résoudre ce problème très chiant qui m'occupe depuis ce matin :
J'ai un serveur Tomcat 5.0.28
J'ai un projet du nom de toto configuré dessus et je voudrais utiliser une JNDI pour me connecter à une base.

Mon fichier toto.xml (dans conf/catalina/localhost) :
CODE
<?xml version='1.0' encoding='utf-8'?>
<Context workDir="D:\Webapps\toto\work" path="/toto" reloadable="true"  displayName="Toto" docBase="D:\Webapps\toto">
<ResourceParams name="jdbc/sourcetoto">
<parameter>
<name>factory</name>
<value>org.apache.commons.dbcp.BasicDataSourceFactory</value>
</parameter>

<parameter><name>user</name><value>logintoto</value></parameter>
<parameter><name>password</name><value>pwdtoto</value></parameter>
<parameter><name>driverClassName</name>
 <value>oracle.jdbc.pool.OracleDataSource</value></parameter>
<parameter><name>url</name>
 <value>jdbc:oracle:thin:@machinetoto:1521:sidtoto</value></parameter>
<parameter>
<name>maxActive</name>
<value>10</value>
</parameter>
<parameter>
<name>maxIdle</name>
<value>5</value>
</parameter>
<parameter>
<name>maxWait</name>
<value>-1</value>
</parameter>


</ResourceParams>

</Context>


Mon fichier web.xml dans WEB-INF :
CODE
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd">
<web-app>
<display-name>Toto</display-name>
<description>Application de gestion de Toto</description>
<session-config>
 <session-timeout>30</session-timeout>
</session-config>
<welcome-file-list>
 <welcome-file>JSP/index.jsp</welcome-file>
</welcome-file-list>
<resource-ref>
 <res-ref-name>jdbc/sourcetoto</res-ref-name>
 <res-type>javax.sql.DataSource</res-type>
 <res-auth>Container</res-auth>
</resource-ref>


</web-app>

ET chaque fois que j'exécute le code :
CODE

<%
javax.naming.InitialContext ctx = new javax.naming.InitialContext();
%>
Contexte JNDI : <%=ctx%><br>
<% javax.sql.DataSource ds =
 (javax.sql.DataSource)ctx.lookup("java:comp/env/jdbc/sourcetoto"); %>

DataSource : <%=ds%><br>
<%
java.sql.Connection connection = ds.getConnection();
%>

la ligne java.sql.Connection connection = ds.getConnection(); me claque l'erreur :
CODE
org.apache.commons.dbcp.SQLNestedException: Cannot create JDBC driver of class 'oracle.jdbc.pool.OracleDataSource' for connect URL 'jdbc:oracle:thin:@machinetoto:1521:sidtoto'


Si je fais une connexion JDBC sdirecte avec la chaîne jdbc:oracle:thin:@machinetoto:1521:sidtoto, ça marche impecc.
Quelqu'un connaît il la solution à ce problème qui à mon avis est très classique...

Autre chose : J'ai bien mis dans common/lib les fichiers classes12.jar et nls_charsets12.jar

Merci beaucoup

Ce message a été modifié par Ryle - 29/10/2004 14:08.
User is offlineProfile CardPM
Go to the top of the page
+Quote Post
 
Reply to this topicStart new topicStart Poll
Réponse(s)
PoP
post 29/10/2004 15:33
Message #2


ragondin interstellaire
*****

Groupe : Membres
Messages : 3,059
Inscrit le : 16/05/2002 23:00
Lieu : DTC, au fond à gauche
Membre no. 8



CODE

<% javax.sql.DataSource ds =
(javax.sql.DataSource)ctx.lookup("java:comp/env/jdbc/sourcetoto"); %>


Ca c'est pas bon.
Essaye plutôt
CODE

<% javax.sql.DataSource ds =
(javax.sql.DataSource)ctx.lookup("jdbc/sourcetoto"); %>


--------------------
PoP
"Consommez malin, consommez du ragondin!"
user posted image
User is offlineProfile CardPM
Go to the top of the page
+Quote Post

Posts in this topic


Reply to this topicTopic OptionsStart new topic
1 utilisateur(s) sur ce sujet (1 invité(s) et 0 utilisateur(s) anonyme(s))
0 membre(s) :
 

Version bas débit Nous sommes le : : 04/07/2025 17:12