KrispyCake
KrispyCake

Reputation: 31

Where to place the sqljdbc.jar

I'm developing this Java app, everything works fine in eclipse but this program will not run with Apache Tomcat 7.0 because it cannot find the sqlserver driver.

This app is suppose to connect to a sqlserver 2005 database, but it will not get past the Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver"), on the server side.

I know it's that line because I found:

java.lang.ClassNotFoundException: com.microsoft.sqlserver.jdbc.SQLServerDriver

in my log file. I placed the sqljdbc.jar in every catalinaHome/lib, catalinaHome/shared/lib, and web-inf/lib.

I also edited the catalina.properties so it reads from the shared/lib folder.

I'm out of ideas, any help will be awesome!

UPDATE #1 - problem solved

I manually included the .class files into the war file and now it works.

Upvotes: 3

Views: 7206

Answers (2)

Bozho
Bozho

Reputation: 597076

The correct place for it is application/WEB-INF/lib/. Note the upper-case WEB-INF.

Upvotes: 1

Vladimir Dyuzhev
Vladimir Dyuzhev

Reputation: 18336

CATALINA_HOME/lib should work. Have you restarted Tomcat after that though?

And SQL driver needs some DLLs, it seems. Do you have them setup correctly? The visible error may still be ClassNotFound because if class fails to initialize statically, it is viewed as class not found at all.

Before deploying the driver to Tomcat, make a small local test - a standalone Java class that loads the driver and tries to connect. May point you to the issue more clearly.

Upvotes: 2

Related Questions