Sunday, June 20, 2010

GlassFish Admin Console initPage Error in Ubuntu 10.04

Hello,

I spent a lot of time trying to get the GlassFish Admin Console working in Ubuntu 10.04... It was really hard to find good resources for a Linux beginner, let alone resources at all. So I figured I'd share my knowledge with the world. Hope this helps.

The specific problem here is when you are trying to bring up the Glass Fish Administration Console you get an error 500. Specifically, an 'initPage' error. See error below.

HTTP Status 500 -


type Exception report

message

descriptionThe server encountered an internal error () that prevented it from fulfilling this request.

exception

javax.servlet.ServletException: java.lang.reflect.InvocationTargetException while attempting to process a 'initPage' event for '/login.jsf'.

root cause

java.lang.RuntimeException: java.lang.reflect.InvocationTargetException while attempting to process a 'initPage' event for '/login.jsf'.

root cause

java.lang.reflect.InvocationTargetException

root cause

java.lang.UnsupportedOperationException: Cannot create XMLStreamReader or XMLEventReader from a javax.xml.transform.stream.StreamSource

note The full stack traces of the exception and its root causes are available in the GlassFish v3 logs.


GlassFish v3






















I managed to fix this error and get the Admin Console up and running.

Follow the instructions below to update your JDK and point GlassFish to the proper version of the JDK. Restart the domain service and reload the admin console url. Hopefully this will help you along your way.


----------------------------------------------------------------
JDK
----------------------------------------------------------------

Turns out my problem was specific to the OpenJDK Build 18 (1.6.0_18) of the Java JDK. I ended up getting the admin console working with Sun's JDK, Build 20 (1.6.0_20).

To get the latest Sun build of the JDK...
  1. Make sure you repositories are up to date. Perform this command in a terminal window...
    sudo apt-get update
  2. To download and install the JRE (Java Runtime Environment)
    sudo apt-get install sun-java6-jre sun-java6-plugin
  3. To download and install the JDK (Java Development Kit)
    sudo apt-get install sun-java6-jdk sun-java6-plugin
  4. Once installed. Run this command to switch the active version of Java to Sun's version
    sudo update-java-alternatives -s java-6-sun
  5. You can check the version of Java, which is installed using...
    java -version
  6. You should get something similar to...
    java version "1.6.0_20"
    Java(TM) SE Runtime Environment (build 1.6.0_20-b02)
    Java HotSpot(TM) Client VM (build 16.3-b01, mixed mode, sharing)
Great! Now the Java JDK and JRE should be installed and you should be on Build 20.

----------------------------------------------------------------
GlassFish
----------------------------------------------------------------

The next hurdle that I had to jump over was updating a configuration file for GlassFish.

This was the "asenv.config" file which was still pointed to the old JDK version.

Replace this...
AS_JAVA=/usr/lib/jvm/java-6-openjdk

With...
AS_JAVA=/usr/lib/jvm/java-6-sun-1.6.0.20














Next you'll want to restart the GlassFish domain service...

##########
/glassfishv3/glassfish/bin$ bash asadmin

asadmin> start-domain
Waiting for DAS to start ......
Started domain: domain1
Domain location: /home/rbolton/glassfishv3/glassfish/domains/domain1
Log file: /home/rbolton/glassfishv3/glassfish/domains/domain1/logs/server.log
Admin port for the domain: 4848
Command start-domain executed successfully.
##########

After the service has started, open a web browser and go to the URL of the Admin Console.

http://localhost:4848/

----------------------------------------------------------------

Success!!! Can now load the Admin Console. :) Hopefully this will work for you as well. Please e-mail me or comment on this blog if you have any problems and I will try to help.
















Additional Resources: