You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by jodetek <jo...@free.fr> on 2007/12/09 17:58:09 UTC
Tomcat 6, JNDI datasource no longer work
Hi,
I now use NetBeans 6 that have Tomcat 6.0.10.
I have Oracle Express 10g (that work fine)
I had a Tomcat application that worked with Tomcat 5.5 & Netbeans 5 with
this database
Here is the error:
javax.servlet.ServletException:
org.apache.tomcat.dbcp.dbcp.SQLNestedException: Cannot create JDBC driver of
class '' for connect URL 'jdbc:oracle:thin:@localhost:1521:XE'
Note Tomcat found the URL, so it understood the configuration in context.xml
I googled quite a lot but could not find an answer (lot of people with this
error have an empty URL).
Tomcat 6 changed (no more common/lib) :-(
To check, I tested a direct connection to the database from a JSP page ==>
it works, so the driver work.
I've put the Oracle driver in WEB-INF/lib
I also put it in $catalina_home/lib (tomcat 6 new common/lib ?)
I removed my initial server.xml configuration and put the datasource in
context.xml, like this:
<Context path="/formationjsp" reloadable="true">
<!--
<ResourceLink global="jdbc/dbxe" name="jdbc/dbxe"
type="javax.sql.DataSource"/>
-->
<Resource name="jdbc/dbxe" auth="Container"
type="javax.sql.DataSource"
driverClassname="oracle.jdbc.OracleDriver"
username="jde"
password="jde"
url="jdbc:oracle:thin:@localhost:1521:XE"
/>
</Context>
I commented the old corresponding resource in server.xml, so that I no
longer use server.xml for the database
I changed nothing in the web.xml, it's still like this,
<resource-ref>
<res-ref-name>jdbc/dbxe</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
<res-sharing-scope>Shareable</res-sharing-scope>
</resource-ref>
The source code of course does not change.
I'm confused, it seems tomcat does not find the driver, but it found it when
I did the direct connection in a JSP page, like this,
<%
OracleDataSource ods = new OracleDataSource();
ods.setURL("jdbc:oracle:thin:@localhost:1521:XE");
ods.setUser("jde");
ods.setPassword("jde");
Connection conn = ods.getConnection();
etc...
%>
(with the correct "import" at the beginning of the JSP page...)
Any idea where the driver should be ?
What's going on....?
My application worked before.....
Thanks
JD
--
View this message in context: http://www.nabble.com/Tomcat-6%2C-JNDI-datasource-no-longer-work-tp14240562p14240562.html
Sent from the Tomcat - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
Re: Tomcat 6, JNDI datasource no longer work
Posted by jodetek <jo...@free.fr>.
Ok, it works ! :-)
It was the capital N of DriverClassName...... how stupid....:-(
JD
markt-2 wrote:
>
> jodetek wrote:
>> Tomcat 6 changed (no more common/lib) :-(
>
> This is explained in
> http://tomcat.apache.org/tomcat-6.0-doc/class-loader-howto.html
>
>> I've put the Oracle driver in WEB-INF/lib
>
> That won't be helping. Remove the driver from there.
>
>> I also put it in $catalina_home/lib (tomcat 6 new common/lib ?)
>
> Correct. Again, this is explained in
> http://tomcat.apache.org/tomcat-6.0-doc/class-loader-howto.html
>
>> <Resource name="jdbc/dbxe" auth="Container"
>> type="javax.sql.DataSource"
>> driverClassname="oracle.jdbc.OracleDriver"
>> username="jde"
>> password="jde"
>> url="jdbc:oracle:thin:@localhost:1521:XE"
>> />
>
> The attribute is driverClassName, not driverClassname. Case matters.
>
>> I'm confused, it seems tomcat does not find the driver, but it found it
>> when
>> I did the direct connection in a JSP page, like this,
>
> Tomcat can't find the driver because you didn't configure the resource
> correctly.
>
>> Any idea where the driver should be ?
>
> In $CATALINA_HOME/lib, as per the docs.
>
>> What's going on....?
>
> Your driver is in multiple places in the class loader hierarchy (something
> that is pretty much guaranteed to cause problems) and your resource isn't
> configured correctly.
>
>> My application worked before.....
>
> Fix the above and it should work with TC6 as well.
>
> Mark
>
>
> ---------------------------------------------------------------------
> To start a new topic, e-mail: users@tomcat.apache.org
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>
>
--
View this message in context: http://www.nabble.com/Tomcat-6%2C-JNDI-datasource-no-longer-work-tp14240562p14241406.html
Sent from the Tomcat - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
Re: Tomcat 6, JNDI datasource no longer work
Posted by Mark Thomas <ma...@apache.org>.
jodetek wrote:
> Tomcat 6 changed (no more common/lib) :-(
This is explained in
http://tomcat.apache.org/tomcat-6.0-doc/class-loader-howto.html
> I've put the Oracle driver in WEB-INF/lib
That won't be helping. Remove the driver from there.
> I also put it in $catalina_home/lib (tomcat 6 new common/lib ?)
Correct. Again, this is explained in
http://tomcat.apache.org/tomcat-6.0-doc/class-loader-howto.html
> <Resource name="jdbc/dbxe" auth="Container"
> type="javax.sql.DataSource"
> driverClassname="oracle.jdbc.OracleDriver"
> username="jde"
> password="jde"
> url="jdbc:oracle:thin:@localhost:1521:XE"
> />
The attribute is driverClassName, not driverClassname. Case matters.
> I'm confused, it seems tomcat does not find the driver, but it found it when
> I did the direct connection in a JSP page, like this,
Tomcat can't find the driver because you didn't configure the resource
correctly.
> Any idea where the driver should be ?
In $CATALINA_HOME/lib, as per the docs.
> What's going on....?
Your driver is in multiple places in the class loader hierarchy (something
that is pretty much guaranteed to cause problems) and your resource isn't
configured correctly.
> My application worked before.....
Fix the above and it should work with TC6 as well.
Mark
---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org