BouncyCastleProvider无法在Mac OSX上加载Tomcat 7的启动

时间:2013-10-21 21:25:02

标签: java macos tomcat ssl bouncycastle

我正在尝试在我的全新MacBook Pro上设置Tomcat应用程序开发环境。我需要设置一个实现 org.bouncycastle.jce.provider.BouncyCastleProvider 的SSL连接器。

Tomcat 7启动但SSL连接器无法挂载,我在Tomcat Out中读取了这个堆栈:

Grave: Failed to initialize connector [Connector[HTTP/1.1-9443]]
org.apache.catalina.LifecycleException: Failed to initialize component [Connector[HTTP/1.1-9443]]
    at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:106)
    at org.apache.catalina.core.StandardService.initInternal(StandardService.java:559)
    at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:102)
    at org.apache.catalina.core.StandardServer.initInternal(StandardServer.java:814)
    at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:102)
    at org.apache.catalina.startup.Catalina.load(Catalina.java:640)
    at org.apache.catalina.startup.Catalina.load(Catalina.java:665)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:606)
    at org.apache.catalina.startup.Bootstrap.load(Bootstrap.java:281)
    at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:455)
Caused by: org.apache.catalina.LifecycleException: L''initialisation du gestionnaire de protocole a échoué
    at org.apache.catalina.connector.Connector.initInternal(Connector.java:983)
    at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:102)
    ... 12 more
Caused by: java.lang.ClassNotFoundException: Error loading SSL Implementation org.bouncycastle.jce.provider.BouncyCastleProvider :java.lang.ClassCastException: org.bouncycastle.jce.provider.BouncyCastleProvider cannot be cast to org.apache.tomcat.util.net.SSLImplementation
    at org.apache.tomcat.util.net.SSLImplementation.getInstance(SSLImplementation.java:75)
    at org.apache.coyote.http11.AbstractHttp11JsseProtocol.init(AbstractHttp11JsseProtocol.java:118)
    at org.apache.catalina.connector.Connector.initInternal(Connector.java:981)
    ... 13 more

有些东西告诉我它与“java.lang.ClassNotFoundException:”有关。但是我在JAVA_HOME / lib / ext中找到了包含org.bouncycastle.jce.provider.BouncyCastleProvider类的jar。我甚至试图将它放在CATALINA_BASE / lib中,以查看这是否可能来自ClassPath错误。没有!

Tomcat server.xml摘录:

<Connector port="8443" protocol="HTTP/1.1" SSLEnabled="true"
               maxThreads="150" scheme="https" secure="true"
               clientAuth="false" sslProtocol="TLS"
           keystoreFile="/Users/xavier/ssl/pchain.keystore"
           keystorePass="pwd" />

<Connector port="9443" keystorePass="pwd" alias="pca"
               keystoreFile="/Users/xavier/ssl/pca.keystore" keystoreType="BKS"
               SSLEnabled="true" clientAuth="false" protocol="HTTP/1.1" scheme="https" 
                secure="true" sslProtocol="TLS" sslImplementationName="org.bouncycastle.jce.provider.BouncyCastleProvider"/>

以下是我的配置信息:

OS X版本10.8.3, JDK 1.7.0_45, Tomcat版本7.0.42。 BouncyCastle测试包:bcprov-jdk15on-146.jar到bcprov-jdk15on-149.jar

有人已经解决了这个问题吗?

1 个答案:

答案 0 :(得分:0)

org.bouncycastle.jce.provider.BouncyCastleProvider是JCE提供者,但不是sslImplementationName期望的JSSE提供者。

但是,默认Tomcat的JSSE提供程序使用内部JCE,因此如果您在JRE中正确配置了BouncyCastleProvider,那么它的功能将可供JSSE提供程序使用。

同样有助于了解回答这个问题的最终目标是什么 彻底。