與原廠連線時會先利用以下方式偵測connection是否暢通


URL url = new URL("https://xxx");
HttpURLConnection http_conn = (HttpURLConnection) url.openConnection();
http_conn.setConnectTimeout(timeout.intValue());
http_conn.connect();


but project裡的lib 放入 wlfullclient.jar後
default SSL license file似乎被改變



執行以上程式時
stderr.log 會一直出現以下exception


java.lang.RuntimeException: Exception occurred while reading the license file.
at weblogic.security.utils.SSLSetup.getLicenseLevel(SSLSetup.java:143)
at weblogic.security.utils.SSLSetup.getSSLDelegateInstance(SSLSetup.java:196)
at weblogic.security.utils.SSLContextWrapper.(SSLContextWrapper.java:27)
at weblogic.security.utils.SSLContextWrapper.getInstance(SSLContextWrapper.java:22)
at weblogic.security.utils.SSLSetup.getSSLContext(SSLSetup.java:380)
at weblogic.security.SSL.SSLClientInfo.getSSLSocketFactory(SSLClientInfo.java:56)
at weblogic.security.SSL.SSLSocketFactory.setSSLClientInfo(SSLSocketFactory.java:218)
at weblogic.security.SSL.SSLSocketFactory.(SSLSocketFactory.java:36)
at weblogic.security.SSL.SSLSocketFactory.getInstance(SSLSocketFactory.java:68)
at weblogic.net.http.HttpsClient.New(HttpsClient.java:578)
at weblogic.net.http.HttpsURLConnection.connect(HttpsURLConnection.java:227)
at com.pchome.sts.util.SystemUtil.isConnectionSuccess(SystemUtil.java:264)
at com.pchome.sts.app.web.LoginServlet.overDoPost(LoginServlet.java:86)
at com.pchome.framework.action.AbstractServlet.doPost(AbstractServlet.java:45)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:154)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:92)
at com.caucho.server.dispatch.ServletFilterChain.doFilter(ServletFilterChain.java:106)
at com.pchome.framework.action.HibernateFilter.doFilter(HibernateFilter.java:40)
at com.caucho.server.dispatch.FilterFilterChain.doFilter(FilterFilterChain.java:70)
at com.caucho.server.cache.CacheFilterChain.doFilter(CacheFilterChain.java:188)
at com.caucho.server.webapp.WebAppFilterChain.doFilter(WebAppFilterChain.java:173)
at com.caucho.server.dispatch.ServletInvocation.service(ServletInvocation.java:229)
at com.caucho.server.hmux.HmuxRequest.handleRequest(HmuxRequest.java:420)
at com.caucho.server.port.TcpConnection.run(TcpConnection.java:511)
at com.caucho.util.ThreadPool.runTasks(ThreadPool.java:516)
at com.caucho.util.ThreadPool.run(ThreadPool.java:442)
at java.lang.Thread.run(Thread.java:619)


這時要改用自己包的
HttpsPost post = new HttpsPost("https://xxx");
post.setReadTimeOut(timeout.intValue());
String result = post.submitData();


裡面強制使用Sun的cert
這樣就不會有exception了




創作者介紹
創作者 babyincar 的頭像
babyincar

 [孩子在車上‧Babyincar's Blog]

babyincar 發表在 痞客邦 留言(0) 人氣()