简体   繁体   中英

Tomcat7 configuration jndi mysql connection

I try to configure Tomcat , and MySql Connection .

I add tomcat-jdbc.jar and mysql.connector.jdbc but when I run Tomcat, I obtain this error:

Unexpected exception resolving reference
   java.sql.SQLException: net.sourceforge.jtds.jdbc.Driver

   ...

   Caused by: java.lang.ClassNotFoundException: net.sourceforge.jtds.jdbc.Driver

   ...

   GRAVE: Exception processing Global JNDI Resources
   javax.naming.NamingException: net.sourceforge.jtds.jdbc.Driver

Can you give me any suggest??

Thanks

EDIT After add jtds sourceforge jar:

I obtain this new error when I try deploy my web app:

Cannot resolve reference to bean 'dataSource' while setting bean property 'dataSource';

nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: 

No bean named 'dataSource' is defined Caused by: 

org.springframework.beans.factory.NoSuchBeanDefinitionException: 

No bean named 'dataSource' is defined

You're using jtds driver for sql server, so you need to download the right jar. You can download it from the official site: http://jtds.sourceforge.net/

After downloading it, add it to %TOMCAT_PATH%\\lib, where %TOMCAT_PATH% is the path where you have installed tomcat.

You haven't included the jtds jar in your Tomcat lib, looks like you're missing the jar for this (jtds-1.3.1.jar).

You can download it from here.

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