NullPointerException - Servlet EJB home invocation
dhulley May 21, 2002 6:08 AMHi,
Summary: Receiving a NullPointerException via java.rmi.ServerException when attempting to invoke an ejb home's create method
Running: jboss-3.0.0RC1_tomcat-4.0.3
================
Exception:
java.lang.NullPointerException
at org.jboss.ejb.StatelessSessionContainer$ContainerInterceptor.invokeHome(StatelessSessionContainer.java:598)
at org.jboss.resource.connectionmanager.CachedConnectionInterceptor.invokeHome(CachedConnectionInterceptor.java:167)
at org.jboss.ejb.plugins.StatelessSessionInstanceInterceptor.invokeHome(StatelessSessionInstanceInterceptor.java:57)
at org.jboss.ejb.plugins.AbstractTxInterceptor.invokeNext(AbstractTxInterceptor.java:98)
at org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxInterceptorCMT.java:167)
at org.jboss.ejb.plugins.TxInterceptorCMT.invokeHome(TxInterceptorCMT.java:52)
at org.jboss.ejb.plugins.SecurityInterceptor.invokeHome(SecurityInterceptor.java:104)
at org.jboss.ejb.plugins.LogInterceptor.invokeHome(LogInterceptor.java:109)
at org.jboss.ejb.StatelessSessionContainer.invokeHome(StatelessSessionContainer.java:300)
at org.jboss.ejb.Container.invoke(Container.java:727)
at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:492)
at org.jboss.invocation.local.LocalInvoker.invoke(LocalInvoker.java:98)
at org.jboss.invocation.InvokerInterceptor.invoke(InvokerInterceptor.java:102)
at org.jboss.proxy.TransactionInterceptor.invoke(TransactionInterceptor.java:73)
at org.jboss.proxy.SecurityInterceptor.invoke(SecurityInterceptor.java:76)
at org.jboss.proxy.ejb.HomeInterceptor.invoke(HomeInterceptor.java:185)
at org.jboss.proxy.ClientContainer.invoke(ClientContainer.java:96)
at $Proxy351.create(Unknown Source)
at java.lang.reflect.Method.invoke(Native Method)
at uk.co.ls.util.EjbUtil.createBean(EjbUtil.java:141)
at uk.co.ls.web.ejb.EjbLinksBean.(EjbLinksBean.java:33)
at uk.co.ls.web.InitializerServlet.init(InitializerServlet.java:67)
at javax.servlet.GenericServlet.init(GenericServlet.java:258)
=====================
The EJB I am accessing is a stateless session bean and is present as:
+- ejb
| +- uk.co.ls.services.ejb.user.UserManager
Additionally, the EJB works when accessed both from other EJBs and from external test code.
======================
In web.xml I have:
<ejb-ref>
<ejb-ref-name>
ejb/uk.co.ls.services.ejb.user.UserManager
</ejb-ref-name>
<ejb-ref-type>Session</ejb-ref-type>
uk.co.ls.services.ejb.user.UserManager
uk.co.ls.services.ejb.user.UserManager
</ejb-ref>
================================
and in jboss-web.xml I have:
<ejb-ref>
<ejb-ref-name>
ejb/uk.co.ls.services.ejb.user.UserManager
</ejb-ref-name>
<jndi-name>
ejb/uk.co.ls.services.ejb.user.UserManager
</jndi-name>
</ejb-ref>
=======================
Clearly the JNDI lookup, home interface retrieval and dynamic invocation of the create method are working.
The offending line in StatelessSessionContainer is:
return m.invoke(...);
where m is defined by:
Method m = (Method)homeMapping.get(mi.getMethod());
Could it have something to do with the fact that I attempt to invoke the create method during servlet initialization?
That is all I can do with my current knowledge I am afraid. Any help would be greatly appreciated.
Thanks
Derek