acslnienlim / marmoset

Automatically exported from code.google.com/p/marmoset
0 stars 0 forks source link

submitServer fails to find mysql driver #35

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. local.web.properties file contains:
database.driver=com.mysql.jdbc.Driver
database.server.jdbc.url=jdbc:mysql://localhost:3306/submitserver
2. the mysql jar file, mysql-connector-java-5.1.24-bin.jar, is in:
tomcat6/webapps/submitServer/WEB-INF/lib and
tomcat6/lib
3. As I understand tomcat, these are the default locations from which jar files 
are 
   expanded for the applications.
Log file shows the following:
Jan 07, 2014 3:49:09 PM org.apache.catalina.core.StandardContext filterStart
SEVERE: Exception starting filter ServletExceptionFilter
java.lang.RuntimeException: Unable to load sql driver com.mysql.jdbc.Driver
        at edu.umd.cs.submitServer.AbtractDatabaseProperties.<init>(AbtractDatabaseProperties.java:36)
        at edu.umd.cs.submitServer.SubmitServerDatabaseProperties.<init>(SubmitServerDatabaseProperties.java:41)
        at edu.umd.cs.submitServer.filters.SubmitServerFilter.init(SubmitServerFilter.java:131)
        at org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:295)
        at org.apache.catalina.core.ApplicationFilterConfig.setFilterDef(ApplicationFilterConfig.java:422)
        at org.apache.catalina.core.ApplicationFilterConfig.<init>(ApplicationFilterConfig.java:115)
        at org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:3838)
        at org.apache.catalina.core.StandardContext.start(StandardContext.java:4488)
        at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:791)
        at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:771)
        at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:526)
        at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:905)
        at org.apache.catalina.startup.HostConfig.deployWARs(HostConfig.java:740)
        at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:500)
        at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1277)
        at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:321)
        at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)
        at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1053)
        at org.apache.catalina.core.StandardHost.start(StandardHost.java:722)
        at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
        at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443)
        at org.apache.catalina.core.StandardService.start(StandardService.java:516)
        at org.apache.catalina.core.StandardServer.start(StandardServer.java:710)
        at org.apache.catalina.startup.Catalina.start(Catalina.java:593)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:606)
        at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:289)
        at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:414)

What is the expected output? What do you see instead?

What version of the product are you using? On what operating system?
latest marmoset as of 1/6/2014, rhel6, 64 bit, tomcat6

Please provide any additional information below.

Original issue reported on code.google.com by Karl.Bur...@gmail.com on 7 Jan 2014 at 10:47

GoogleCodeExporter commented 8 years ago
Examined tomcat6 startup using strace to figure out where and how 
tomcat6/submitServer was being instructed on where to look for mysql driver.  
Discovered the following search paths:
stat("/usr/share/java/tomcat6/com/mysql/jdbc/Driver .class"
stat("/usr/share/tomcat6/com/mysql/jdbc/Driver .class"
stat("/usr/share/tomcat6/com/mysql/jdbc/Driver.class"
stat("/usr/share/tomcat6/com/mysql/jdbc/NonRegisteringDriver.class"
stat("/var/lib/tomcat6/webapps/submitServer/WEB-INF/classes/com/mysql/jdbc/Drive
r .class"
stat("/var/lib/tomcat6/webapps/submitServer/WEB-INF/classes/com/mysql/jdbc/Drive
r.class"
stat("/var/lib/tomcat6/webapps/submitServer/WEB-INF/classes/com/mysql/jdbc/NonRe
gisteringDriver.class"

Of these search paths, I believe that those using WEB-INF/classes will not work 
as currently configured due to the way "ant clean" deals with clearing out the 
classes directory by removing the directory and contents and then creating an 
empty directory.

I believe the space between Driver and .class will also cause problems for some 
of the first search paths, so I tried unzipping the jar file in 
/usr/share/tomcat6.  The next batch of strace found the file and read it, but 
I'm not sure that it really used it. Also noticed some attempts to deal with 
the mysql-connector-java-5.1.27-bin.jar file, but it also does not seem to have 
helped.  The error messages in the /var/log/tomcat6 localhost file is the same 
as before, but this may be due to the trap method being employed in 
submitServer code.

OK.  I seem to be getting wrapped around the axle here with respect to finding 
and reading the com.mysql.jdbc.Driver class definition.

Let me try again: Found the following section in the strace where 
mysql-connector-java-5.1.24-bin.jar in 
/var/lib/tomcat6/webapps/submitServer/WEB-INF/lib, is being located, opened 
(read only), some of the content seems to be being pulled out 
(META-INF/MANIFEST.MF, and subsequent reads seem to fail), eventually suffering 
a Segmentation fault).

There's a part of me that feels I'm missing something really basic here.

Original comment by Karl.Bur...@gmail.com on 8 Jan 2014 at 4:52

GoogleCodeExporter commented 8 years ago
Solved this part of getting server to run.  
database.driver=com.mysql.jdbc.Driver contained a space at the end of "Driver" 
string. I can't say that I'm pleased that this took so long to sort out, but I 
got there in the end.

Is it possible to have strings delimited as strings using ' or "?  This would 
have avoided the problem.

Original comment by Karl.Bur...@gmail.com on 8 Jan 2014 at 10:15