Skip to main content

How to configure proxy on Glassfish v3

Posted by survivant on March 17, 2009 at 7:18 PM PDT

If you are behind a proxy maybe you will want to set the proxy in Glassfish.

There are few different ways to do that.

#1 - You could use the admin web page.

You can add the proxy settings : host and port with the admin. Into the admin web page, go to the Application Server at your left. After that on your right select : JVM Settings / JVM Options.

Just add theses settings :

http.proxyHost=myproxy.mydomain
http.proxyPort=myproxy.port

Glassfish_proxy.png


Click here to enlarge

#2 - You could use the command line

Go into your Glassfish installation /bin and enter theses commands :

asadmin create-jvm-options "-Dhttp.proxyHost=myproxy.mydomain"
asadmin create-jvm-options "-Dhttp.proxyPort=myproxy.port"

#3 - The last option is to edit manually domain.xml

You add the settings in the "<java-config>" element.


<java-config ...>
<jvm-options>-Dhttp.proxyHost=myproxy.mydomain</jvm-options>
<jvm-options>-Dhttp.proxyPort=myproxy.port</jvm-options>
...

Related Topics >>

Comments

Hi , I am trying to deploy

Hi , I am trying to deploy alfresco on glassfish application server. I was getting, FATAL [webapp.webxml.WebXmlParser] Unable to parse web.xml java.net.ConnectException: Connection timed out at java.net.PlainSocketImpl.socketConnect(Native Method) at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:333) Then I tried giving proxysettings , as mentioned in ur blog ... I added these JVm settings: -Dhttp.proxyHost=proxy.com -Dhttp.proxyPort=52 -Dhttp.proxyUser=abc123 -Dhttp.proxyPassword=abc12345 Now i am getting this javax.faces.FacesException: java.io.IOException: Server returned HTTP response code: 407 for URL: http://java.sun.com/dtd/web-app_2_3.dtd at org.apache.myfaces.shared_impl.webapp.webxml.WebXmlParser.parse(WebXmlParser.java:115) at org.apache.myfaces.shared_impl.webapp.webxml.WebXml.init(WebXml.java:207) at org.apache.myfaces.shared_impl.webapp.webxml.WebXml.getWebXml(WebXml.java:194) at org.apache.myfaces.application.jsp.JspViewHandlerImpl.getServletMapping(JspViewHandlerImpl.java:304) at org.apache.myfaces.application.jsp.JspViewHandlerImpl.renderView(JspViewHandlerImpl.java:179) at org.apache.myfaces.lifecycle.RenderResponseExecutor.execute(RenderResponseExecutor.java:41) at org.apache.myfaces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:132) at javax.faces.webapp.FacesServlet.service(FacesServlet.java:140) at org.apache.catalina.core.ApplicationFilterChain.servletService(ApplicationFilterChain.java:427) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:333) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:214) at org.alfresco.web.app.servlet.AuthenticationFilter.doFilter(AuthenticationFilter.java:110) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) Can u pls help me in this Issue....

hello I think the proxy

hello

I think the proxy setting changed since I wrote this blog.  I'll suggest you to send a email to the mailing list :

users@glassfish.dev.java.net

 

They will be able to answer it right away.  I'm really sorry that I can't help you more than that on that subject.  Could be possible that you find a bug too, that why on the mailing list you will get correct feedback.

 

thanks

The question is how to setup proxy user and password

Hi, The 407 error stands for proxy authentification required. We have 3 different way to setup a proxy (cool), but no way for the proxys' login and password. This is the issue ! The real question is how can I setup those two proxy parameters.

authPassthroughEnabled

Maybe a authPassthroughEnabled parameter has to be enabled as written on http://www.manorrock.com/portal/documents/glassfish/proxy-ssl.html if you solver the problem please let us know.. :)

You got me here. I never tried with a ssl proxy. I think we will need to read the GF docs for that, but I would guess that it will be the same as using command line -D param in your java applications. Confirm that with the GF team please.

Hi Sebastian- thanks for the simple tip. I am looking to deploy GF behind an ssl proxy (from what I'm reading, it's best to leave the ssl mechanics to the proxy and let GF receive plaintext http requests), and I stumbled across this page. Would you please clarify for the uninformed whether the proxy described above is something like "how to get out across the wire" or whether glassfish itself can serve up a proxy, not requiring apache or nginx or other?