Native Library sqljdbc_auth.dll already loaded in another classloader

主宰稳场 提交于 2019-11-26 22:23:40
Chris White

Each web application has its own Classloader (isolating them). When you call the Class.forName() method, there is a static block which is trying to load the shared library (dll file) - so both your web apps are trying to load the shared lib, hence the error message when the second one attempts to load.

The JDBC jar you have for sqlserver should be moved from being bundled with your wars, to the tomcat 7.0/lib folder and copy the sqljdbc_auth.dll to tomcat/bin folder - this way it will be in the tomcat parent classloader, and the class will only be loaded once.

|----------------------------------|
| sqljdbc*.jar     --> tomcat*/lib |
|----------------------------------|
| sqljdbc_auth.dll --> tomcat*/bin |
|----------------------------------|

I think you are on the right track.

For command line startup you can easily solve the no sqljdbc_auth in java.library.path issue by setting the environment variable

CATALINA_OPTS=-Djava.library.path=/path/to/dll

If you are running tomcat as a service, change the Options parameter under

HKEY_LOCAL_MACHINE\SOFTWARE\Apache Software Foundation\Procrun 2.0\Tomcat7\Parameters\Java

to include:

-Djava.library.path=/path/to/dll

The same error occurs in Jasper Studio.

Probably not the best solution but place the sqljdbc4.jar in C:\Program Files (x86)\TIBCO\Jaspersoft Studio-6.1.0.final\features\jre.win32.win32.x86.feature_1.7.0.u80\jre\lib\ext and the sqljdbc_auth.dll in C:\Program Files (x86)\TIBCO\Jaspersoft Studio-6.1.0.final\features\jre.win32.win32.x86.feature_1.7.0.u80\jre\bin

And it will work.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!