Discussion:
Tomcat7 on Ubuntu 12.04 does not load mySQL JDBC Connector
(too old to reply)
Philipp Kraus
2013-11-16 07:25:56 UTC
Permalink
Hello,

I try to install in an Ubuntu 12.04 a Tomcat7 with mySQL JDBC. So I
have run apt-install for tomcat and libmysql-java, but I get always:

java.lang.ClassNotFoundException: "com.mysql.jdbc.Driver"

in my logs. In the catalina.properties the loading pathes are defined with

common.loader=${catalina.base}/lib,${catalina.base}/lib/*.jar,${catalina.home}/lib,${catalina.home}/lib/*.jar,/var/lib/tomcat7/common/classes,/var/lib/tomcat7/common/*.jar

server.loader=/var/lib/tomcat7/server/classes,/var/lib/tomcat7/server/*.jar
shared.loader=/var/lib/tomcat7/shared/classes,/var/lib/tomcat7/shared/*.jar

The JDBC mySQL Jar is stored under /usr/share/java with twi symlinks, I
have tried to create a symlink from Tomcats lib dir
(/usr/share/tomcat7/lib) to ../../java/mysql.jar
but the mySQL is also not loaded.
The CATALINA_HOME is set to /usr/share/tomcat7 and the CATALINA_BASE is
/var/lib/tomcat7, so imho it should be worked

I try to run http://www.icescrum.org/ with mySQL support.

Can anybody help me please with a useful idea to create a working mySQL
JDBC driver in my Tomcat7?

Thanks a lot

Phil
unknown
2013-11-17 09:49:39 UTC
Permalink
Post by Philipp Kraus
Hello,
I try to install in an Ubuntu 12.04 a Tomcat7 with mySQL JDBC. So I have
java.lang.ClassNotFoundException: "com.mysql.jdbc.Driver"
in my logs. In the catalina.properties the loading pathes are defined with
common.loader=${catalina.base}/lib,${catalina.base}/lib/*.jar,${catalina.home}/lib,${catalina.home}/lib/*.jar,/var/lib/tomcat7/common/classes,/var/lib/tomcat7/common/*.jar
server.loader=/var/lib/tomcat7/server/classes,/var/lib/tomcat7/server/*.jar
shared.loader=/var/lib/tomcat7/shared/classes,/var/lib/tomcat7/shared/*.jar
The JDBC mySQL Jar is stored under /usr/share/java with twi symlinks, I
have tried to create a symlink from Tomcats lib dir
(/usr/share/tomcat7/lib) to ../../java/mysql.jar
but the mySQL is also not loaded.
The CATALINA_HOME is set to /usr/share/tomcat7 and the CATALINA_BASE is
/var/lib/tomcat7, so imho it should be worked
I try to run http://www.icescrum.org/ with mySQL support.
Can anybody help me please with a useful idea to create a working mySQL
JDBC driver in my Tomcat7?
Thanks a lot
Ubuntu 12.04 LTS
apache-tomcat-7.0.42
jdk1.7.0_45

Yea, this can be a bit of a PITA sometimes if you are relying on
container managed connection pools as the container needs to find the
jar before a web app that uses it is fully loaded, at least this is what
I have figured out anyway.

I have the following directory structure
/opt/apache-tomcat-7.0.42/

I copied mysql-connector-java-5.1.22-bin.jar
into /opt/apache-tomcat-7.0.42/lib

I restarted the server and it all just works
no sym links and no fancy obscure directory structure scattered across
the file system.

Try it, it might be what you are looking for.
--
Lipska the Kat©: Troll hunter, sandbox destroyer,
treacherous feline and farscape dreamer of Aeryn Sun
GNU/Linux user #560883 - http://www.linuxcounter.net
Philipp Kraus
2013-11-17 10:30:39 UTC
Permalink
Post by unknown
Ubuntu 12.04 LTS
apache-tomcat-7.0.42
jdk1.7.0_45
Did you use Oracle JDK ? I use in my installation OpenJDK
Post by unknown
Yea, this can be a bit of a PITA sometimes if you are relying on
container managed connection pools as the container needs to find the
jar before a web app that uses it is fully loaded, at least this is
what I have figured out anyway.
I have the following directory structure
/opt/apache-tomcat-7.0.42/
I copied mysql-connector-java-5.1.22-bin.jar
into /opt/apache-tomcat-7.0.42/lib
I restarted the server and it all just works
no sym links and no fancy obscure directory structure scattered across
the file system.
I have copied the Jar to the lib directory (without symlink) but the
error exists also. Can it be a problem with the OpenJDK / Oracle JDK?
I have installed Tomcat from Ubuntu's package tree also, the OpenJDK
(dependency) and the mySQL Connector, so imho it should be
okay, because always comes from the package tree

Phil
unknown
2013-11-17 14:36:20 UTC
Permalink
Post by Philipp Kraus
Post by unknown
Ubuntu 12.04 LTS
apache-tomcat-7.0.42
jdk1.7.0_45
Did you use Oracle JDK ? I use in my installation OpenJDK
I have used both
java-7-openjdk-amd64 and Oracle JDK, currently using the Oracle one
Post by Philipp Kraus
Post by unknown
Yea, this can be a bit of a PITA sometimes if you are relying on
container managed connection pools as the container needs to find the
jar before a web app that uses it is fully loaded, at least this is
what I have figured out anyway.
I have the following directory structure
/opt/apache-tomcat-7.0.42/
I copied mysql-connector-java-5.1.22-bin.jar
into /opt/apache-tomcat-7.0.42/lib
I restarted the server and it all just works
no sym links and no fancy obscure directory structure scattered across
the file system.
I have copied the Jar to the lib directory (without symlink) but the
error exists also. Can it be a problem with the OpenJDK / Oracle JDK?
Well then it sounds like something is amiss with the install. I don't
think the Java distro is the problem ...
Post by Philipp Kraus
I have installed Tomcat from Ubuntu's package tree also, the OpenJDK
(dependency) and the mySQL Connector, so imho it should be
okay, because always comes from the package tree
To be honest with you I never bother with Ubuntu packages if I can avoid
it. I just downloaded the relevant gzipped tarball from
tomcat.apache.org/download-70.cgi
Unzip, untar, configure the startup script
and away you go. You know exactly what you have that way and all the
important directories are in one place.

You could try that, you can even install it in a temp directory in your
home directory just to test it out.

There is an excellent mailing list for tomcat which you can join at
http://tomcat.apache.org/lists.html
--
Lipska the Kat©: Troll hunter, sandbox destroyer,
treacherous feline and farscape dreamer of Aeryn Sun
GNU/Linux user #560883 - http://www.linuxcounter.net
Loading...