SQL JDBC Tomcat "Native Library sqljdbc_auth.dll already loaded in another classloader"
-
Tuesday, February 22, 2011 11:31 AM
Using Microsoft's JDBC drivers to connect to a MS SQL database from Java running under Tomcat 6 with Windows Integration Authentication.
It works once, but from then until Tomcat is restarted I get a exception with the following root cause:
java.lang.UnsatisfiedLinkError: Native Library C:\******\tomcat\lib\sqljdbc_auth.dll already loaded in another classloader
where "******" indicates tomcats install directory.
Both sqljdbc_auth.dll and the driver Java library sqljdbc4.jar are in Tomcat's lib directory and neither are packaged with the web applications in question.
I am making no explicit calls to load or loadLibrary, it is all being handled by sqljdbc4.jar classes.
I understand that the native library (DLL) can only be loaded into the JVM once, hence the error, but I after looking around the net I still have no solution.
Any advice would be great. Thanks.
All Replies
-
Tuesday, February 22, 2011 7:11 PM
This issue is not specific to MS JDBC driver. This is a result of how class loading works in a JVM.
It appears that this issue can be resolved by somehow creating a separate class loader for a given application server experiencing the issue and associate the shared library.
TomCat provides several class loaders and one of them is inteded for sharing across all web apps.
http://tomcat.apache.org/tomcat-6.0-doc/class-loader-howto.html (does not talk about this special class loader)
** Refer to http://wiki.apache.org/tomcat/HowTo for an idea on how this can be done for TomCat 6.**
- Marked As Answer by Amina Saify - MSFTModerator Thursday, February 24, 2011 12:51 AM
-
Tuesday, February 21, 2012 10:43 PM
See if this might help.
Copy the SQL Server JDBC driver "sqljdbc4.jar" or the SQL Server JDBC driver that you are using to the ${TOMCAT_HOME}/lib directory.
- Edited by alksjdfklasjd Wednesday, February 22, 2012 2:04 PM

