java.sql.SQLException:I/O 错误:SSO 失败:本机 SSPI 库
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/4219968/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
java.sql.SQLException: I/O Error: SSO Failed: Native SSPI library
提问by andrew0007
I have two web-applications which need to run on Tomcat 6, MS SQL 2008 and JTDS-1.2.2 as driver.
我有两个 Web 应用程序需要在 Tomcat 6、MS SQL 2008 和 JTDS-1.2.2 上作为驱动程序运行。
If I start only one web application everything is working fine, but as soon as I start the second one I get the following error (it does not matter the order):
如果我只启动一个 Web 应用程序,一切正常,但是一旦我启动第二个应用程序,我就会收到以下错误(顺序无关紧要):
java.sql.SQLException: I/O Error: SSO Failed: Native SSPI library
Of course, the library ntlmauth.dll
is under C:\WINDOWS\system32
当然,图书馆ntlmauth.dll
在C:\WINDOWS\system32
It seems that the second application which starts is not able to find the ntlmauth.dll
for the single sign on.
似乎启动的第二个应用程序无法找到ntlmauth.dll
用于单点登录的应用程序。
回答by Gianluca Lodigiani
This is the solution:
这是解决方案:
Download the jTDS driver, unzip it, and copy x86\SSO\ntlmauth.dll
to jdk\jre\bin
.
下载jTDS 驱动程序,解压,然后复制x86\SSO\ntlmauth.dll
到jdk\jre\bin
.
This should solve your issue.
这应该可以解决您的问题。
Edit:
编辑:
Without the JDK installed the path for me was C:\Program Files\Java\jre7\bin\ntlmauth.dll
没有安装JDK,我的路径是 C:\Program Files\Java\jre7\bin\ntlmauth.dll
jTDS must be able to load the native SPPI library (ntlmauth.dll). Place this DLL anywhere in the system path (defined by the PATH system variable) and you're all set.
jTDS 必须能够加载本机 SPPI 库 (ntlmauth.dll)。将此 DLL 放置在系统路径(由 PATH 系统变量定义)中的任何位置,就完成了。
回答by Speck
I got past this by changing the url from
我通过更改 url 来解决这个问题
jdbc:jtds:sqlserver://host_server:1433/Database_name
to
到
jdbc:jtds:sqlserver://host_server:1433/Database_name;user=XXX;password=YYY
Apparently, "When URL [does] not contains user and password properties, systems uses Windows authentication method, and "SSPI Native library not found" error appears."
显然,“当 URL [不] 不包含用户和密码属性时,系统使用 Windows 身份验证方法,并出现“未找到 SSPI 本机库”错误。”
回答by glenn380
If you are trying to run two (or more) Tomcat applications on the same server that both access a SQL Server using the JTDS driver and windows authentication, a very helpful answer courtesy of Chris White is here.
如果您尝试在同一台服务器上运行两个(或更多)Tomcat 应用程序,这两个应用程序都使用 JTDS 驱动程序和 Windows 身份验证访问 SQL Server,这里是 Chris White 提供的一个非常有用的答案。
Chris' answer has to do with sqljdbc_auth.dll, but the recommendations are the same for the JTDS driver and ntlmauth.dll:
Chris 的回答与 sqljdbc_auth.dll 有关,但对于 JTDS 驱动程序和 ntlmauth.dll 的建议是相同的:
- Put ntlmauth.dll into the
tomcat 7.0\bin
directory. Actually, I believe you can put ntlmauth.dll into any directory in the system path, or the Javajre\bin
directory. - Importantly, don't bundle the JTDS jar in the war file of any Tomcat application using the JTDS driver. Instead, put one copy in the
Tomcat\lib
directory, where Tomcat will load it and make it available to all apps.
- 将 ntlmauth.dll 放入
tomcat 7.0\bin
目录中。其实我相信你可以把ntlmauth.dll放到系统路径的任何目录下,或者Javajre\bin
目录下。 - 重要的是,不要在任何使用 JTDS 驱动程序的 Tomcat 应用程序的 war 文件中捆绑 JTDS jar。相反,将一份副本放在
Tomcat\lib
目录中,Tomcat 将在其中加载它并使其可供所有应用程序使用。
回答by Tim Abell
If you are on 64-bit windows but running 32-bit java (the one in program files x86) then you need the 32-bit ntlmauth dll and not the 64 bit one that you might have expected.
如果您在 64 位 Windows 上运行 32 位 java(程序文件 x86 中的那个),那么您需要 32 位 ntlmauth dll 而不是您可能期望的 64 位。