web-dev-qa-db-ja.com

Playフレームワーク2.2.1 HTTPが接続試行で失敗する

開発フレームワークのHTTPでPlay Framework 2.2.1アプリケーションを実行しようとしています。次のコマンドを使用します。

Development/Play/ssltest$ Java_OPTS=-Dhttps.port=9443 play run

大丈夫そうです

--- (Running the application from SBT, auto-reloading is enabled) ---

[info] play - Listening for HTTP on /0:0:0:0:0:0:0:0:9000
[info] play - Listening for HTTPS on port /0:0:0:0:0:0:0:0:9443

(Server started, use Ctrl+D to stop and go back to the console...)    

ただし、HTTPS経由でアプリに接続しようとすると、次のようになります。

"https://localhost:9443"

アプリがクラッシュして、次の例外のスタックに移動します。

[error] play - Error loading fake key store
Java.security.cert.CertificateException: Subject class type invalid.
at Sun.security.x509.X509CertInfo.setSubject(X509CertInfo.Java:888) ~[na:1.8.0-ea]
at Sun.security.x509.X509CertInfo.set(X509CertInfo.Java:415) ~[na:1.8.0-ea]
at play.core.server.netty.FakeKeyStore$.createSelfSignedCertificate(FakeKeyStore.scala:71) ~[play_2.10.jar:2.2.1]
at play.core.server.netty.FakeKeyStore$.keyManagerFactory(FakeKeyStore.scala:34) ~[play_2.10.jar:2.2.1]
at play.core.server.NettyServer$PlayPipelineFactory$$anonfun$sslContext$2.apply(NettyServer.scala:98) [play_2.10.jar:2.2.1]
at play.core.server.NettyServer$PlayPipelineFactory$$anonfun$sslContext$2.apply(NettyServer.scala:94) [play_2.10.jar:2.2.1]

[info] play - Application started (Dev)
[error] p.nettyException - Exception caught in Netty
Java.lang.IllegalArgumentException: invalid version format: ホᆱ?BYFᅤロ￵ ̄X￶￧ᆪヌ$￀+￀/゙ワ￀
at org.jboss.netty.handler.codec.http.HttpVersion.<init>(HttpVersion.Java:102) ~[netty.jar:na]
at org.jboss.netty.handler.codec.http.HttpVersion.valueOf(HttpVersion.Java:62) ~[netty.jar:na]
at org.jboss.netty.handler.codec.http.HttpRequestDecoder.createMessage(HttpRequestDecoder.Java:75) ~[netty.jar:na]
at org.jboss.netty.handler.codec.http.HttpMessageDecoder.decode(HttpMessageDecoder.Java:189) ~[netty.jar:na]
at org.jboss.netty.handler.codec.http.HttpMessageDecoder.decode(HttpMessageDecoder.Java:101) ~[netty.jar:na]
at org.jboss.netty.handler.codec.replay.ReplayingDecoder.callDecode(ReplayingDecoder.Java:500) ~[netty.jar:na]

[error] p.nettyException - Exception caught in Netty
Java.lang.IllegalArgumentException: empty text
at org.jboss.netty.handler.codec.http.HttpVersion.<init>(HttpVersion.Java:97) ~[netty.jar:na]
at org.jboss.netty.handler.codec.http.HttpVersion.valueOf(HttpVersion.Java:62) ~[netty.jar:na]
at org.jboss.netty.handler.codec.http.HttpRequestDecoder.createMessage(HttpRequestDecoder.Java:75) ~[netty.jar:na]
at org.jboss.netty.handler.codec.http.HttpMessageDecoder.decode(HttpMessageDecoder.Java:189) ~[netty.jar:na]
at org.jboss.netty.handler.codec.http.HttpMessageDecoder.decode(HttpMessageDecoder.Java:101) ~[netty.jar:na]
at org.jboss.netty.handler.codec.replay.ReplayingDecoder.callDecode(ReplayingDecoder.Java:500) ~[netty.jar:na]

 [error] p.nettyException - Exception caught in Netty
 Java.lang.IllegalArgumentException: invalid version format: ホᆱ?BYFᅤロ￵ ̄X￶￧ᆪヌ$￀+￀/゙ワ￀
at org.jboss.netty.handler.codec.http.HttpVersion.<init>(HttpVersion.Java:102) ~[netty.jar:na]
at org.jboss.netty.handler.codec.http.HttpVersion.valueOf(HttpVersion.Java:62) ~[netty.jar:na]
at org.jboss.netty.handler.codec.http.HttpRequestDecoder.createMessage(HttpRequestDecoder.Java:75) ~[netty.jar:na]
at org.jboss.netty.handler.codec.http.HttpMessageDecoder.decode(HttpMessageDecoder.Java:189) ~[netty.jar:na]
at org.jboss.netty.handler.codec.http.HttpMessageDecoder.decode(HttpMessageDecoder.Java:101) ~[netty.jar:na]
at org.jboss.netty.handler.codec.replay.ReplayingDecoder.callDecode(ReplayingDecoder.Java:500) ~[netty.jar:na]

 [error] p.nettyException - Exception caught in Netty
 Java.lang.IllegalArgumentException: empty text
