You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Adam Smith <aj...@cornell.edu> on 2001/09/17 18:32:53 UTC
Problems with PoolMan finding mm.mysql driver
The answer to this has to be painfully easy, but I have gone over this many
times now and can't find the answer.
I am using Tomcat 3.2.3, Struts 1.0, PoolMan 2.0.3 and the mm.mysql driver
version 2.0.4. Whenever I try to make a database connection, I am told that
PoolMan cannot find the driver.
I have all the required files in all the required places: PoolMan.jar and
the mm.mysql jar are in the system and tomcat classpaths, the same for the
jdbc standard extesions, jta, etc. If I try to make a connection using the
old-fashioned method of loading the driver and using the driver manager, I
can make a connection in the same servlet just fine.
Here is the code I am trying (where dbname is the <dbname> property in
poolman.xml:
java.sql.Connection myConnection = null;
// Catch java.sql exceptions
try {
// assumes jndi.properties has been configured appropriately
Context ctx = new InitialContext();
// Get a Connection
javax.sql.DataSource ds = PoolMan.findDataSource(mycontents);
myConnection = ds.getConnection();
} catch (SQLException ex) {
while (ex != null) {
String SQLState = "SQLState :" + ex.getSQLState();
String Message = "Message: " + ex.getMessage();
String Vendor = "Vendor: " + ex.getErrorCode();
System.out.println(SQLState);
System.out.println(Message);
System.out.println(Vendor);
ex= ex.getNextException();
} // end while (ex != null)
} catch (javax.naming.NameNotFoundException nne) {
} catch (javax.naming.NamingException nex) {
} catch (java.security.AccessControlException ae) {
}
And here is the error:
September 17, 2001 11:07:33 AM EDT: Creating 5 initial objects in pool
mycontents
September 17, 2001 11:07:33 AM EDT: Looks like the driver was not found...
be sure it is in your CLASSPATH and listed properly in the properties file.
EXCEPTION: org.gjt.mm.mysql.Driver: java.lang.ClassNotFoundException:
org.gjt.mm.mysql.Driver
java.lang.ClassNotFoundException: org.gjt.mm.mysql.Driver
at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
at java.lang.ClassLoader.loadClass(ClassLoader.java:297)
at java.lang.ClassLoader.loadClass(ClassLoader.java:253)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:313)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:120)
at com.codestudio.util.JDBCPool.create(JDBCPool.java:311)
at com.codestudio.util.ObjectPool.checkOut(ObjectPool.java:214)
at com.codestudio.util.ObjectPool.init(ObjectPool.java:94)
at com.codestudio.util.JDBCPool.init(JDBCPool.java:79)
at com.codestudio.util.JDBCPool.<init>(JDBCPool.java:67)
at com.codestudio.util.SQLManager.createPool(SQLManager.java:90)
at
com.codestudio.management.LocalPoolDeployer.startDataSources(LocalPoolDeploy
er.java:90)
at
com.codestudio.management.LocalPoolDeployer.deployConfiguration(LocalPoolDep
loyer.java:30)
at
com.codestudio.management.PoolManBootstrap.<init>(PoolManBootstrap.java:72)
at com.codestudio.util.SQLManager.assertLoaded(SQLManager.java:109)
at com.codestudio.util.SQLManager.getPoolByJNDIName(SQLManager.java:129)
at com.codestudio.sql.PoolMan.findDataSource(PoolMan.java:116)
at
MyContentsBeans.MyContentsDatabaseHelper.openConnection(MyContentsDatabaseHe
lper.java:34)
at MyContentsBeans.patrons.getPatron(patrons.java:272)
at
MyContentsPatronAuthHelper.authenticatePatron(MyContentsPatronAuthHelper.jav
a:111)
at loginPatron.perform(loginPatron.java:57)
at
org.apache.struts.action.ActionServlet.processActionPerform(ActionServlet.ja
va:1786)
at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1585)
at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:491)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at org.apache.tomcat.core.ServletWrapper.doService(ServletWrapper.java:405)
at org.apache.tomcat.core.Handler.service(Handler.java:287)
at org.apache.tomcat.core.ServletWrapper.service(ServletWrapper.java:372)
at
org.apache.tomcat.core.ContextManager.internalService(ContextManager.java:81
2)
at org.apache.tomcat.core.ContextManager.service(ContextManager.java:758)
at
org.apache.tomcat.service.http.HttpConnectionHandler.processConnection(HttpC
onnectionHandler.java:213)
at
org.apache.tomcat.service.TcpWorkerThread.runIt(PoolTcpEndpoint.java:416)
at
org.apache.tomcat.util.ThreadPool$ControlRunnable.run(ThreadPool.java:501)
at java.lang.Thread.run(Thread.java:484)
September 17, 2001 11:07:33 AM EDT: JDBCPool: Exception while initializing
And here is a snippet of the poolman.xml file:
<!-- Standard JDBC Driver info -->
<dbname>mycontents</dbname>
<jndiName>jdni-mycontents</jndiName>
<driver>org.gjt.mm.mysql.Driver</driver>
<url>jdbc:mysql://adam.mannlib.cornell.edu/mycontents</url>
It seems to be reading the poolman.xml file fine and finding all the other
necessary classes, except for the mm.mysql. I have tried moving the jar file
from /tomcat/lib to /myapp/web-inf/lib/ while changing the system classpath.
I have also tried unjarring the mm.mysql jar file and placing the classes in
the /myapp/web-inf/classes structure with no luck.
This has been very frustrating, especially since PoolMan looks like a very
nice pooling program. Any help is appreciated.
___________________________________
Adam Smith
ajs17@cornell.edu
Re: Problems with PoolMan finding mm.mysql driver
Posted by Ted Husted <ar...@jab.org>.
I just have the mysql JAR in my Tomcat lib folder, and don't bother with
a classpath.
It's sometimes the case that you get "class not found" errors when the
jars are found it more than one place, or in more than one way.
Adam Smith wrote:
>
> The answer to this has to be painfully easy, but I have gone over this many
> times now and can't find the answer.
>
> I am using Tomcat 3.2.3, Struts 1.0, PoolMan 2.0.3 and the mm.mysql driver
> version 2.0.4. Whenever I try to make a database connection, I am told that
> PoolMan cannot find the driver.
>
> I have all the required files in all the required places: PoolMan.jar and
> the mm.mysql jar are in the system and tomcat classpaths, the same for the
> jdbc standard extesions, jta, etc. If I try to make a connection using the
> old-fashioned method of loading the driver and using the driver manager, I
> can make a connection in the same servlet just fine.
>
> Here is the code I am trying (where dbname is the <dbname> property in
> poolman.xml:
>
> java.sql.Connection myConnection = null;
>
> // Catch java.sql exceptions
> try {
>
> // assumes jndi.properties has been configured appropriately
> Context ctx = new InitialContext();
>
> // Get a Connection
> javax.sql.DataSource ds = PoolMan.findDataSource(mycontents);
>
> myConnection = ds.getConnection();
>
> } catch (SQLException ex) {
>
> while (ex != null) {
>
> String SQLState = "SQLState :" + ex.getSQLState();
> String Message = "Message: " + ex.getMessage();
> String Vendor = "Vendor: " + ex.getErrorCode();
>
> System.out.println(SQLState);
> System.out.println(Message);
> System.out.println(Vendor);
>
> ex= ex.getNextException();
>
> } // end while (ex != null)
>
> } catch (javax.naming.NameNotFoundException nne) {
>
> } catch (javax.naming.NamingException nex) {
>
> } catch (java.security.AccessControlException ae) {
>
> }
>
> And here is the error:
>
> September 17, 2001 11:07:33 AM EDT: Creating 5 initial objects in pool
> mycontents
> September 17, 2001 11:07:33 AM EDT: Looks like the driver was not found...
> be sure it is in your CLASSPATH and listed properly in the properties file.
> EXCEPTION: org.gjt.mm.mysql.Driver: java.lang.ClassNotFoundException:
> org.gjt.mm.mysql.Driver
> java.lang.ClassNotFoundException: org.gjt.mm.mysql.Driver
> at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
> at java.security.AccessController.doPrivileged(Native Method)
> at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
> at java.lang.ClassLoader.loadClass(ClassLoader.java:297)
> at java.lang.ClassLoader.loadClass(ClassLoader.java:253)
> at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:313)
> at java.lang.Class.forName0(Native Method)
> at java.lang.Class.forName(Class.java:120)
> at com.codestudio.util.JDBCPool.create(JDBCPool.java:311)
> at com.codestudio.util.ObjectPool.checkOut(ObjectPool.java:214)
> at com.codestudio.util.ObjectPool.init(ObjectPool.java:94)
> at com.codestudio.util.JDBCPool.init(JDBCPool.java:79)
> at com.codestudio.util.JDBCPool.<init>(JDBCPool.java:67)
> at com.codestudio.util.SQLManager.createPool(SQLManager.java:90)
> at
> com.codestudio.management.LocalPoolDeployer.startDataSources(LocalPoolDeploy
> er.java:90)
> at
> com.codestudio.management.LocalPoolDeployer.deployConfiguration(LocalPoolDep
> loyer.java:30)
> at
> com.codestudio.management.PoolManBootstrap.<init>(PoolManBootstrap.java:72)
> at com.codestudio.util.SQLManager.assertLoaded(SQLManager.java:109)
> at com.codestudio.util.SQLManager.getPoolByJNDIName(SQLManager.java:129)
> at com.codestudio.sql.PoolMan.findDataSource(PoolMan.java:116)
> at
> MyContentsBeans.MyContentsDatabaseHelper.openConnection(MyContentsDatabaseHe
> lper.java:34)
> at MyContentsBeans.patrons.getPatron(patrons.java:272)
> at
> MyContentsPatronAuthHelper.authenticatePatron(MyContentsPatronAuthHelper.jav
> a:111)
> at loginPatron.perform(loginPatron.java:57)
> at
> org.apache.struts.action.ActionServlet.processActionPerform(ActionServlet.ja
> va:1786)
> at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1585)
> at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:491)
> at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
> at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
> at org.apache.tomcat.core.ServletWrapper.doService(ServletWrapper.java:405)
> at org.apache.tomcat.core.Handler.service(Handler.java:287)
> at org.apache.tomcat.core.ServletWrapper.service(ServletWrapper.java:372)
> at
> org.apache.tomcat.core.ContextManager.internalService(ContextManager.java:81
> 2)
> at org.apache.tomcat.core.ContextManager.service(ContextManager.java:758)
> at
> org.apache.tomcat.service.http.HttpConnectionHandler.processConnection(HttpC
> onnectionHandler.java:213)
> at
> org.apache.tomcat.service.TcpWorkerThread.runIt(PoolTcpEndpoint.java:416)
> at
> org.apache.tomcat.util.ThreadPool$ControlRunnable.run(ThreadPool.java:501)
> at java.lang.Thread.run(Thread.java:484)
> September 17, 2001 11:07:33 AM EDT: JDBCPool: Exception while initializing
>
> And here is a snippet of the poolman.xml file:
>
> <!-- Standard JDBC Driver info -->
> <dbname>mycontents</dbname>
> <jndiName>jdni-mycontents</jndiName>
> <driver>org.gjt.mm.mysql.Driver</driver>
> <url>jdbc:mysql://adam.mannlib.cornell.edu/mycontents</url>
>
> It seems to be reading the poolman.xml file fine and finding all the other
> necessary classes, except for the mm.mysql. I have tried moving the jar file
> from /tomcat/lib to /myapp/web-inf/lib/ while changing the system classpath.
> I have also tried unjarring the mm.mysql jar file and placing the classes in
> the /myapp/web-inf/classes structure with no luck.
>
> This has been very frustrating, especially since PoolMan looks like a very
> nice pooling program. Any help is appreciated.
>
> ___________________________________
> Adam Smith
> ajs17@cornell.edu
RE: Problems with PoolMan finding mm.mysql driver
Posted by Adam Smith <aj...@cornell.edu>.
Thanks for the response.
I have all the locations set up as you say, but I am still having the same
problem. I have cleaned-up all the other directories I have been working in
so that my web-inf/lib directory contains all of the jars and my poolman.xml
file is in web-inf/classes, and these files don't exist anywhere else.
This is strange. I have all of the required files according to the poolman
documentation and I even tried an older version of the mm.mysql driver.
There has to be something fundamental I am overlooking, unless others are
having the same problem.
-----Original Message-----
From: Will Jaynes [mailto:wjaynes@mediaone.net]
Sent: Monday, September 17, 2001 1:40 PM
To: struts-user@jakarta.apache.org
Subject: Re: Problems with PoolMan finding mm.mysql driver
This problem has to do with classloaders and relative positions of the
poolman
and jdbc jar files. There are a lot of possible configurations. The simplest
is:
poolman.jar in WEB-INF/lib
poolman.xml in WEB-INF/classes
jdbc jar in WEB-INF/lib or in %JAVA_HOME%/jre/lib/ext (where I like it)
This makes for a poolman config that is completely local to the webapp and
so
each webapp can be configured without regard for other webapps. It also
makes
for a connection pool that is local to the webapp.
Regards, Will
Re: Problems with PoolMan finding mm.mysql driver
Posted by Will Jaynes <wj...@mediaone.net>.
This problem has to do with classloaders and relative positions of the poolman
and jdbc jar files. There are a lot of possible configurations. The simplest is:
poolman.jar in WEB-INF/lib
poolman.xml in WEB-INF/classes
jdbc jar in WEB-INF/lib or in %JAVA_HOME%/jre/lib/ext (where I like it)
This makes for a poolman config that is completely local to the webapp and so
each webapp can be configured without regard for other webapps. It also makes
for a connection pool that is local to the webapp.
Regards, Will
----- Original Message -----
From: "Adam Smith" <aj...@cornell.edu>
To: "Struts-User" <st...@jakarta.apache.org>
Sent: Monday, September 17, 2001 12:32 PM
Subject: Problems with PoolMan finding mm.mysql driver
The answer to this has to be painfully easy, but I have gone over this many
times now and can't find the answer.
I am using Tomcat 3.2.3, Struts 1.0, PoolMan 2.0.3 and the mm.mysql driver
version 2.0.4. Whenever I try to make a database connection, I am told that
PoolMan cannot find the driver.
I have all the required files in all the required places: PoolMan.jar and
the mm.mysql jar are in the system and tomcat classpaths, the same for the
jdbc standard extesions, jta, etc. If I try to make a connection using the
old-fashioned method of loading the driver and using the driver manager, I
can make a connection in the same servlet just fine.
Here is the code I am trying (where dbname is the <dbname> property in
poolman.xml:
java.sql.Connection myConnection = null;
// Catch java.sql exceptions
try {
// assumes jndi.properties has been configured appropriately
Context ctx = new InitialContext();
// Get a Connection
javax.sql.DataSource ds = PoolMan.findDataSource(mycontents);
myConnection = ds.getConnection();
} catch (SQLException ex) {
while (ex != null) {
String SQLState = "SQLState :" + ex.getSQLState();
String Message = "Message: " + ex.getMessage();
String Vendor = "Vendor: " + ex.getErrorCode();
System.out.println(SQLState);
System.out.println(Message);
System.out.println(Vendor);
ex= ex.getNextException();
} // end while (ex != null)
} catch (javax.naming.NameNotFoundException nne) {
} catch (javax.naming.NamingException nex) {
} catch (java.security.AccessControlException ae) {
}
And here is the error:
September 17, 2001 11:07:33 AM EDT: Creating 5 initial objects in pool
mycontents
September 17, 2001 11:07:33 AM EDT: Looks like the driver was not found...
be sure it is in your CLASSPATH and listed properly in the properties file.
EXCEPTION: org.gjt.mm.mysql.Driver: java.lang.ClassNotFoundException:
org.gjt.mm.mysql.Driver
java.lang.ClassNotFoundException: org.gjt.mm.mysql.Driver
at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
at java.lang.ClassLoader.loadClass(ClassLoader.java:297)
at java.lang.ClassLoader.loadClass(ClassLoader.java:253)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:313)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:120)
at com.codestudio.util.JDBCPool.create(JDBCPool.java:311)
at com.codestudio.util.ObjectPool.checkOut(ObjectPool.java:214)
at com.codestudio.util.ObjectPool.init(ObjectPool.java:94)
at com.codestudio.util.JDBCPool.init(JDBCPool.java:79)
at com.codestudio.util.JDBCPool.<init>(JDBCPool.java:67)
at com.codestudio.util.SQLManager.createPool(SQLManager.java:90)
at
com.codestudio.management.LocalPoolDeployer.startDataSources(LocalPoolDeploy
er.java:90)
at
com.codestudio.management.LocalPoolDeployer.deployConfiguration(LocalPoolDep
loyer.java:30)
at
com.codestudio.management.PoolManBootstrap.<init>(PoolManBootstrap.java:72)
at com.codestudio.util.SQLManager.assertLoaded(SQLManager.java:109)
at com.codestudio.util.SQLManager.getPoolByJNDIName(SQLManager.java:129)
at com.codestudio.sql.PoolMan.findDataSource(PoolMan.java:116)
at
MyContentsBeans.MyContentsDatabaseHelper.openConnection(MyContentsDatabaseHe
lper.java:34)
at MyContentsBeans.patrons.getPatron(patrons.java:272)
at
MyContentsPatronAuthHelper.authenticatePatron(MyContentsPatronAuthHelper.jav
a:111)
at loginPatron.perform(loginPatron.java:57)
at
org.apache.struts.action.ActionServlet.processActionPerform(ActionServlet.ja
va:1786)
at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1585)
at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:491)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at org.apache.tomcat.core.ServletWrapper.doService(ServletWrapper.java:405)
at org.apache.tomcat.core.Handler.service(Handler.java:287)
at org.apache.tomcat.core.ServletWrapper.service(ServletWrapper.java:372)
at
org.apache.tomcat.core.ContextManager.internalService(ContextManager.java:81
2)
at org.apache.tomcat.core.ContextManager.service(ContextManager.java:758)
at
org.apache.tomcat.service.http.HttpConnectionHandler.processConnection(HttpC
onnectionHandler.java:213)
at
org.apache.tomcat.service.TcpWorkerThread.runIt(PoolTcpEndpoint.java:416)
at
org.apache.tomcat.util.ThreadPool$ControlRunnable.run(ThreadPool.java:501)
at java.lang.Thread.run(Thread.java:484)
September 17, 2001 11:07:33 AM EDT: JDBCPool: Exception while initializing
And here is a snippet of the poolman.xml file:
<!-- Standard JDBC Driver info -->
<dbname>mycontents</dbname>
<jndiName>jdni-mycontents</jndiName>
<driver>org.gjt.mm.mysql.Driver</driver>
<url>jdbc:mysql://adam.mannlib.cornell.edu/mycontents</url>
It seems to be reading the poolman.xml file fine and finding all the other
necessary classes, except for the mm.mysql. I have tried moving the jar file
from /tomcat/lib to /myapp/web-inf/lib/ while changing the system classpath.
I have also tried unjarring the mm.mysql jar file and placing the classes in
the /myapp/web-inf/classes structure with no luck.
This has been very frustrating, especially since PoolMan looks like a very
nice pooling program. Any help is appreciated.
___________________________________
Adam Smith
ajs17@cornell.edu
RE: Problems with PoolMan finding mm.mysql driver
Posted by Adam Smith <aj...@cornell.edu>.
You're right, that is the error I am getting. But, the jdbc class is in the
classpath, and it is being seen by a servlet in the app when I make a static
connection (registering the driver, etc.) However, when I try to create the
connection pool in PoolMan, it says it cannot see the driver class.
-----Original Message-----
From: Vic Cekvenich [mailto:vic@proJ.com]
Sent: Monday, September 17, 2001 3:33 PM
To: struts-user@jakarta.apache.org
Subject: Re: Problems with PoolMan finding mm.mysql driver
This says that your JDBC class is not found, not poolman. Make sure it
is in the classpath.
Vic
Adam Smith wrote:
>The answer to this has to be painfully easy, but I have gone over this many
>times now and can't find the answer.
>
>I am using Tomcat 3.2.3, Struts 1.0, PoolMan 2.0.3 and the mm.mysql driver
>version 2.0.4. Whenever I try to make a database connection, I am told that
>PoolMan cannot find the driver.
>
>I have all the required files in all the required places: PoolMan.jar and
>the mm.mysql jar are in the system and tomcat classpaths, the same for the
>jdbc standard extesions, jta, etc. If I try to make a connection using the
>old-fashioned method of loading the driver and using the driver manager, I
>can make a connection in the same servlet just fine.
>
>Here is the code I am trying (where dbname is the <dbname> property in
>poolman.xml:
>
>java.sql.Connection myConnection = null;
>
> // Catch java.sql exceptions
> try {
>
> // assumes jndi.properties has been configured appropriately
> Context ctx = new InitialContext();
>
> // Get a Connection
> javax.sql.DataSource ds = PoolMan.findDataSource(mycontents);
>
> myConnection = ds.getConnection();
>
> } catch (SQLException ex) {
>
> while (ex != null) {
>
> String SQLState = "SQLState :" + ex.getSQLState();
> String Message = "Message: " + ex.getMessage();
> String Vendor = "Vendor: " + ex.getErrorCode();
>
> System.out.println(SQLState);
> System.out.println(Message);
> System.out.println(Vendor);
>
> ex= ex.getNextException();
>
> } // end while (ex != null)
>
>
> } catch (javax.naming.NameNotFoundException nne) {
>
> } catch (javax.naming.NamingException nex) {
>
> } catch (java.security.AccessControlException ae) {
>
> }
>
>And here is the error:
>
>September 17, 2001 11:07:33 AM EDT: Creating 5 initial objects in pool
>mycontents
>September 17, 2001 11:07:33 AM EDT: Looks like the driver was not found...
>be sure it is in your CLASSPATH and listed properly in the properties file.
>EXCEPTION: org.gjt.mm.mysql.Driver: java.lang.ClassNotFoundException:
>org.gjt.mm.mysql.Driver
>java.lang.ClassNotFoundException: org.gjt.mm.mysql.Driver
> at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
> at java.security.AccessController.doPrivileged(Native Method)
> at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
> at java.lang.ClassLoader.loadClass(ClassLoader.java:297)
> at java.lang.ClassLoader.loadClass(ClassLoader.java:253)
> at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:313)
> at java.lang.Class.forName0(Native Method)
> at java.lang.Class.forName(Class.java:120)
> at com.codestudio.util.JDBCPool.create(JDBCPool.java:311)
> at com.codestudio.util.ObjectPool.checkOut(ObjectPool.java:214)
> at com.codestudio.util.ObjectPool.init(ObjectPool.java:94)
> at com.codestudio.util.JDBCPool.init(JDBCPool.java:79)
> at com.codestudio.util.JDBCPool.<init>(JDBCPool.java:67)
> at com.codestudio.util.SQLManager.createPool(SQLManager.java:90)
> at
>com.codestudio.management.LocalPoolDeployer.startDataSources(LocalPoolDeplo
y
>er.java:90)
> at
>com.codestudio.management.LocalPoolDeployer.deployConfiguration(LocalPoolDe
p
>loyer.java:30)
> at
>com.codestudio.management.PoolManBootstrap.<init>(PoolManBootstrap.java:72)
> at com.codestudio.util.SQLManager.assertLoaded(SQLManager.java:109)
> at com.codestudio.util.SQLManager.getPoolByJNDIName(SQLManager.java:129)
> at com.codestudio.sql.PoolMan.findDataSource(PoolMan.java:116)
> at
>MyContentsBeans.MyContentsDatabaseHelper.openConnection(MyContentsDatabaseH
e
>lper.java:34)
> at MyContentsBeans.patrons.getPatron(patrons.java:272)
> at
>MyContentsPatronAuthHelper.authenticatePatron(MyContentsPatronAuthHelper.ja
v
>a:111)
> at loginPatron.perform(loginPatron.java:57)
> at
>org.apache.struts.action.ActionServlet.processActionPerform(ActionServlet.j
a
>va:1786)
> at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1585)
> at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:491)
> at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
> at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
> at
org.apache.tomcat.core.ServletWrapper.doService(ServletWrapper.java:405)
> at org.apache.tomcat.core.Handler.service(Handler.java:287)
> at org.apache.tomcat.core.ServletWrapper.service(ServletWrapper.java:372)
> at
>org.apache.tomcat.core.ContextManager.internalService(ContextManager.java:8
1
>2)
> at org.apache.tomcat.core.ContextManager.service(ContextManager.java:758)
> at
>org.apache.tomcat.service.http.HttpConnectionHandler.processConnection(Http
C
>onnectionHandler.java:213)
> at
>org.apache.tomcat.service.TcpWorkerThread.runIt(PoolTcpEndpoint.java:416)
> at
>org.apache.tomcat.util.ThreadPool$ControlRunnable.run(ThreadPool.java:501)
> at java.lang.Thread.run(Thread.java:484)
>September 17, 2001 11:07:33 AM EDT: JDBCPool: Exception while initializing
>
>
>And here is a snippet of the poolman.xml file:
>
> <!-- Standard JDBC Driver info -->
> <dbname>mycontents</dbname>
> <jndiName>jdni-mycontents</jndiName>
> <driver>org.gjt.mm.mysql.Driver</driver>
> <url>jdbc:mysql://adam.mannlib.cornell.edu/mycontents</url>
>
>It seems to be reading the poolman.xml file fine and finding all the other
>necessary classes, except for the mm.mysql. I have tried moving the jar
file
>from /tomcat/lib to /myapp/web-inf/lib/ while changing the system
classpath.
>I have also tried unjarring the mm.mysql jar file and placing the classes
in
>the /myapp/web-inf/classes structure with no luck.
>
>This has been very frustrating, especially since PoolMan looks like a very
>nice pooling program. Any help is appreciated.
>
>___________________________________
> Adam Smith
> ajs17@cornell.edu
>
>
>
Re: Problems with PoolMan finding mm.mysql driver
Posted by Vic Cekvenich <vi...@proJ.com>.
This says that your JDBC class is not found, not poolman. Make sure it
is in the classpath.
Vic
Adam Smith wrote:
>The answer to this has to be painfully easy, but I have gone over this many
>times now and can't find the answer.
>
>I am using Tomcat 3.2.3, Struts 1.0, PoolMan 2.0.3 and the mm.mysql driver
>version 2.0.4. Whenever I try to make a database connection, I am told that
>PoolMan cannot find the driver.
>
>I have all the required files in all the required places: PoolMan.jar and
>the mm.mysql jar are in the system and tomcat classpaths, the same for the
>jdbc standard extesions, jta, etc. If I try to make a connection using the
>old-fashioned method of loading the driver and using the driver manager, I
>can make a connection in the same servlet just fine.
>
>Here is the code I am trying (where dbname is the <dbname> property in
>poolman.xml:
>
>java.sql.Connection myConnection = null;
>
> // Catch java.sql exceptions
> try {
>
> // assumes jndi.properties has been configured appropriately
> Context ctx = new InitialContext();
>
> // Get a Connection
> javax.sql.DataSource ds = PoolMan.findDataSource(mycontents);
>
> myConnection = ds.getConnection();
>
> } catch (SQLException ex) {
>
> while (ex != null) {
>
> String SQLState = "SQLState :" + ex.getSQLState();
> String Message = "Message: " + ex.getMessage();
> String Vendor = "Vendor: " + ex.getErrorCode();
>
> System.out.println(SQLState);
> System.out.println(Message);
> System.out.println(Vendor);
>
> ex= ex.getNextException();
>
> } // end while (ex != null)
>
>
> } catch (javax.naming.NameNotFoundException nne) {
>
> } catch (javax.naming.NamingException nex) {
>
> } catch (java.security.AccessControlException ae) {
>
> }
>
>And here is the error:
>
>September 17, 2001 11:07:33 AM EDT: Creating 5 initial objects in pool
>mycontents
>September 17, 2001 11:07:33 AM EDT: Looks like the driver was not found...
>be sure it is in your CLASSPATH and listed properly in the properties file.
>EXCEPTION: org.gjt.mm.mysql.Driver: java.lang.ClassNotFoundException:
>org.gjt.mm.mysql.Driver
>java.lang.ClassNotFoundException: org.gjt.mm.mysql.Driver
> at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
> at java.security.AccessController.doPrivileged(Native Method)
> at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
> at java.lang.ClassLoader.loadClass(ClassLoader.java:297)
> at java.lang.ClassLoader.loadClass(ClassLoader.java:253)
> at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:313)
> at java.lang.Class.forName0(Native Method)
> at java.lang.Class.forName(Class.java:120)
> at com.codestudio.util.JDBCPool.create(JDBCPool.java:311)
> at com.codestudio.util.ObjectPool.checkOut(ObjectPool.java:214)
> at com.codestudio.util.ObjectPool.init(ObjectPool.java:94)
> at com.codestudio.util.JDBCPool.init(JDBCPool.java:79)
> at com.codestudio.util.JDBCPool.<init>(JDBCPool.java:67)
> at com.codestudio.util.SQLManager.createPool(SQLManager.java:90)
> at
>com.codestudio.management.LocalPoolDeployer.startDataSources(LocalPoolDeploy
>er.java:90)
> at
>com.codestudio.management.LocalPoolDeployer.deployConfiguration(LocalPoolDep
>loyer.java:30)
> at
>com.codestudio.management.PoolManBootstrap.<init>(PoolManBootstrap.java:72)
> at com.codestudio.util.SQLManager.assertLoaded(SQLManager.java:109)
> at com.codestudio.util.SQLManager.getPoolByJNDIName(SQLManager.java:129)
> at com.codestudio.sql.PoolMan.findDataSource(PoolMan.java:116)
> at
>MyContentsBeans.MyContentsDatabaseHelper.openConnection(MyContentsDatabaseHe
>lper.java:34)
> at MyContentsBeans.patrons.getPatron(patrons.java:272)
> at
>MyContentsPatronAuthHelper.authenticatePatron(MyContentsPatronAuthHelper.jav
>a:111)
> at loginPatron.perform(loginPatron.java:57)
> at
>org.apache.struts.action.ActionServlet.processActionPerform(ActionServlet.ja
>va:1786)
> at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1585)
> at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:491)
> at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
> at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
> at org.apache.tomcat.core.ServletWrapper.doService(ServletWrapper.java:405)
> at org.apache.tomcat.core.Handler.service(Handler.java:287)
> at org.apache.tomcat.core.ServletWrapper.service(ServletWrapper.java:372)
> at
>org.apache.tomcat.core.ContextManager.internalService(ContextManager.java:81
>2)
> at org.apache.tomcat.core.ContextManager.service(ContextManager.java:758)
> at
>org.apache.tomcat.service.http.HttpConnectionHandler.processConnection(HttpC
>onnectionHandler.java:213)
> at
>org.apache.tomcat.service.TcpWorkerThread.runIt(PoolTcpEndpoint.java:416)
> at
>org.apache.tomcat.util.ThreadPool$ControlRunnable.run(ThreadPool.java:501)
> at java.lang.Thread.run(Thread.java:484)
>September 17, 2001 11:07:33 AM EDT: JDBCPool: Exception while initializing
>
>
>And here is a snippet of the poolman.xml file:
>
> <!-- Standard JDBC Driver info -->
> <dbname>mycontents</dbname>
> <jndiName>jdni-mycontents</jndiName>
> <driver>org.gjt.mm.mysql.Driver</driver>
> <url>jdbc:mysql://adam.mannlib.cornell.edu/mycontents</url>
>
>It seems to be reading the poolman.xml file fine and finding all the other
>necessary classes, except for the mm.mysql. I have tried moving the jar file
>from /tomcat/lib to /myapp/web-inf/lib/ while changing the system classpath.
>I have also tried unjarring the mm.mysql jar file and placing the classes in
>the /myapp/web-inf/classes structure with no luck.
>
>This has been very frustrating, especially since PoolMan looks like a very
>nice pooling program. Any help is appreciated.
>
>___________________________________
> Adam Smith
> ajs17@cornell.edu
>
>
>