Hello,

When I try to start up the Jonas server, I get:
    JOnAS: Cannot start Naming Manager
    java.lang.NullPointerException
        at org.objectweb.jonas.naming.NamingManager.
                        <init>(NamingManager.java:75)
        at org.objectweb.jonas.server.Server.main(Server.java:78)

The reason I get this is that my naming service is screwed up. But also,
around line 75 in the NamingManager class, there is the following code:
     try {
         ictx = new InitialContext();
         myEnv = ictx.getEnvironment();
     } catch (NamingException n) {
         Throwable t = n.getRootCause();
         if (t.getMessage().startsWith("Connection refused to host:")) {
          Trace.errln("NamingManager: rmi registry not started ?");
          throw n;
         } else if (t.getMessage().startsWith("error during remote
invocation")) {
          Trace.errln("NamingManager: jrmi registry not started ?");
          throw n;
         } else {
         Trace.errln("NamingManager: "+t.getMessage());
          throw n;
         }
     }

The bug is where you call the getRootCause() method of the NamingException
n. Sun's documentation says that getRootCause() "Returns the possibly null
exception that caused this naming exception. If null, it means no root cause
has been set for this naming exception."

In my case, there is no root cause and the expression "Throwable t =
n.getRootCause()" returns a null Throwable t. In the next line, you ask the
Throwable t to get its message. Since the Throwable t is null, you get a
NullPointerException.

This can be fixed by adding the lines:
    if( t == null )
        t = n;
after line 75:
    Throwable t = n.getRootCause();

Then, people like me would be able to actually get a meaningful message from
the NamingManager class and be able to move on to debug the naming service
problem.

--Timothy Rogers
----
To unsubscribe, send email to [EMAIL PROTECTED] and
include in the body of the message "unsubscribe jonas-users".
For general help, send email to [EMAIL PROTECTED] and
include in the body of the message "help".

Reply via email to