at org.jboss.netty.handler.codec.http.HttpVersion.<init>(HttpVersion.Java:97) ~[netty.jar:na]
at org.jboss.netty.handler.codec.http.HttpVersion.valueOf(HttpVersion.Java:62) ~[netty.jar:na]
at org.jboss.netty.handler.codec.http.HttpRequestDecoder.createMessage(HttpRequestDecoder.Java:75) ~[netty.jar:na]
at org.jboss.netty.handler.codec.http.HttpMessageDecoder.decode(HttpMessageDecoder.Java:189) ~[netty.jar:na]
at org.jboss.netty.handler.codec.http.HttpMessageDecoder.decode(HttpMessageDecoder.Java:101) ~[netty.jar:na]
at org.jboss.netty.handler.codec.replay.ReplayingDecoder.callDecode(ReplayingDecoder.Java:500) ~[netty.jar:na]

 [error] p.nettyException - Exception caught in Netty
 Java.lang.IllegalArgumentException: empty text
at org.jboss.netty.handler.codec.http.HttpVersion.<init>(HttpVersion.Java:97) ~[netty.jar:na]
at org.jboss.netty.handler.codec.http.HttpVersion.valueOf(HttpVersion.Java:62) ~[netty.jar:na]
at org.jboss.netty.handler.codec.http.HttpRequestDecoder.createMessage(HttpRequestDecoder.Java:75) ~[netty.jar:na]
at org.jboss.netty.handler.codec.http.HttpMessageDecoder.decode(HttpMessageDecoder.Java:189) ~[netty.jar:na]
at org.jboss.netty.handler.codec.http.HttpMessageDecoder.decode(HttpMessageDecoder.Java:101) ~[netty.jar:na]
at org.jboss.netty.handler.codec.replay.ReplayingDecoder.callDecode(ReplayingDecoder.Java:500) ~[netty.jar:na]

[error] p.nettyException - Exception caught in Netty
Java.lang.IllegalArgumentException: empty text
at org.jboss.netty.handler.codec.http.HttpVersion.<init>(HttpVersion.Java:97) ~[netty.jar:na]
at org.jboss.netty.handler.codec.http.HttpVersion.valueOf(HttpVersion.Java:62) ~[netty.jar:na]
at org.jboss.netty.handler.codec.http.HttpRequestDecoder.createMessage(HttpRequestDecoder.Java:75) ~[netty.jar:na]
at org.jboss.netty.handler.codec.http.HttpMessageDecoder.decode(HttpMessageDecoder.Java:189) ~[netty.jar:na]
at org.jboss.netty.handler.codec.http.HttpMessageDecoder.decode(HttpMessageDecoder.Java:101) ~[netty.jar:na]
at org.jboss.netty.handler.codec.replay.ReplayingDecoder.callDecode(ReplayingDecoder.Java:500) ~[netty.jar:na]

[error] p.nettyException - Exception caught in Netty
Java.lang.IllegalArgumentException: invalid version format: ￀
at org.jboss.netty.handler.codec.http.HttpVersion.<init>(HttpVersion.Java:102) ~[netty.jar:na]
at org.jboss.netty.handler.codec.http.HttpVersion.valueOf(HttpVersion.Java:62) ~[netty.jar:na]
at org.jboss.netty.handler.codec.http.HttpRequestDecoder.createMessage(HttpRequestDecoder.Java:75) ~[netty.jar:na]
at org.jboss.netty.handler.codec.http.HttpMessageDecoder.decode(HttpMessageDecoder.Java:189) ~[netty.jar:na]
at org.jboss.netty.handler.codec.http.HttpMessageDecoder.decode(HttpMessageDecoder.Java:101) ~[netty.jar:na]
at org.jboss.netty.handler.codec.replay.ReplayingDecoder.callDecode(ReplayingDecoder.Java:500) ~[netty.jar:na]

[error] p.nettyException - Exception caught in Netty
Java.lang.IllegalArgumentException: empty text
at org.jboss.netty.handler.codec.http.HttpVersion.<init>(HttpVersion.Java:97) ~[netty.jar:na]
at org.jboss.netty.handler.codec.http.HttpVersion.valueOf(HttpVersion.Java:62) ~[netty.jar:na]
at org.jboss.netty.handler.codec.http.HttpRequestDecoder.createMessage(HttpRequestDecoder.Java:75) ~[netty.jar:na]
at org.jboss.netty.handler.codec.http.HttpMessageDecoder.decode(HttpMessageDecoder.Java:189) ~[netty.jar:na]
at org.jboss.netty.handler.codec.http.HttpMessageDecoder.decode(HttpMessageDecoder.Java:101) ~[netty.jar:na]
at org.jboss.netty.handler.codec.replay.ReplayingDecoder.callDecode(ReplayingDecoder.Java:500) ~[netty.jar:na]

