我开发了一个带有 Waffle 的示例 Java Web 应用程序,用于 SSO 身份验证。我正在使用 Waffle 1.8 和 Tomcat 8。我让它在我的开发环境(Java 1.8、Tomcat 8、Windows 2012 R2 服务器)中成功运行和验证。但是,当我在 prod 环境(与开发环境相同)中运行相同的应用程序时,尝试访问 url 时会出现以下错误:
SEVERE [http-nio-443-exec-7] org.apache.catalina.core.StandardWrapperValve.invoke Servlet.service() for servlet [Jersey REST Service] in context with path [/Auth-Test] threw exception [Filter execution threw an exception] with root cause java.lang.UnsatisfiedLinkError: Native library (com/sun/jna/win32-x86-64/jnidispatch.dll) not found in resource path ([file:/C:/Program%20Files/Apache%20Software%20Foundation/Tomcat%208.0/webapps/Auth-Test/WEB-INF/classes/, file:/C:/Program%20Files/Apache%20Software%20Foundation/Tomcat%208.0/webapps/Auth-Test/WEB-INF/lib/asm-3.1.jar, file:/C:/Program%20Files/Apache%20Software%20Foundation/Tomcat%208.0/webapps/Auth-Test/WEB-INF/lib/guava-18.0.jar, file:/C:/Program%20Files/Apache%20Software%20Foundation/Tomcat%208.0/webapps/Auth-Test/WEB-INF/lib/jersey-bundle-1.17.1.jar, file:/C:/Program%20Files/Apache%20Software%20Foundation/Tomcat%208.0/webapps/Auth-Test/WEB-INF/lib/jna-4.2.1.jar, file:/C:/Program%20Files/Apache%20Software%20Foundation/Tomcat%208.0/webapps/Auth-Test/WEB-INF/lib/jna-platform-4.2.1.jar, file:/C:/Program%20Files/Apache%20Software%20Foundation/Tomcat%208.0/webapps/Auth-Test/WEB-INF/lib/log4j-1.2.8.jar, file:/C:/Program%20Files/Apache%20Software%20Foundation/Tomcat%208.0/webapps/Auth-Test/WEB-INF/lib/slf4j-api-1.7.12.jar, file:/C:/Program%20Files/Apache%20Software%20Foundation/Tomcat%208.0/webapps/Auth-Test/WEB-INF/lib/waffle-jna-1.8.0.jar])at com.sun.jna.Native.loadNativeDispatchLibraryFromClasspath(Native.java:866).....
dll 文件 (com/sun/jna/win32-x86-64/jnidispatch.dll) 位于 jna-4.2.1.jar 中,jna 应该将其提取到 Tomcat 8.0/temp 文件夹中。在我的开发服务器中,在 temp 文件夹下创建了一个文件夹,并在该文件夹中创建了几个 dll 文件。而在 prod 服务器中,在 temp 文件夹中创建了一个空文件夹。据我了解,jna 无法将 dll 文件从 jar 提取到外部位置。我还尝试将 jna-4.2.1.jar 和 jna-platform-4.2.1.jar 从 WEB-INF/lib/ 移动到 tomcat8/lib。仍然没有成功。
我还验证了 tomcat 在没有安全管理器的情况下运行,以确认问题与访问权限无关。
现在我不知道该怎么做。如果提供解决方案或至少为我指明解决问题的方向,那将是一个很大的帮助。提前致谢。