- This topic has 5 replies, 2 voices, and was last updated 12 years, 1 month ago by support-pradeep.
-
AuthorPosts
-
John BenderParticipantHaving problems integrating Tomcat 7 with MyEclipse debugger using jtds JDBC connector. I can connect to my localhost SQL Server 2008 instance using the MyEclipse Database Explorer Perspective using the following URL: jdbc:jtds:sqlserver://localhost:1433/VendorPortalDemo;. However when I try to debug using the integrated Tomcat 7 server I get the following error: “Cannot load JDBC driver class ‘net.sourceforge.jtds.jdbc.Driver’ ”
. The jtds-1.2.6.jar file is in my /WebRoot/WEB-INF/lib folder and the Java Build Path looks good.Here is my context.xml file:
<?xml version=”1.0″ encoding=”UTF-8″?>
<Context antiJARLocking=”true” path=”/CFO”><Resource name=”jdbc/SpendAnalyticsDB” auth=”Container”
type=”javax.sql.DataSource” username=”vendorportal” password=”secret”
driverClassName=”net.sourceforge.jtds.jdbc.Driver”
url=”jdbc:jtds:sqlserver://localhost:1433/VendorPortalDemo”
maxActive=”8″/>
</Context>Database name is VendorPortalDemo.
Here s the Java code that I’m using to connect:
Context initContext = new InitialContext();
Context webContext = (Context)initContext.lookup(“java:/comp/env”);
DataSource ds = (DataSource) webContext.lookup(“jdbc/SpendAnalyticsDB”);
Connection con = ds.getConnection();The exception is thrown on the ds.getConnection(); line.
Exception is: “Cannot load JDBC driver class ‘net.sourceforge.jtds.jdbc.Driver’ ”Any thoughts would be appreciated. I’ve also tried this with the Microsoft JDBC connector with very similar results.
John
support-pradeepMemberjbender11,
I could not replicate the issue at my end.
Can you please check whether the jtds-1.2.6.jar file is in your projects deployment location ? If not please verify your Library deployment policies under project properties > MyEclipse > Web > Deployment tab.
Let us know how it works for you.
John BenderParticipantI have checked the Deployment tab and I am using the default MyEclipse settings. (Use Smart Deployment, all check boxes are checked). On the build Path tab, I have selected “Yes” Automatically add WEB-INF/lib/*.jar to Web Project build-path.
The jtds-1.2.6.jar file is in the project WEB-INF/lib folder.
I also checked in the MyEclipse Tomcat base directory ( workspace\.metadata\.me_tcat) and I see the .jar file is also there in the WEB-INF/lib folder for my project.Note that if I build a WAR file and deploy it to Tomcat (outside of MyEclipse), it does find the jar file and everything works as expected. Somehow, MyEclipes Tomcat is not seeing the .jar file.
My project build path does have this .jar file included.
Any other suggestions?
John
support-pradeepMemberjbender11,
Can you please copy the jtds-1.2.6.jar file into common>plugins>com.genuitec.eclipse.easie.tomcat.myeclipse_9.0.0.me201109141806>tomcat>lib folder and try to replicate the issue ?
Take a look at this FAQ for information on the ‘common’ folder location along with other MyEclipse files and folders locations :
https://www.genuitec.com/forums/topic/installation-where-are-the-myeclipse-files-and-folders/Let us know how it works for you.
John BenderParticipantWhat finally worked for me was to add the .jar file to the server configuration.
In the server view, right click on MyEclipse Tomcat. Select “Configure Server Connector”.
Click on “MyEclipse–> Servers–>Integrated Sandbox–>MyEclipse Tomcat–>Paths. Add the .jar to the “Append To Classpath” section.Note that I’m using MyEclipse 10.6
John
support-pradeepMemberjbender11,
Glad that you got it working.
Let us know if you see any issues. -
AuthorPosts