[error] p.nettyException - Exception caught in Netty
Java.lang.IllegalArgumentException: invalid version format: ￀
at org.jboss.netty.handler.codec.http.HttpVersion.<init>(HttpVersion.Java:102) ~[netty.jar:na]
at org.jboss.netty.handler.codec.http.HttpVersion.valueOf(HttpVersion.Java:62) ~[netty.jar:na]
at org.jboss.netty.handler.codec.http.HttpRequestDecoder.createMessage(HttpRequestDecoder.Java:75) ~[netty.jar:na]
at org.jboss.netty.handler.codec.http.HttpMessageDecoder.decode(HttpMessageDecoder.Java:189) ~[netty.jar:na]
at org.jboss.netty.handler.codec.http.HttpMessageDecoder.decode(HttpMessageDecoder.Java:101) ~[netty.jar:na]
at org.jboss.netty.handler.codec.replay.ReplayingDecoder.callDecode(ReplayingDecoder.Java:500) ~[netty.jar:na]

[error] p.nettyException - Exception caught in Netty
Java.lang.IllegalArgumentException: empty text
at org.jboss.netty.handler.codec.http.HttpVersion.<init>(HttpVersion.Java:97) ~[netty.jar:na]
at org.jboss.netty.handler.codec.http.HttpVersion.valueOf(HttpVersion.Java:62) ~[netty.jar:na]
at org.jboss.netty.handler.codec.http.HttpRequestDecoder.createMessage(HttpRequestDecoder.Java:75) ~[netty.jar:na]
at org.jboss.netty.handler.codec.http.HttpMessageDecoder.decode(HttpMessageDecoder.Java:189) ~[netty.jar:na]
at org.jboss.netty.handler.codec.http.HttpMessageDecoder.decode(HttpMessageDecoder.Java:101) ~[netty.jar:na]
at org.jboss.netty.handler.codec.replay.ReplayingDecoder.callDecode(ReplayingDecoder.Java:500) ~[netty.jar:na]

[error] p.nettyException - Exception caught in Netty
Java.lang.IllegalArgumentException: empty text
at org.jboss.netty.handler.codec.http.HttpVersion.<init>(HttpVersion.Java:97) ~[netty.jar:na]
at org.jboss.netty.handler.codec.http.HttpVersion.valueOf(HttpVersion.Java:62) ~[netty.jar:na]
at org.jboss.netty.handler.codec.http.HttpRequestDecoder.createMessage(HttpRequestDecoder.Java:75) ~[netty.jar:na]
at org.jboss.netty.handler.codec.http.HttpMessageDecoder.decode(HttpMessageDecoder.Java:189) ~[netty.jar:na]
at org.jboss.netty.handler.codec.http.HttpMessageDecoder.decode(HttpMessageDecoder.Java:101) ~[netty.jar:na]
at org.jboss.netty.handler.codec.replay.ReplayingDecoder.callDecode(ReplayingDecoder.Java:500) ~[netty.jar:na]

[error] p.nettyException - Exception caught in Netty
Java.lang.IllegalArgumentException: empty text
at org.jboss.netty.handler.codec.http.HttpVersion.<init>(HttpVersion.Java:97) ~[netty.jar:na]
at org.jboss.netty.handler.codec.http.HttpVersion.valueOf(HttpVersion.Java:62) ~[netty.jar:na]
at org.jboss.netty.handler.codec.http.HttpRequestDecoder.createMessage(HttpRequestDecoder.Java:75) ~[netty.jar:na]
at org.jboss.netty.handler.codec.http.HttpMessageDecoder.decode(HttpMessageDecoder.Java:189) ~[netty.jar:na]
at org.jboss.netty.handler.codec.http.HttpMessageDecoder.decode(HttpMessageDecoder.Java:101) ~[netty.jar:na]
at org.jboss.netty.handler.codec.replay.ReplayingDecoder.callDecode(ReplayingDecoder.Java:500) ~[netty.jar:na]    
22
Ubaidah

私のマシンでの再生は、自己署名証明書の生成に失敗するようです。自分の自己署名証明書を使用した場合、問題なく動作します。

keytool -genkey -alias MyKey -keyalg RSA -keysize 2048 -keystore keystore.jks
play -Dhttps.port=9443 -Dhttps.keyStore=keystore.jks -Dhttps.keyStorePassword=password run

私はこの[投稿]から答えを得ました( Play 2.1 SSL Configuration

8
Ubaidah

この問題については、こちらで説明しています: https://groups.google.com/forum/#!msg/play-framework/ip6cT70VjZ4/I5cHNv0rOWkJ

問題は、httpsリクエストをlocalhostに送信することです。解決策は次のとおりです。

  1. 簡単な方法:localhostのURLを保持しますが、httpsをhttpに置き換えます
  2. 難しい方法:/ etc/hostsをいじって正しいドメイン名マッピングをセットアップし、ローカルホストで実行するようにsslを構成する
24
Alex

試しましたか https://localhost:9443(9443の前のスラッシュの代わりにコロンに注意してください)

3
Brian Porter

指定した証明書/キーストアへのパスが無効である可能性があります。

0
Klapsa2503

私も同じ問題を抱えていました。

sslを使用している場合は、conf/generated.keystoreを削除して、サーバーを再起動します(-Dhttps.port=9443オプションを使用)。新しい証明書が自動的に作成され、問題が解決されます

0
transang