简体   繁体   中英

Jersey Rest Services + mySQL Database : No suitable driver found

I'm developping Jersey services using a mySql Database. I have a maven project which gathers all of this and it works pretty well on my linux. However a coworker is trying to use it under windows and accessing any services will fail with :

java.sql.SQLException: No suitable driver found for jdbc:mysql://[hidden_ip_adress_for_topic]:3306/riskdb?zeroDateTimeBehavior=convertToNull

We are both using netbeans in which the mySQLConnector is included (according to my invastigations).

Our poject is made of 2 modules : Services and Library. In the library there is all the stuff for database managment. And If I try the library's functions, it works well, I can get data from database ! But as soon as I run Glassfish, An internal error 500 with "driver not found" appears.

Maybe I didn't understand what is the SQL-connector...

Have you got any hint for me ? Thanks !

You have to either copy driver (the jar file downloaded from mysql website) just like it is instructed here or properly treat your driver as a maven dependency added to the module interacting with the database:

<dependency>
    <groupId>mysql</groupId>
    <artifactId>mysql-connector-java</artifactId>
    <version>5.1.6</version>
</dependency>

I would suggest second option because of project portability. Hope it helps.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM