1. 程式人生 > >Maven學習之18使用jetty:run時jre選擇問題

Maven學習之18使用jetty:run時jre選擇問題

1.在用jetty釋出webapp時,報錯:

Or(Or(Id=1502768748,Composite(AA.AuId=1502768748)),Or(Id=2122841972,Composite(AA.AuId=2122841972)))
Exception in thread "main" javax.net.ssl.SSLKeyException: RSA premaster secret error
	at sun.security.ssl.RSAClientKeyExchange.<init>(Unknown Source)
	at sun.security.ssl.ClientHandshaker.serverHelloDone(Unknown Source)
	at sun.security.ssl.ClientHandshaker.processMessage(Unknown Source)
	at sun.security.ssl.Handshaker.processLoop(Unknown Source)
	at sun.security.ssl.Handshaker.process_record(Unknown Source)
	at sun.security.ssl.SSLSocketImpl.readRecord(Unknown Source)
	at sun.security.ssl.SSLSocketImpl.performInitialHandshake(Unknown Source)
	at sun.security.ssl.SSLSocketImpl.startHandshake(Unknown Source)
	at sun.security.ssl.SSLSocketImpl.startHandshake(Unknown Source)
	at org.apache.http.conn.ssl.SSLConnectionSocketFactory.createLayeredSocket(SSLConnectionSocketFactory.java:394)
	at org.apache.http.conn.ssl.SSLConnectionSocketFactory.connectSocket(SSLConnectionSocketFactory.java:353)
	at org.apache.http.impl.conn.DefaultHttpClientConnectionOperator.connect(DefaultHttpClientConnectionOperator.java:141)
	at org.apache.http.impl.conn.PoolingHttpClientConnectionManager.connect(PoolingHttpClientConnectionManager.java:353)
	at org.apache.http.impl.execchain.MainClientExec.establishRoute(MainClientExec.java:380)
	at org.apache.http.impl.execchain.MainClientExec.execute(MainClientExec.java:236)
	at org.apache.http.impl.execchain.ProtocolExec.execute(ProtocolExec.java:184)
	at org.apache.http.impl.execchain.RetryExec.execute(RetryExec.java:88)
	at org.apache.http.impl.execchain.RedirectExec.execute(RedirectExec.java:110)
	at org.apache.http.impl.client.InternalHttpClient.doExecute(InternalHttpClient.java:184)
	at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:82)
	at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:107)
	at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:55)
	at org.ms.bop.server.SendRequest.getResponse(SendRequest.java:50)
	at org.ms.bop.server.CountPath.getPath(CountPath.java:769)
	at org.ms.bop.server.Test.main(Test.java:8)
Caused by: java.security.NoSuchAlgorithmException: SunTlsRsaPremasterSecret KeyGenerator not available
	at javax.crypto.KeyGenerator.<init>(KeyGenerator.java:158)
	at javax.crypto.KeyGenerator.getInstance(KeyGenerator.java:207)
	at sun.security.ssl.JsseJce.getKeyGenerator(Unknown Source)
	... 25 more
2.解決辦法:

由於jdk和jre分開的,所以需要選擇jre,而非jdk中的jre

3.結果:

test可以正常執行

hetty也可以正常訪問:

http://127.0.0.1:8787/kk/RestServer?id1=1502768748&id2=2122841972