First of all I must say that I've already looked for this problem and I've found several answers, none worked for me.
I've Tomcat 7 running as a service on Windows 2008 x64 with JDK 1.7.0.10.
I'm trying to use a JDBC Connection Pool, that I've successfully run in Tomcat 6.0.36 (Not installed as a service) on Windows 7 x86. The configuration was simple:
1-. Copy sqljdbc4.jar into %CATALINA_HOME%\lib directory.
2-. Edit %CATALINA_HOME%\webapps\APP_NAME\META-INF\context.xml:
<?xml version="1.0" encoding="UTF-8"?>
<Context antiJARLocking="true" path="/APP_NAME">
<Resource name="jdbc/poolConexiones"
auth="Container"
driverclassname="com.microsoft.sqlserver.jdbc.SQLServerDriver"
maxactive="100"
maxidle="30"
maxwait="10000"
username="user"
password="pass"
type="javax.sql.DataSource"
url="jdbc:sqlserver://localhost:1433;databaseName=Name">
</Resource>
</Context>
3-. Edit web.xml:
<resource-ref>
<res-ref-name>jdbc/poolConexiones</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
<res-sharing-scope>Shareable</res-sharing-scope>
</resource-ref>
And it works fine!
BUT, when I tried to run the same application in
- a) w2008 x64 and tomcat (v 6 and 7) installed as service
- b) wXP x86 and tomcat (v 6 and 7) installed as service
following the same steps, I got:
org.apache.tomcat.dbcp.dbcp.SQLNestedException: Cannot create JDBC driver of class '' for connect URL 'null'
at org.apache.tomcat.dbcp.dbcp.BasicDataSource.createConnectionFactory(BasicDataSource.java:1452)
at org.apache.tomcat.dbcp.dbcp.BasicDataSource.createDataSource(BasicDataSource.java:1371)
at org.apache.tomcat.dbcp.dbcp.BasicDataSource.getConnection(BasicDataSource.java:1044)
Then I tried different things:
Modify jvm's classpath on service laucher:
Java Classpath: C:\Program Files\Apache Software Foundation\Tomcat 7.0\lib\sqljdbc4.jar;C:\Program Files\Apache Software Foundation\Tomcat 7.0\bin\bootstrap.jar;C:\Program Files\Apache Software Foundation\Tomcat 7.0\bin\tomcat-juli.jar
Works on WinXP, but it didn't work on w2008.
Use regular Tomcat version (not service), modify Catalina.bat in order to include sqljdbc4.jar in classpath:
if "%CLASSPATH%" == "" goto emptyClasspath set "CLASSPATH=%CATALINA_HOME%\lib\sqljdbc4.jar;%CLASSPATH%;" :emptyClasspath set "CLASSPATH=%CATALINA_HOME%\lib\sqljdbc4.jar;%CLASSPATH%%CATALINA_HOME%\bin\bootstrap.jar"
if not "%CATALINA_TMPDIR%" == "" goto gotTmpdir set "CATALINA_TMPDIR=%CATALINA_BASE%\temp" :gotTmpdir
Works on WinXP, but it didn't work on w2008
So, after repeating several times the same steps in different order and trying different versions of tomcat an Java, I don't know what else to do.
Please, remember that this application is running with this configuration in w7 x86 and tomcat 6 through Netbeans 6.91 without ANY modification, and it runs on Win XP x86 editing the classpath.
What's the problem then?
Sorry for my bad English. Thank you.