AdSense Mobile Ad

Monday, November 8, 2010

Glassfish 3.0.x Admin Console Not Starting: Is It Behind a Proxy?

Today I was performing yet another Glassfish v. 3.0.1 installation, one of the easiest pieces of software to set up there, on a Solaris 10 system:
  • Install the software (unzipping a zip or installing a native package).
  • Optionally create a new domain.
  • Start the domain.

To my surprise, when I tried to connect to the Admin Console, the browser got stuck just after inserting my user credentials. I tried to restart the domain over and over again but I had no luck.

The domain logs (that you can find in $YOUR_DOMAIN/logs/server.log) were telling nothing interesting: the domain was starting up correctly and the admin console application was logging no errors. The last line of the logs always was:

[#|[snip]|admin console: initSessionAttributes()|#]

After a while, it appeared a line such as this:

[#|[snip]|Cannot refresh Catalog: Connection timed out: Connect|#]

This was the clue! Glassfish is able to check for updates automatically from an IPS repository: do you remember that fancy update icon in the upper left corner of the Admin Console that shows up to suggest you the available updates? This server is behind a proxy: maybe I was experiencing a glitch related to this.

A quick search indeed revealed that other users were experiencing the same problem when Glassfish sat behind a proxy server. The workarounds I tested to work are the following:
  • Have Glassfish use your proxy.
  • Use Glassfish updatetool to disable automatic updates (which is something I would always suggest for a production environment).
  • Remove the console-updatecenter-plugin.jar.

The third suggestion comes from a thread published in the java.net Forums. Unfortunately the link is broken now and I could only read it using Google's cache.

Have Glassfish Use Your Proxy

To setup Glassfish to use a proxy you can use the following Java system properties:
  • http.proxyHost
  • http.proxyPort
  • http.proxyUser
  • http.proxyPassword

You can either use the asadmin program or the admin console to do that. Using asadmin is as simple as:

$ asadmin
asadmin> create-jvm-options "-Dhttp.proxyXXX=value"
asadmin> create-jvm-options ...

If you prefer using the Admin Console, just navigate to Enterprise Server/System Properties and use the web interface to add the values.

The values you set will be reflected in the domain.xml domain configuration file:

[...snip...]
<java-config ...>
[...snip...]
  <jvm-options>-Dhttp.XXX=value</jvm-options>
</java-config>
[...snip...]

Use Glassfish updatetool To Disable Automatic Updates

You can use the updatetool program to update Glassfish and configure the autoupdate feature:

$ $GLASSFISH_INST/bin/updatetool

The first time you launch updatetool, it will ask you to install this feature. Since you're behind a proxy, you need to setup some environment variables. If you're using an HTTP proxy, you can just set the http_proxy variable:

$ export http_proxy=http://user:password@proxy.host:port

When updatetool finished installing the required packages, you can start it again and the updatetool windows will show up. In the Preferences window you can tune the update behaviour or disable it at all.

Remove the console-updatecenter-plugin.jar

The last thing you can do is removing the guilty plugin. The Glassfish plugins are deployed in the $GLASSFISH_INST/glassfish/modules directory. You can just move the console-updatecenter-plugin.jar to console-updatecenter-plugin.jar.old and Glassfish won't use it.


"No Network Access" for the Admin Console


As pointed out in a comment, Glassfish can be configured to have "no network access" by setting the

com.sun.enterprise.tools.admingui.NO_NETWORK

property to true. As usual, this can be done adding the

-Dcom.sun.enterprise.tools.admingui.NO_NETWORK=true

to the JVM parameters list or using the asadmin tool:

$ asadmin create-jvm-options \
  -Dcom.sun.enterprise.tools.admingui.NO_NETWORK=true

Conclusion

This is a bothering bug with an easy workaround. Looking forward to Glassfish v. 3.1.

2 comments:

Unknown said...

Hi,

This problem was bothering me a lot and finally I found your post.
Thanks a lot, and also hope they will fix it in the next upgrade.

Dan said...

My company updated the firewall this weekend and my first login to the Admin console afterwards hung. Another page indicated needed to add this to the JVM options:

asadmin create-jvm-options “-Dcom.sun.enterprise.tools.admingui.NO_NETWORK=true”

I'm a belt and suspenders guy so I did the JVM option and removed the update center jar.