Java Question

How do I set up Glassfish to go via a proxy server?

I have been having issues with running a Glassfish v2.1.1 instance on my local machine from within the office, where we have a proxy server for outgoing connections. My initial workaround has been to work from home.

I am calling a SOAP service on a HTTPS server outside of the company. As Glassfish is not going via the company's proxy server, I get the following error when trying to initialise my SOAP clients: Failed to access the WSDL at:


Caused by:

I have proxy environment variables set on my command line, as well as my system proxy settings all working correctly so that I can get to the WSDL with the browser. How should I configure Glassfish?

Answer Source

I had a lot of trouble finding an answer to this, as the topic isn't covered in a lot of detail on the web. One link told me how to configure the HTTP proxy, but mentioned nothing about HTTPS, so it took me a while to figure it out.

Open up the admin console on your Glassfish server and go to: Application Server -> JVM Settings -> JVM Options. Click "Add JVM Option" 4 times and enter the following 4 options


Where proxyhostname and the port number are correct for your setup. Then you need to restart the server.

Note that I couldn't find any options for setting up the proxy from a PAC file, nor for proxies which require auth. In this case, you may need to install a local auth proxy handler like Authoxy for Mac OS X, which turns your localhost into a non-auth proxy and masks the authentication request from the central auth proxy.

Also, this link was good for various proxy options to the JVM:

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download