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