简体   繁体   English

java.lang.UnsatisfiedLinkError:Native Library sqljdbc_auth.dll已经加载到另一个类加载器中

[英]java.lang.UnsatisfiedLinkError: Native Library sqljdbc_auth.dll already loaded in another classloader

I have multiple applications that needs to connect to MSSQL using windows authentication. 我有多个应用程序需要使用Windows身份验证连接到MSSQL。

The First webApp which is loaded works fine. 加载的第一个webApp工作正常。 but the remaining fail prompting 但剩下的失败提示

Caused by: java.lang.UnsatisfiedLinkError: Native Library $tomcat/bin/sqljdbc_auth.dll already loaded in another classloader

Below is the code used 以下是使用的代码

Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver");
connection= DriverManager.getConnection("jdbc:sqlserver://localhost;databaseName=XXX;integratedSecurity=true");

I Have placed sqljdbc*.jar --> tomcat*/lib and sqljdbc_auth.dll --> tomcat*/bin 我已经放置了sqljdbc * .jar - > tomcat * / lib和sqljdbc_auth.dll - > tomcat * / bin

Seems like all my applications are trying to load the shared lib($tomcat/bin/dll) multiple times. 好像我的所有应用程序都试图多次加载共享库($ tomcat / bin / dll)。 Hence the first load works and the remaining fail. 因此第一次加载工作,剩下的失败。

Edit: 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. 编辑:据我所知,本机库(DLL)只能加载到JVM一次,因此出错,但我在环顾网络后仍然没有解决方案。

How can i load the dll only once? 我怎么能只加载一次DLL?

Please Help!! 请帮忙!!

I would guess. 我猜。 That removing the line 删除线

Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver");

would solve the problem. 会解决问题。

As mentioned in the javadoc of DriverManager 正如DriverManager的javadoc中提到的那样

The DriverManager methods getConnection and getDrivers have been enhanced to support the Java Standard Edition Service Provider mechanism. DriverManager方法getConnectiongetDrivers已得到增强,可支持Java Standard Edition Service Provider机制。
... ...
Applications no longer need to explictly load JDBC drivers using Class.forName() . 应用程序不再需要使用Class.forName()明确加载JDBC驱动程序。

edit This requires a jdbc driver which supports the JDBC 4.0 API. 编辑这需要一个支持JDBC 4.0 API的jdbc驱动程序。 Which should be the case from Microsoft JDBC driver 4.0 on (see: https://docs.microsoft.com/en-us/sql/connect/jdbc/system-requirements-for-the-jdbc-driver ) 从Microsoft JDBC驱动程序4.0开始应该是这种情况(参见: https//docs.microsoft.com/en-us/sql/connect/jdbc/system-requirements-for-the-jdbc-driver

A matrix which Microsoft JDBC driver supports which SQL server version you can find at https://docs.microsoft.com/en-us/sql/connect/jdbc/microsoft-jdbc-driver-for-sql-server-support-matrix Microsoft JDBC驱动程序支持的矩阵,您可以在https://docs.microsoft.com/en-us/sql/connect/jdbc/microsoft-jdbc-driver-for-sql-server-support-matrix找到哪个SQL Server版本

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 本机库sqljdbc_auth.dll已经加载到另一个类加载器中 - Native Library sqljdbc_auth.dll already loaded in another classloader java.lang.UnsatisfiedLinkError:本地库{____。dll}已经加载到另一个类加载器中 - java.lang.UnsatisfiedLinkError: Native Library {____.dll} already loaded in another classloader sqljdbc_auth.dll已在另一个类加载器中加载 - sqljdbc_auth.dll already loaded in another classloader java.lang.UnsatisfiedLinkError: Native Library XXX.so 已经加载到另一个类加载器中 - java.lang.UnsatisfiedLinkError: Native Library XXX.so already loaded in another classloader 在Tomcat8中重新加载应用程序期间,java.lang.UnsatisfiedLinkError本机库已加载到另一个类加载器中 - java.lang.UnsatisfiedLinkError Native Library already loaded in another classloader during app reload in Tomcat8 java.lang.UnsatisfiedLinkError:本机库:{…} .dll已在另一个类加载器中加载 - java.lang.UnsatisfiedLinkError: Native Library: {…}.dll already loaded in another class loader java.lang.UnsatisfiedLinkError:本机库/usr/local/xuggler/lib/libxuggle-xuggler.so.3.4.1012已在另一个类加载器中加载 - java.lang.UnsatisfiedLinkError: Native Library /usr/local/xuggler/lib/libxuggle-xuggler.so.3.4.1012 already loaded in another classloader UnsatisfiedLinkError:本机库sunmscapi.dll已在另一个类加载器中加载 - UnsatisfiedLinkError: Native Library sunmscapi.dll already loaded in another classloader java.lang.UnsatisfiedLinkError:java.library.path 中没有 sqljdbc_auth - java.lang.UnsatisfiedLinkError: no sqljdbc_auth in java.library.path 警告:无法加载sqljdbc_auth.dll原因:java.library.path中没有sqljdbc_auth - WARNING: Failed to load the sqljdbc_auth.dll cause : no sqljdbc_auth in java.library.path
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM