10

I have two web-applications which need to run on Tomcat 6, MS SQL 2008 and JTDS-1.2.2 as driver.

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):

java.sql.SQLException: I/O Error: SSO Failed: Native SSPI library

Of course, the library ntlmauth.dll is under C:\WINDOWS\system32

It seems that the second application which starts is not able to find the ntlmauth.dll for the single sign on.

Adam Wenger
  • 17,100
  • 6
  • 52
  • 63
andrew0007
  • 1,265
  • 4
  • 18
  • 32
  • It hink the DLL may still be loaded and can't be loaded again into the other running instance. You may test this, by putting the DLL into the installation folder of your tomcat(s) and provide the path of that certain DLL to your app. – Christian Kuetbach Nov 23 '10 at 10:12

4 Answers4

19

I got past this by changing the url from

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."

Robert Brown
  • 10,888
  • 7
  • 34
  • 40
Speck
  • 2,259
  • 1
  • 20
  • 29
  • 3
    You just put an end to 3 hours of fruitless debugging. Hooray! – reinierpost Aug 11 '11 at 18:01
  • Yeah, I think it took me a about that long to find the magic setting. – Speck Aug 13 '12 at 02:10
  • 3
    downvoted because parent is asking about SSO and this answer doesn't use SSO (Windows authentication) but SQL Server authentication instead, so doesn't solve the parent problem – Jacob Apr 18 '13 at 23:51
  • 1
    Thank you for your upvote. @Jacob, I looked at the OP and he is not actually asking about SSO. I was not using/didn't care about SSO when I hit the error. The answer I gave got past the issue and on to something I did care about. – Speck Jul 08 '13 at 21:07
  • For me, this error appeared when i mistakenly supplied a blank username – Brimstedt Sep 07 '13 at 08:03
  • It seems like a problem in SQL Server 2008 or above, I never got this problem in SQL Server 2005. It works for me now! Thanks! – Qinjin Sep 16 '13 at 16:13
16

This is the solution:

Download the jTDS driver, unzip it, and copy x86\SSO\ntlmauth.dll to 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

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.

STW
  • 44,917
  • 17
  • 105
  • 161
2

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.

Chris' answer has to do with sqljdbc_auth.dll, but the recommendations are the same for the JTDS driver and ntlmauth.dll:

  1. 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 Java jre\bin directory.
  2. 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.
Community
  • 1
  • 1
glenn380
  • 711
  • 1
  • 5
  • 10
2

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.

Tim Abell
  • 11,186
  • 8
  • 79
  • 110
  • 1
    Yes: there's more info here on deploying both 32 and 64-but DLLs to their correct locations: http://stackoverflow.com/a/16429490/1073262 – perlyking May 12 '17 at 11:03