tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Paul Richards <Paul.Richa...@Sun.COM>
Subject Re: Tomcat and DataSource JNDI
Date Wed, 14 Apr 2004 16:59:55 GMT
This is pretty much exactly how mine is laid out already.  The only
difference is that you have the type specified in the context.xml
resource link.

I have since added that attribute to my copy and I still have no luck.. 
Exact same error as before.



On Wed, 2004-04-14 at 00:04, Riaan Oberholzer wrote:
> This here should work. Follows a slightly different
> approach: declare the datasource global to Tomcat and
> let your application use a reference to it. In your
> server.xml, this should be added:
> (Example is for MySql)
> 
> The global DataSource definition
> --------------------------------
> 
> <!-- Global JNDI resources -->
> <GlobalNamingResources>
> 
>   <Resource name="jdbc/MySQLConnectPool" 
>             auth="Container" 
>             type="javax.sql.DataSource" />
> 
>   <ResourceParams name="jdbc/MySQLConnectPool" >
> 			
>     <parameter>
>       <name>username</name>
>       <value>????????</value>
>     </parameter>
> 
>     <parameter>
>       <name>password</name>
>       <value>????????</value>
>     </parameter>
> 
>     <parameter>
>       <name>driverClassName</name>
>       <value>com.mysql.jdbc.Driver</value>
>     </parameter>
> 
>     etc....
> 
>   <ResourceParams>
> 
> </GlobalNamingResources>
> 
> 
> Context reference to global DataSource, this snippet
> comes in the <context> part for your application and
> is very important:
> --------------------------------------
> 
>   <ResourceLink name="jdbc/MySQLConnectPool"
>                 global="jdbc/MySQLConnectPool"
>                 type="javax.sql.DataSource" />
> 
> This should work. If the mysql.jar is in Tomcat's
> /common/lib directory. 
> 
> 
> 
> --- Paul Richards <Paul.Richards@Sun.COM> wrote:
> > Hi,
> > I am running Tomcat from the Java Webservices
> > Developer Pack 1.3 and I
> > cannot get JNDI working for mysql DataSource
> > objects.  I have googled
> > around for my error which is:
> > 
> > java.sql.SQLException: Cannot load JDBC driver class
> > 'null'
> > 	at
> >
> org.apache.commons.dbcp.BasicDataSource.createDataSource(BasicDataSource.java:529)
> > 	at
> >
> org.apache.commons.dbcp.BasicDataSource.getConnection(BasicDataSource.java:329)
> > 
> > 
> > What I found on google was that this error is not
> > just a problem with Mysql and that people have
> > experienced it with Oracle and Postgresql also:
> >
> http://archives.real-time.com/pipermail/tomcat-users/2002-October/081368.html
> > 
> > I tried the suggestion in this last URL of using the
> > exact orderings of
> > parameters in the server.xml file as shown in the
> > Tomcat JNDI DataSource
> > HowTo.  Unfortunately this has not helped my case.
> > 
> > 
> > I appreciate that a very similar thread to this is
> > currently running but
> > that problem looks different to mine.
> > 
> > 
> > I have failover code which created a Mysql
> > datasource manually if the
> > JNDI fails and the failover code works perfectly. 
> > This makes me sure
> > that my CLASSPATHs are correct.
> > 
> > 
> > 
> > -- 
> > Paul Richards <Paul.Richards@Sun.COM>
> > 
> > 
> >
> ---------------------------------------------------------------------
> > To unsubscribe, e-mail:
> > tomcat-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail:
> > tomcat-user-help@jakarta.apache.org
> > 
> 
> 
> 
> 	
> 		
> __________________________________
> Do you Yahoo!?
> Yahoo! Tax Center - File online by April 15th
> http://taxes.yahoo.com/filing.html
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
-- 
Paul Richards <Paul.Richards@Sun.COM>


---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


Mime
View raw message