我正在尝试在 Jetty 9.0.4 上配置 SSL。我将 Jetty 与 WebSockets 一起使用,并将 Autobahn Android 用于客户端。
我尝试了几种配置,如下: http: //www.eclipse.org/jetty/documentation/current/configuring-ssl.html
还有这个: 在 Jetty 上配置 SSL
最后我总是有这个例外
2013-07-07 13:36:11.742:WARN:oeji.SelectorManager:qtp1384613607-13-selector-0:
java.lang.NullPointerException
at org.eclipse.jetty.server.HttpConnection.<init>(HttpConnection.java:96)
at org.eclipse.jetty.server.HttpConnectionFactory.newConnection(HttpConnectionFactory.java:61)
at org.eclipse.jetty.server.SslConnectionFactory.newConnection(SslConnectionFactory.java:86)
at org.eclipse.jetty.server.ServerConnector$ServerConnectorManager.newConnection(ServerConnector.java:401)
at org.eclipse.jetty.io.SelectorManager$ManagedSelector.createEndPoint(SelectorManager.java:575)
at org.eclipse.jetty.io.SelectorManager$ManagedSelector.access$500(SelectorManager.java:318)
at org.eclipse.jetty.io.SelectorManager$ManagedSelector$Accept.run(SelectorManager.java:699)
at org.eclipse.jetty.io.SelectorManager$ManagedSelector.runChange(SelectorManager.java:407)
at org.eclipse.jetty.io.SelectorManager$ManagedSelector.runChanges(SelectorManager.java:396)
at org.eclipse.jetty.io.SelectorManager$ManagedSelector.processChanges(SelectorManager.java:479)
at org.eclipse.jetty.io.SelectorManager$ManagedSelector.select(SelectorManager.java:440)
at org.eclipse.jetty.io.SelectorManager$ManagedSelector.run(SelectorManager.java:420)
at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:596)
at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:527)
at java.lang.Thread.run(Thread.java:722)
我把所有东西都放在 jetty.xml 中。这是我的配置。
<New id="sslContextFactory" class="org.eclipse.jetty.util.ssl.SslContextFactory">
<Set name="KeyStorePath">
<Property name="jetty.home" default="." />/<Property name="jetty.keystore" default="etc/keystore"/>
</Set>
<Set name="KeyStorePassword">
<Property name="jetty.keystore.password" default="OBF:password"/>
</Set>
<Set name="KeyManagerPassword">
<Property name="jetty.keymanager.password" default="OBF:password"/>
</Set>
<Set name="TrustStorePath">
<Property name="jetty.home" default="." />/<Property name="jetty.truststore" default="etc/keystore"/>
</Set>
<Set name="TrustStorePassword">
<Property name="jetty.truststore.password" default="OBF:password"/>
</Set>
<Set name="EndpointIdentificationAlgorithm"/>
<Set name="ExcludeCipherSuites">
<Array type="String">
<Item>SSL_RSA_WITH_DES_CBC_SHA</Item>
<Item>SSL_DHE_RSA_WITH_DES_CBC_SHA</Item>
<Item>SSL_DHE_DSS_WITH_DES_CBC_SHA</Item>
<Item>SSL_RSA_EXPORT_WITH_RC4_40_MD5</Item>
<Item>SSL_RSA_EXPORT_WITH_DES40_CBC_SHA</Item>
<Item>SSL_DHE_RSA_EXPORT_WITH_DES40_CBC_SHA</Item>
<Item>SSL_DHE_DSS_EXPORT_WITH_DES40_CBC_SHA</Item>
</Array>
</Set>
</New>
<Call id="sslConnector" name="addConnector">
<Arg>
<New class="org.eclipse.jetty.server.ServerConnector">
<Arg name="server">
<Ref refid="Server" />
</Arg>
<Arg name="factories">
<Array type="org.eclipse.jetty.server.ConnectionFactory">
<Item>
<New class="org.eclipse.jetty.server.SslConnectionFactory">
<Arg name="next">http/1.1</Arg>
<Arg name="sslContextFactory">
<Ref refid="sslContextFactory"/>
</Arg>
</New>
</Item>
<Item>
<New class="org.eclipse.jetty.server.HttpConnectionFactory">
<Arg name="config">
<Ref refid="tlsHttpConfig"/>
</Arg>
</New>
</Item>
</Array>
</Arg>
<Set name="host">
<Property name="jetty.host" />
</Set>
<Set name="port">
<Property name="jetty.tls.port" default="8443" />
</Set>
<Set name="idleTimeout">30000</Set>
</New>
</Arg>
</Call>
那么我在没有 SSL 的情况下所做的一切都应该在 jetty 上工作吗?我的 servlet 和套接字?
谢谢大家