Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

HttpsURLConnection Connects Time out on Geronimo

 
Rob Silver
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a servlet that makes a secure connection to a remote system to execute a REST message (XML over HTTP). There is no WSDL portion unfortunately ... the remote party made their own design decisions outside of my control.

I am housing my servlet on a Geronimo 1.1 server. For some reason I cannot make the connection to the remote service when it is housed on Geronimo 1.1. When I attempt to make the connection in a stand alone stub application, or deploy the servlet under Tomcat 5.5, the system works properly. It is only Geronimo 1.1 that things fail to function. I am wondering if someone can help shed some light as it has held me up for far too long.

Some code:

The method I use to setup security settings. I have PKIS verificaiton path issues so I use the following code...




Note that H_V refers to the following object.
(Implemented because cert hostname does not match IP used. This is an issue with the remote system rather than my cert so I just need to work with it best I can).





These are 2 helper classes I use for the SSL Factory





Now for the meat and potatoes....
This method is what I call to send a string message (XML format) to the remote system. When I run it on Geronimo the "OutputStreamWriter osw = new OutputStreamWriter(urlc.getOutputStream());" line times out trying to connect and an exception is thrown. Again.. this is ONLY under Geronimo.




Any and all input is appreciated.. I have reviewed forumns and tried various work arounds but nothing seems to work under Geronimo.

Thanks,
Rob
 
Rob Silver
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
So I found a solution to the problem...

I use a Proxy object in the url open connection method which resolves the issue.

The change was from:




to





Originally I was setting the java system proxy property, which seems to work on Tomcat but for whatever reason it doesn't on Geronimo. I have checked that the involved classes are of the same type (java.net.URL and sun.net.www.protocol.https.HttpsURLConnectionImpl) so either its one of the classes used by my objects of these classes, or a system setting I guess that is changed in Geronimo as opposed to Tomcat.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic