Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

waffle 2.1.0 - java.lang.NoSuchMethodError com.sun.jna.platform.win32.Sspi$SecBufferDesc.<init>(I[B)V #838

Closed
Bill-Stewart opened this issue Dec 6, 2019 · 10 comments

Comments

@Bill-Stewart
Copy link

Bill-Stewart commented Dec 6, 2019

I am successfully running waffle negotiate 1.9.0 and 1.9.1 with our XWiki installation (Windows Server 2012 R2, Tomcat 9).

I thought it would be good to update waffle to 2.1.0 so I did the following:

  • Replace jna-4.5.2.jar with jna-5.5.0.jar
  • Replace jna-platform-4.5.2.jar with jna-platform-5.5.0.jar
  • Replace waffle-jna-1.9.1.jar with waffle-jna-2.1.0.jar
  • Replace waffle-tomcat9-1.9.1.jar with waffle-tomcat9-2.1.0.jar

The Tomcat service starts successfully, but when I browse to the application, I get this error page in the browser:

HTTP Status 500 – Internal Server Error

--------------------------------------------------------------------------------

Type Exception Report

Message com.sun.jna.platform.win32.Sspi$SecBufferDesc.<init>(I[B)V

Description The server encountered an unexpected condition that prevented it from fulfilling the request.

Exception

java.lang.NoSuchMethodError: com.sun.jna.platform.win32.Sspi$SecBufferDesc.<init>(I[B)V
  waffle.windows.auth.impl.WindowsSecurityContextImpl.setToken(WindowsSecurityContextImpl.java:229)
  waffle.windows.auth.impl.WindowsAuthProviderImpl.acceptSecurityToken(WindowsAuthProviderImpl.java:160)
  waffle.apache.NegotiateAuthenticator.authenticate(NegotiateAuthenticator.java:99)
  waffle.apache.NegotiateAuthenticator.doAuthenticate(NegotiateAuthenticator.java:182)
  org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:572)
  org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:92)
  org.apache.catalina.valves.rewrite.RewriteValve.invoke(RewriteValve.java:556)
  org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:678)
  org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:343)
  org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:408)
  org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66)
  org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:853)
  org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.doRun(AprEndpoint.java:2124)
  org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)
  java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
  java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
  org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
  java.lang.Thread.run(Thread.java:748)
Note The full stack trace of the root cause is available in the server logs.

I can continue to use waffle 1.9.x but I thought this message was peculiar (I though jna provided access to SSPI?).

Any thoughts?

@Bill-Stewart Bill-Stewart changed the title waffle 2.1 - java.lang.NoSuchMethodError com.sun.jna.platform.win32.Sspi$SecBufferDesc.<init>(I[B)V waffle 2.1.0 - java.lang.NoSuchMethodError com.sun.jna.platform.win32.Sspi$SecBufferDesc.<init>(I[B)V Dec 6, 2019
@hazendaz
Copy link
Member

hazendaz commented Jan 7, 2020

@Bill-Stewart I suspect you have another copy of jna on your classpath. The current waffle is on jna 5.5.0 and has been successfully used in a tomcat 9 environment.

@Bill-Stewart
Copy link
Author

XWiki has jna-5.5.0.jar in its WEB-INF\lib directory, but that's the same one as the one in the Tomcat lib directory. Renaming the one in XWiki's WEB-INF\lib didn't make a difference. When I put the following in the Tomcat lib directory:

  • jna-5.5.0.jar
  • jna-platform-5.5.0.jar
  • waffle-jna-2.1.0.jar
  • waffle-tomcat9-2.1.0.jar

I get the exception when authenticating. If I revert back to

  • jna-4.5.2.jar
  • jna-platform-4.5.2.jar
  • waffle-jna-1.9.1.jar
  • waffle-tomcat9-1.9.1.jar

in the Tomcat lib directory, authentication works fine. Not sure what other information I can provide.

@hazendaz
Copy link
Member

hazendaz commented Jan 9, 2020

@Bill-Stewart Version 2.0.0 of waffle stopped using SecBufferDesc directly as it is not possible any longer with version 5.x thus it cannot throw that specific condition. It switched to ManagedSecBufferDesc. The error you have suggests it is still using the old waffle. In fact, the line noted is a curly bracket in code after that change as everything shifted down one line in that specific class WindowsSecurityContextImpl. To me it seems you only upgraded jna to 5.5.0 but are continuing to use waffle 1.9.1. Waffle-jna itself which is where you show the problem occurring has to be the same in both tomcat lib and your war. I suspect while you have tomcat lib correct, your war is still sitting on 1.9.1. Please see the demo usage and try in a clean tomcat with no other apps.

@hazendaz
Copy link
Member

hazendaz commented Jan 9, 2020

@Bill-Stewart Any chance any of your setup uses spring boot? There was a bug on our end that failed to properly force JNA to aligned version. I'll have a release this coming weekend that will resolve spring boot 1 and spring boot 2 usage. It had the same issue you noted here and could easily have been tested via the demos. You might also otherwise just want to wait for that release to retest in case your issue was not the same at all. I again testing in tomcat 9 using mixed demo and it worked fine.

@Bill-Stewart
Copy link
Author

Sounds good; will test again after new release.

@hazendaz
Copy link
Member

hazendaz commented Jun 6, 2020

Closing as we more tightly control our usage of JNA, have documented how users can on readme, and has been thorougly tested in spring boot 2 environment since this.

@Bill-Stewart
Copy link
Author

I attempted to update to Waffle 3.3.0, but got the same error. However, I think I have tracked down the root cause.

My application uses the PostgreSQL JDBC driver with SSPI on Windows, which still seems to use com.sun.jna.platform.win32.Sspi.SecBufferDesc instead of com.sun.jna.platform.win32.SspiUtil.ManagedSecBufferDesc:

pgjdbc/pgjdbc#2690

For now it would seem I'm stuck on Waffle 1.9.1 until the PostgreSQL JDBC driver gets updated to use the new waffle-jna.

@hazendaz
Copy link
Member

@Bill-Stewart Thanks for the info, may be worth adding to FAQ for others if you have time to submit a PR. Its unfortunate they are so behind 👎

@Bill-Stewart
Copy link
Author

Confirmed fixed with PostgreSQL JDBC driver 42.7.1.

@hazendaz
Copy link
Member

hazendaz commented Jan 25, 2024 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants