geronimo-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jonathan Gallimore <jonathan.gallim...@gmail.com>
Subject Re: java:comp JNDI lookup seems to fail after server restart
Date Mon, 08 Oct 2007 15:20:25 GMT
I managed to make some progress with this - basically it only happens if 
my application's web modules context root is /, so I've given it a 
different context root for the time being. I'm also able to reproduce 
this with another very basic "Hello world" app. Presumably this is some 
sort of bug? Let me know if you think it is, I'll happily log a JIRA for it.

Regards

Jon

Jonathan Gallimore wrote:
> Hi All,
>
> I'm getting a bizarre problem, and I'm not sure how to go about 
> resolving it.
>
> Basically, I have a servlet which looks up a session bean and calls a 
> method on it. I'm performing the lookup using the java:comp name like so:
>
>             Object ref = context.lookup("java:comp/env/ejb/System");
>             SystemHome home = (SystemHome) 
> PortableRemoteObject.narrow(ref,
>                     SystemHome.class);
>             bean = home.create();
>
> When I deploy the app, and call the servlet from my browser this works 
> perfectly. If I restart the server however, and navigate to the 
> servlet again, the lookup fails with this exception:
>
> javax.servlet.ServletException: java.lang.NullPointerException
> 	com.wave2.web.SystemServlet.doGet(SystemServlet.java:92)
> 	javax.servlet.http.HttpServlet.service(HttpServlet.java:693)
> 	javax.servlet.http.HttpServlet.service(HttpServlet.java:806)
>   
>
> *root cause*
>
> java.lang.NullPointerException
> 	org.apache.xbean.naming.context.ContextFlyweight.lookup(ContextFlyweight.java:44)
> 	org.apache.xbean.naming.context.ContextFederation.getFederatedBinding(ContextFederation.java:71)
> 	org.apache.xbean.naming.context.AbstractFederatedContext.getBinding(AbstractFederatedContext.java:63)
> 	org.apache.xbean.naming.context.AbstractContext.lookup(AbstractContext.java:129)
> 	org.apache.xbean.naming.context.AbstractContext.lookup(AbstractContext.java:611)
> 	org.apache.xbean.naming.context.AbstractContext.lookup(AbstractContext.java:152)
> 	org.apache.xbean.naming.context.AbstractContext.lookup(AbstractContext.java:597)
> 	javax.naming.InitialContext.lookup(InitialContext.java:351)
> 	com.wave2.web.SystemServlet.doGet(SystemServlet.java:53)
> 	javax.servlet.http.HttpServlet.service(HttpServlet.java:693)
> 	javax.servlet.http.HttpServlet.service(HttpServlet.java:806)
>
>   
> I've attached a debugger, and RootContext.getComponentContext() indeed 
> returns null in JavaCompContextGBean.getContext().
>
> Like I say, I'm not sure what to look at next to try and resolve this 
> - any help would be much appreciated.
>
> Jon
>


Mime
View raw message