无法初始化类 javax.crypto.SunJCE_b [英] Could not initialize class javax.crypto.SunJCE_b

查看:23
本文介绍了无法初始化类 javax.crypto.SunJCE_b的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我开发了一个 Java servlet 应用程序,并且在我的开发 PC 上一切正常,包括以编程方式使用 SFTP 在端口 8443 等上使用 HTTPS 复制 PDF,并使用 SSL 证书.

I have a Java servlet application developed and on my develpment PC everything works as expected including using SFTP programmatically to copy over a PDF using HTTPS on port 8443 etc and with SSL certificates in place too.

但是,当我尝试在 Live 服务器上运行应用程序时,我收到了错误;

However, when I attempt to run the application on the Live server I receive the error;

java.lang.NoClassDefFoundError: 无法初始化类 javax.crypto.SunJCE_b

java.lang.NoClassDefFoundError: Could not initialize class javax.crypto.SunJCE_b

经过调查,有人建议检查 jce.jar.但是我已经确保 jce.jar 存在,并且还在我的项目中创建了一个lib"文件夹并将 jar 复制到那里并将 jar 放在我的构建路径上,但问题仍然存在.

On investigation, some are suggesting check the jce.jar. But I have ensured the jce.jar is present and also created a "lib" folder in my project and copied the jar there and placed the jar on my build path but still the problem exists.

请问我该如何解决?提前致谢.这是Tomcat启动应用程序后的控制台输出;

How do I resolve this please? Thanks in advance. Here is the console output from right after Tomcat has started the application;

08-Jan-2014 10:45:44 org.apache.catalina.startup.Catalina start
INFO: Server startup in 12715 ms
08-Jan-2014 10:47:42 org.apache.tomcat.util.net.NioEndpoint$SocketProcessor run
SEVERE: 
java.lang.NoClassDefFoundError: Could not initialize class javax.crypto.SunJCE_b
at javax.crypto.Cipher.getInstance(DashoA13*..)
at com.sun.net.ssl.internal.ssl.JsseJce.getCipher(Unknown Source)
at com.sun.net.ssl.internal.ssl.RSAClientKeyExchange.<init>(Unknown Source)
at com.sun.net.ssl.internal.ssl.ServerHandshaker.processMessage(Unknown Source)
at com.sun.net.ssl.internal.ssl.Handshaker.processLoop(Unknown Source)
at com.sun.net.ssl.internal.ssl.Handshaker$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at com.sun.net.ssl.internal.ssl.Handshaker$DelegatedTask.run(Unknown Source)
at org.apache.tomcat.util.net.SecureNioChannel.tasks(SecureNioChannel.java:285)
at org.apache.tomcat.util.net.SecureNioChannel.handshakeUnwrap   
(SecureNioChannel.java:343)
at org.apache.tomcat.util.net.SecureNioChannel.handshake
(SecureNioChannel.java:193)
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run
(NioEndpoint.java:1642)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)

推荐答案

jce.jar 必须在部署的 web 应用程序的文件夹 WEB-INF/lib 内.

The jce.jar must be inside the folder WEB-INF/lib of the deployed web application.

这篇关于无法初始化类 javax.crypto.SunJCE_b的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