2
votes

we have a bit of a problem here. We are working on GWT (Google Web Toolkit), with a login page managed by Spring Security and a simple MySQL db for user management. we encountered a strange behaviour. When we run the code in development mode from our IDE (Eclipse), the virtualized jetty runs everything great, but, when we try to build the application in a WAR file, and then deploy it under a Tomcat 7, we have the following error:

Could not get the JDBC connection ... No suitable driver found for jdbc:mysql://localhost:3306/myschema

We already know there are only 2 causes for this exception, and are:

  1. Failed to load the JDBC driver
  2. Wrong parsing of URL connection string

We are pretty sure the URL is correct, as it states here:

<beans:bean id="dataSource"
        class="org.springframework.jdbc.datasource.DriverManagerDataSource">
        <beans:property name="driverClassName" value="com.mysql.jdbc.Driver" />
        <beans:property name="url" value="jdbc:mysql://localhost:3306/myschema" />
        <beans:property name="username" value="root" />
        <beans:property name="password" value="root" />
    </beans:bean>     

so probably the cause here is Tomcat, or Spring Security that messes around with the library. One last thing, we imported correctly all jar files, from JDBC, to SpringFramework and GWT.

If you need some more info, just ask! Thanks..

1
where are your mysql-connector-java jar and spring jar files? - Adisesha
This has nothing to do with GWT. It's a server-side issue. Why did you tag it GWT? It confuses people. Could you remove the GWT tag? - Blessed Geek
my mysql connector jar file is located in web-inf/lib, together with all of the other libraries. If i try to suppress the authentication check, the next page (the one that should appear after logging in) is working, 'cause it also reads some data on the same db..it's really strange, it appears to not working only with spring security.. sorry for the that, it has been already removed. I tagged it with GWT 'cause we thought that could be a gwt compiler problem. - Teqnology

1 Answers

1
votes

It sounds like some kind of ClassLoader issue. I had similar problem, when I used tomcat connection pool (from tomcat lib dir), and had mysql-connector-java jar in war file. I had to move mysql-connector-java to tomcat lib directory.