我们有一个Java Web应用程序偶尔无法找到加密库。 目前,重新启动应用程序可以解决问题。
以下考试显示在日志中,请参阅下面的完整堆栈跟踪。
java.lang.InternalError: Could not start up the CDSA libraries.
java.lang.NoClassDefFoundError: Could not initialize class com.apple.crypto.provider.HmacMD5
应用程序使用Java 1.6.0_15
构建,并部署到运行的1.6.0_13
Mac OS X Server 10.5.8 (9L30)
有什么想法吗?
干杯
城野
Build Java version
java version "1.6.0_13"
Java(TM) SE Runtime Environment (build 1.6.0_13-b03-211)
Java HotSpot(TM) 64-Bit Server VM (build 11.3-b02-83, mixed mode)
Deployed Jave version
java version "1.6.0_15"
Java(TM) SE Runtime Environment (build 1.6.0_15-b03-226)
Java HotSpot(TM) 64-Bit Server VM (build 14.1-b02-92, mixed mode)
Full stack trace:
java.lang.NoClassDefFoundError: Could not initialize class com.apple.crypto.provider.HmacMD5
at java.lang.ClassLoader$NativeLibrary.load(Native Method)
at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1881)
at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1782)
at java.lang.Runtime.loadLibrary0(Runtime.java:823)
at java.lang.System.loadLibrary(System.java:1047)
at com.apple.crypto.provider.HmacCore.<clinit>(HmacCore.java:26)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
at java.lang.Class.newInstance0(Class.java:355)
at java.lang.Class.newInstance(Class.java:308)
at java.security.Provider$Service.newInstance(Provider.java:1221)
at javax.crypto.Mac.a(DashoA13*..)
at javax.crypto.Mac.init(DashoA13*..)
at com.sun.net.ssl.internal.ssl.MAC.<init>(MAC.java:94)
at com.sun.net.ssl.internal.ssl.CipherSuite$MacAlg.newMac(CipherSuite.java:429)
at com.sun.net.ssl.internal.ssl.Handshaker.newWriteMAC(Handshaker.java:407)
at com.sun.net.ssl.internal.ssl.SSLSocketImpl.changeWriteCiphers(SSLSocketImpl.java:1791)
at com.sun.net.ssl.internal.ssl.Handshaker.sendChangeCipherSpec(Handshaker.java:607)
at com.sun.net.ssl.internal.ssl.ClientHandshaker.sendChangeCipherAndFinish(ClientHandshaker.java:868)
at com.sun.net.ssl.internal.ssl.ClientHandshaker.serverHelloDone(ClientHandshaker.java:794)
at com.sun.net.ssl.internal.ssl.ClientHandshaker.processMessage(ClientHandshaker.java:226)
at com.sun.net.ssl.internal.ssl.Handshaker.processLoop(Handshaker.java:516)
at com.sun.net.ssl.internal.ssl.Handshaker.process_record(Handshaker.java:454)
at com.sun.net.ssl.internal.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:884)
at com.sun.net.ssl.internal.ssl.SSLSocketImpl.performInitialHandshake(SSLSocketImpl.java:1112)
at com.sun.net.ssl.internal.ssl.SSLSocketImpl.writeRecord(SSLSocketImpl.java:623)
at com.sun.net.ssl.internal.ssl.AppOutputStream.write(AppOutputStream.java:59)
at java.io.BufferedOutputStream.flushBuffer(BufferedOutputStream.java:65)
at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:123)
at org.apache.commons.httpclient.methods.EntityEnclosingMethod.writeRequestBody(EntityEnclosingMethod.java:506)
at org.apache.commons.httpclient.HttpMethodBase.writeRequest(HttpMethodBase.java:2114)
at org.apache.commons.httpclient.HttpMethodBase.execute(HttpMethodBase.java:1096)
at org.apache.commons.httpclient.HttpMethodDirector.executeWithRetry(HttpMethodDirector.java:398)
at org.apache.commons.httpclient.HttpMethodDirector.executeMethod(HttpMethodDirector.java:171)
at org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:397)
at org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:323)
答案 0 :(得分:1)
您的错误并不意味着找不到课程。 “无法初始化类com.apple.crypto.provider.HmacMD5”表示静态intizializer块(static { ... }
)导致异常。您是否可以访问MmacMD5的源代码?
我们曾经遇到类似的问题,其中静态块由于不可访问的X服务器而失败 - 但仅当没有启用X-forwarding的服务器SSH会话可用时。 (该类正在注册字体以便以后使用它们来渲染图像)
答案 1 :(得分:0)
正如“sfussenegger”所写,它与静态{}方法有关。如果您找不到有用的文档或源代码,请尝试使用反编译器(如果许可证当然没有问题)。我看到加密库的问题也与安全随机产生的种子有关(系统暂停,直到它获得足够的随机性)。也许这样的事情是问题的一部分。
无论如何,如果你无法摆脱这个问题,那么仍然有充足的城堡作为免费或IAIK作为商业替代品。不多,但也许有帮助...