This week's giveaway is in the EJB and other Java EE Technologies forum. We're giving away four copies of EJB 3 in Action and have Debu Panda, Reza Rahman, Ryan Cuprak, and Michael Remijan on-line! See this thread for details.
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.
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.
Joined: Sep 06, 2006
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:
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.