以下のように、注釈付きのサンプル クライアント エンドポイントを作成しました。
public WebsocketSSLClientEndpoint(URI endpointURI) throws URISyntaxException {
final ClientManager client = ClientManager.createClient();
try {
System.getProperties().put(SSLContextConfigurator.KEY_STORE_FILE, "/tmp/ServerId.jks");
System.getProperties().put(SSLContextConfigurator.TRUST_STORE_FILE, "/tmp/ServerTrust.jks");
System.getProperties().put(SSLContextConfigurator.KEY_STORE_PASSWORD, "ServerKeyStorePassPhrase");
System.getProperties().put(SSLContextConfigurator.TRUST_STORE_PASSWORD, "ServerTrustStorePassPhrase");
System.getProperties().put("javax.net.debug", "all");
SslEngineConfigurator sslEngineConfigurator = new SslEngineConfigurator(new SslContextConfigurator());
sslEngineConfigurator.setHostVerificationEnabled(false); //skip host verification
client.getProperties().put(ClientProperties.SSL_ENGINE_CONFIGURATOR, sslEngineConfigurator);
System.out.println("before connect");
client.connectToServer(this, endpointURI);
System.out.println("after connect");
しかし、接続しようとすると、
uri = new URI ("wss://foo.bar.com:8002/ws/echo");
System.out.println("WebSocket Address used is : "+uri.toString());
// open websocket
final WebsocketSSLClientEndpoint clientEndPoint = new WebsocketSSLClientEndpoint(uri);
以下の例外が発生します。
javax.websocket.DeploymentException: KeyManagerFactoryImpl is not initialized
at org.glassfish.tyrus.container.grizzly.client.GrizzlyClientSocket.connect(GrizzlyClientSocket.java:255)
at org.glassfish.tyrus.container.grizzly.client.GrizzlyClientContainer.openClientSocket(GrizzlyClientContainer.java:95)
at org.glassfish.tyrus.client.ClientManager$3$1.run(ClientManager.java:663)
at org.glassfish.tyrus.client.ClientManager$3.run(ClientManager.java:712)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
Caused by: java.lang.IllegalStateException: KeyManagerFactoryImpl is not initialized
at sun.security.ssl.KeyManagerFactoryImpl.engineGetKeyManagers(KeyManagerFactoryImpl.java:51)
at javax.net.ssl.KeyManagerFactory.getKeyManagers(KeyManagerFactory.java:289)
at org.glassfish.tyrus.client.SslContextConfigurator.createSSLContext(SslContextConfigurator.java:734)
at org.glassfish.tyrus.client.SslEngineConfigurator.getSslContext(SslEngineConfigurator.java:441)
at org.glassfish.tyrus.container.grizzly.client.GrizzlyClientSocket$ExtendedSSLEngineConfigurator.<init>(GrizzlyClientSocket.java:892)
at org.glassfish.tyrus.container.grizzly.client.GrizzlyClientSocket.getSSLEngineConfigurator(GrizzlyClientSocket.java:771)
at org.glassfish.tyrus.container.grizzly.client.GrizzlyClientSocket._connect(GrizzlyClientSocket.java:374)
at org.glassfish.tyrus.container.grizzly.client.GrizzlyClientSocket.access$000(GrizzlyClientSocket.java:103)
at org.glassfish.tyrus.container.grizzly.client.GrizzlyClientSocket$1.call(GrizzlyClientSocket.java:235)
at org.glassfish.tyrus.container.grizzly.client.GrizzlyClientSocket$1.call(GrizzlyClientSocket.java:231)
at org.glassfish.tyrus.container.grizzly.client.GrizzlyClientSocket.connect(GrizzlyClientSocket.java:249)
... 11 more
何か足りないのですか?実行可能な Java ベースの SSL クライアント Web ソケット エンドポイントを共有していただけますか
ありがとう