Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

[B]Urgent : HttpsURLConnection[/B]  RSS feed

 
kumar Manchi
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,
I am using weblogic.net.http.HttpsURLConnection provided by the weblogic 5.1 for connecting to a third party server("https://hostname/--/---") through my servlet.I have a proxy server in between my webserver and the third party server.I am using the following code to make the servlet go through the proxy.
Properties props = System.getProperties();
props.put("https.proxyHost","proxy IP address");
props.put("https.proxyPort","proxy port");

String parameters = parameters to be sent to the 3rd party
String stringUrl = "Https://3rd part hostname/--/--" +
parameters
URL url = new URL(stringUrl);
weblogic.net.http.HttpsURLConnection connection = new weblogic.net.http.HttpsURLConnection(url);
connection.setDoOutput(true);
System.out.println("Connection : " + connection.getResponseCode());
Before getting the response code, i am getting the following exception.
Server Certificate SubjectDN CommonName received does not match Server hostname and then
java.net.ConnectException: Tried all: 1 addresses, but could not connect over HTTPS to server: third party server name, port 443.
Where is the problem?How to fix the problem?
Pllllllease HHHHHHHHelp MMMMMMMMMMeeeeeeeeeeee
Thanks in advance
Ashok
 
Zabe Agha
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Kumar -- This _might_ not be a problem on your end at all. I'm not familiar with the WebLogic HttpsURLConnection, but your error sounds very similiar to the one you might get if you were using javax.net.ssl.HttpsURLConnection.
See the following post:
http://forum.java.sun.com/thread.jsp?thread=316849&forum=331&message=1275655
*IF* this is the same problem, and there are two solutions to this:
1. You can have the admin of the secure server you're trying to connect to make sure that the name of their server matches the name of the server in the certificate. It might be possible that no certificate exists on the server at all, in which case you might get the same error.
2. You can try to disable host verification on the HttpsURLConnection object after you get the connection, keeping Java from trying to verify that the server you're connecting to indeed has a valid certificate:

Does this help?
[ March 06, 2003: Message edited by: Aurangzeb Agha ]
 
kumar Manchi
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for ur help Aurangzeb,
I changed the property weblogic.security.SSL.ignoreHostnameVerification = true in weblogic.properties and that worked.
The weird thing is after this property change, the connection worked and i could send some transactions to the 3rd party and everything went fine, and all of a sudden i am getting certificate exception now.Neither our certificate and the 3rd party certificate were changed and both certificates are valid, i checked weblogic.properties and we r not using the demo certificate even by mistake.
The exception is as follows.
java.io.IOException: Certificate not valid:
fingerprint = 115632b0c42739458d5cf441895f1c72, not before = Wed Nov 09 17:54:17 CST 1994, not after = Fri Dec 31 17:54:17 CST 1999,
holder = C=US O=RSA Data Security, Inc. OU=Secure Server Certification Authority , issuer = C=US O=RSA Data Security, Inc.
OU=Secure Server Certification Authority , key = modulus length=126 exponent length=3
at java.lang.Throwable.fillInStackTrace(Native Method)
at java.lang.Throwable.fillInStackTrace(Compiled Code)
at java.lang.Throwable.<init>(Compiled Code)
at java.lang.Exception.<init>(Compiled Code)
at java.io.IOException.<init>(Compiled Code)
at weblogic.security.SSL.SSLCertificate.verify(Compiled Code)
at weblogic.security.SSL.SSLCertificate.input(Compiled Code)
at weblogic.security.SSL.Handshake.input(Compiled Code)
at weblogic.security.SSL.SSLSocket.getHandshake(Compiled Code)
at weblogic.security.SSL.SSLSocket.clientInit(Compiled Code)
at weblogic.security.SSL.SSLSocket.initialize(Compiled Code)
at weblogic.security.SSL.SSLSocket.<init>(Compiled Code)
at weblogic.net.http.HttpsClient.openServer(Compiled Code)
at weblogic.net.http.HttpsClient.<init>(HttpsClient.java:68)
at weblogic.net.http.HttpClient.New(HttpClient.java:151)
at weblogic.net.http.HttpsURLConnection.connect(HttpsURLConnection.java:80)
at weblogic.net.http.HttpURLConnection.getInputStream(Compiled Code)
at java.net.HttpURLConnection.getResponseCode(Compiled Code)
at TradingDynamics.Frontend.web.servlets.AuthorizeServlet.doPost(Compiled Code)
at TradingDynamics.Frontend.web.servlets.AuthorizeServlet.doGet(AuthorizeServlet.java:224)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
at javax.servlet.http.HttpServlet.service(Compiled Code)
at weblogic.servlet.internal.ServletStubImpl.invokeServlet(Compiled Code)
at weblogic.servlet.internal.ServletContextImpl.invokeServlet(Compiled Code)
at weblogic.servlet.internal.ServletContextImpl.invokeServlet(Compiled Code)
at weblogic.servlet.internal.ServletContextManager.invokeServlet(Compiled Code)
at weblogic.socket.MuxableSocketHTTP.invokeServlet(Compiled Code)
at weblogic.socket.MuxableSocketHTTP.execute(Compiled Code)
at weblogic.kernel.ExecuteThread.run(Compiled Code)
after that i am getting the java.net.ConnectException that couldn't connect to third party server.
I did disable the hostname verification(as you suggested in your message) but that is never getting called.
Any help would be greatly appreciated.
Thanks
Kumar
[ March 06, 2003: Message edited by: kumar Manchi ]
[ March 06, 2003: Message edited by: kumar Manchi ]
 
Zabe Agha
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Kumar --
Do you mean that everything was working fine and then stopped working? If so, something definately changed. :-)
I'm not a weblogic guru, you might want to see if you can check the fingerprint of the your certificate and the server certificate.
I don't know if this is relevant, but see if you can use the getFingerprint():
http://edocs.bea.com/wls/docs61/javadocs/weblogic/security/X509.html
It could also help if you post a bit of your code, and point out where your problem is happening.
Also, a quick search on Google Groups brought up this:
http://groups.google.com/groups?hl=en&lr=&ie=UTF-8&oe=utf-8&threadm=3AF043C0.E3AFE34F%40adcore.com&rnum=1&prev=/groups%3Fq%3Djava.io.IOException:%2BCertificate%2Bnot%2Bvalid:%2Bfingerprint%26hl%3Den%26lr%3D%26ie%3DUTF-8%26oe%3Dutf-8%26selm%3D3AF043C0.E3AFE34F%2540adcore.com%26rnum%3D1
Which seems to be the exact same problem you're having.
Keep us updated.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!