1 Reply Latest reply on Mar 18, 2003 4:32 PM by Greg Ritter

    Finders throw NullPointerException

    Greg Ritter Newbie

      I'm developing an application using entity beans, and I'm trying to make use of xdoclet's support for JBoss. I've developed several beans that are working correctly when deployed in JBoss 3.0.6 on my Windows development environment; however, when I deploy them in our build server that is also running JBoss 3.0.6 on a Linux box, I get NullPointerExceptions when calling finder methods. Here are some examples:

      NPE in findByPrincipalId:

      10:15:57:464 [PoolThread-3] ERROR org.jboss.ejb.plugins.LogInterceptor UserServicesBean UserBean - TransactionRolledbackLocalException, causedBy:
      java.lang.NullPointerException
      at org.jboss.ejb.plugins.cmp.jdbc.JDBCStoreManager.createBeanClassInstance(JDBCStoreManager.java:513)
      at org.jboss.ejb.plugins.CMPPersistenceManager.createBeanClassInstance(CMPPersistenceManager.java:165)
      at org.jboss.ejb.EntityContainer.createBeanClassInstance(EntityContainer.java:294)
      at org.jboss.ejb.plugins.AbstractInstancePool.get(AbstractInstancePool.java:184)
      at org.jboss.ejb.plugins.EntityInstanceInterceptor.invokeHome(EntityInstanceInterceptor.java:78)
      at org.jboss.ejb.plugins.EntityLockInterceptor.invokeHome(EntityLockInterceptor.java:79)
      at org.jboss.ejb.plugins.EntityCreationInterceptor.invokeHome(EntityCreationInterceptor.java:44)
      at org.jboss.ejb.plugins.AbstractTxInterceptor.invokeNext(AbstractTxInterceptor.java:111)
      at org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxInterceptorCMT.java:228)
      at org.jboss.ejb.plugins.TxInterceptorCMT.invokeHome(TxInterceptorCMT.java:62)
      at org.jboss.ejb.plugins.SecurityInterceptor.invokeHome(SecurityInterceptor.java:105)
      at org.jboss.ejb.plugins.LogInterceptor.invokeHome(LogInterceptor.java:129)
      at org.jboss.ejb.EntityContainer.invokeHome(EntityContainer.java:487)
      at org.jboss.ejb.plugins.local.BaseLocalContainerInvoker.invokeHome(BaseLocalContainerInvoker.java:230)
      at org.jboss.ejb.plugins.local.LocalHomeProxy.invoke(LocalHomeProxy.java:110)
      at $Proxy310.findByPrincipalId(Unknown Source)
      at org.leaguemaker.ejb.session.UserServicesBean.registerUser(Unknown Source)
      at java.lang.reflect.Method.invoke(Native Method)
      at org.jboss.ejb.StatelessSessionContainer$ContainerInterceptor.invoke(StatelessSessionContainer.java:660)
      at org.jboss.resource.connectionmanager.CachedConnectionInterceptor.invoke(CachedConnectionInterceptor.java:186)
      at org.jboss.ejb.plugins.StatelessSessionInstanceInterceptor.invoke(StatelessSessionInstanceInterceptor.java:77)
      at org.jboss.ejb.plugins.AbstractTxInterceptor.invokeNext(AbstractTxInterceptor.java:107)
      at org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxInterceptorCMT.java:228)
      at org.jboss.ejb.plugins.TxInterceptorCMT.invoke(TxInterceptorCMT.java:92)
      at org.jboss.ejb.plugins.SecurityInterceptor.invoke(SecurityInterceptor.java:130)
      at org.jboss.ejb.plugins.LogInterceptor.invoke(LogInterceptor.java:204)
      at org.jboss.ejb.StatelessSessionContainer.invoke(StatelessSessionContainer.java:313)
      at org.jboss.ejb.plugins.local.BaseLocalContainerInvoker.invoke(BaseLocalContainerInvoker.java:301)
      at org.jboss.ejb.plugins.local.StatelessSessionProxy.invoke(StatelessSessionProxy.java:81)
      at $Proxy321.registerUser(Unknown Source)
      at org.leaguemaker.web.delegate.UserServicesDelegate.registerUser(Unknown Source)
      at org.leaguemaker.web.action.RegistrationAction.execute(Unknown Source)
      at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:480)
      at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:274)
      at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1420)
      at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:520)
      at servletunit.struts.CactusStrutsTestCase.actionPerform(CactusStrutsTestCase.java:471)
      at org.leaguemaker.web.action.RegistrationActionTest.testSuccessfulRegistration(Unknown Source)
      at java.lang.reflect.Method.invoke(Native Method)
      at org.apache.cactus.AbstractTestCase.runServerTest(AbstractTestCase.java:332)
      at org.apache.cactus.AbstractTestCase.runBareServerTest(AbstractTestCase.java:235)
      at org.apache.cactus.server.AbstractWebTestCaller.doTest(AbstractWebTestCaller.java:149)
      at org.apache.cactus.server.AbstractWebTestController.dispatch87_handleRequest(AbstractWebTestController.java;org/apache/cactus/util/log/LogAspect.aj(1k):125)
      at org.apache.cactus.server.AbstractWebTestController.around87_handleRequest(AbstractWebTestController.java;org/apache/cactus/util/log/LogAspect.aj(1k):1156)
      at org.apache.cactus.server.AbstractWebTestController.handleRequest(AbstractWebTestController.java;org/apache/cactus/util/log/LogAspect.aj(1k):101)
      at org.apache.cactus.server.ServletTestRedirector.dispatch113_doPost(ServletTestRedirector.java;org/apache/cactus/util/log/LogAspect.aj(1k):123)
      at org.apache.cactus.server.ServletTestRedirector.around113_doPost(ServletTestRedirector.java;org/apache/cactus/util/log/LogAspect.aj(1k):1156)
      at org.apache.cactus.server.ServletTestRedirector.doPost(ServletTestRedirector.java;org/apache/cactus/util/log/LogAspect.aj(1k):109)
      at org.apache.cactus.server.ServletTestRedirector.dispatch112_doGet(ServletTestRedirector.java;org/apache/cactus/util/log/LogAspect.aj(1k):96)
      at org.apache.cactus.server.ServletTestRedirector.around112_doGet(ServletTestRedirector.java;org/apache/cactus/util/log/LogAspect.aj(1k):1156)
      at org.apache.cactus.server.ServletTestRedirector.doGet(ServletTestRedirector.java;org/apache/cactus/util/log/LogAspect.aj(1k):92)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
      at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:360)
      at org.mortbay.jetty.servlet.WebApplicationHandler.dispatch(WebApplicationHandler.java:280)
      at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:553)
      at org.mortbay.http.HttpContext.handle(HttpContext.java:1717)
      at org.mortbay.jetty.servlet.WebApplicationContext.handle(WebApplicationContext.java:549)
      at org.mortbay.http.HttpContext.handle(HttpContext.java:1667)
      at org.mortbay.http.HttpServer.service(HttpServer.java:862)
      at org.jboss.jetty.Jetty.service(Jetty.java:497)
      at org.mortbay.http.HttpConnection.service(HttpConnection.java:759)
      at org.mortbay.http.HttpConnection.handleNext(HttpConnection.java:923)
      at org.mortbay.http.HttpConnection.handle(HttpConnection.java:776)
      at org.mortbay.http.SocketListener.handleConnection(SocketListener.java:202)
      at org.mortbay.util.ThreadedServer.handle(ThreadedServer.java:289)
      at org.mortbay.util.ThreadPool$PoolThread.run(ThreadPool.java:455)

      NPE in findAll:

      10:15:57:611 [PoolThread-3] ERROR org.jboss.ejb.plugins.LogInterceptor UserBean - RuntimeException:
      java.lang.NullPointerException
      at org.jboss.ejb.plugins.cmp.jdbc.JDBCStoreManager.createBeanClassInstance(JDBCStoreManager.java:513)
      at org.jboss.ejb.plugins.CMPPersistenceManager.createBeanClassInstance(CMPPersistenceManager.java:165)
      at org.jboss.ejb.EntityContainer.createBeanClassInstance(EntityContainer.java:294)
      at org.jboss.ejb.plugins.AbstractInstancePool.get(AbstractInstancePool.java:184)
      at org.jboss.ejb.plugins.EntityInstanceInterceptor.invokeHome(EntityInstanceInterceptor.java:78)
      at org.jboss.ejb.plugins.EntityLockInterceptor.invokeHome(EntityLockInterceptor.java:79)
      at org.jboss.ejb.plugins.EntityCreationInterceptor.invokeHome(EntityCreationInterceptor.java:44)
      at org.jboss.ejb.plugins.AbstractTxInterceptor.invokeNext(AbstractTxInterceptor.java:111)
      at org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxInterceptorCMT.java:228)
      at org.jboss.ejb.plugins.TxInterceptorCMT.invokeHome(TxInterceptorCMT.java:62)
      at org.jboss.ejb.plugins.SecurityInterceptor.invokeHome(SecurityInterceptor.java:105)
      at org.jboss.ejb.plugins.LogInterceptor.invokeHome(LogInterceptor.java:129)
      at org.jboss.ejb.EntityContainer.invokeHome(EntityContainer.java:487)
      at org.jboss.ejb.plugins.local.BaseLocalContainerInvoker.invokeHome(BaseLocalContainerInvoker.java:230)
      at org.jboss.ejb.plugins.local.LocalHomeProxy.invoke(LocalHomeProxy.java:110)
      at $Proxy310.findAll(Unknown Source)
      at org.leaguemaker.web.action.RegistrationActionTest.tearDown(Unknown Source)
      at org.apache.cactus.AbstractTestCase.runBareServerTest(AbstractTestCase.java:237)
      at org.apache.cactus.server.AbstractWebTestCaller.doTest(AbstractWebTestCaller.java:149)
      at org.apache.cactus.server.AbstractWebTestController.dispatch87_handleRequest(AbstractWebTestController.java;org/apache/cactus/util/log/LogAspect.aj(1k):125)
      at org.apache.cactus.server.AbstractWebTestController.around87_handleRequest(AbstractWebTestController.java;org/apache/cactus/util/log/LogAspect.aj(1k):1156)
      at org.apache.cactus.server.AbstractWebTestController.handleRequest(AbstractWebTestController.java;org/apache/cactus/util/log/LogAspect.aj(1k):101)
      at org.apache.cactus.server.ServletTestRedirector.dispatch113_doPost(ServletTestRedirector.java;org/apache/cactus/util/log/LogAspect.aj(1k):123)
      at org.apache.cactus.server.ServletTestRedirector.around113_doPost(ServletTestRedirector.java;org/apache/cactus/util/log/LogAspect.aj(1k):1156)
      at org.apache.cactus.server.ServletTestRedirector.doPost(ServletTestRedirector.java;org/apache/cactus/util/log/LogAspect.aj(1k):109)
      at org.apache.cactus.server.ServletTestRedirector.dispatch112_doGet(ServletTestRedirector.java;org/apache/cactus/util/log/LogAspect.aj(1k):96)
      at org.apache.cactus.server.ServletTestRedirector.around112_doGet(ServletTestRedirector.java;org/apache/cactus/util/log/LogAspect.aj(1k):1156)
      at org.apache.cactus.server.ServletTestRedirector.doGet(ServletTestRedirector.java;org/apache/cactus/util/log/LogAspect.aj(1k):92)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
      at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:360)
      at org.mortbay.jetty.servlet.WebApplicationHandler.dispatch(WebApplicationHandler.java:280)
      at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:553)
      at org.mortbay.http.HttpContext.handle(HttpContext.java:1717)
      at org.mortbay.jetty.servlet.WebApplicationContext.handle(WebApplicationContext.java:549)
      at org.mortbay.http.HttpContext.handle(HttpContext.java:1667)
      at org.mortbay.http.HttpServer.service(HttpServer.java:862)
      at org.jboss.jetty.Jetty.service(Jetty.java:497)
      at org.mortbay.http.HttpConnection.service(HttpConnection.java:759)
      at org.mortbay.http.HttpConnection.handleNext(HttpConnection.java:923)
      at org.mortbay.http.HttpConnection.handle(HttpConnection.java:776)
      at org.mortbay.http.SocketListener.handleConnection(SocketListener.java:202)
      at org.mortbay.util.ThreadedServer.handle(ThreadedServer.java:289)
      at org.mortbay.util.ThreadPool$PoolThread.run(ThreadPool.java:455)

      Here are the relevant xdoclet tags from UserBean.java; I haven't included the sources generated by xdoclet, but I would be happy to post those as well if it would be helpful.

      UserBean.java:

      ...

      /**
      * @ejb.bean
      * name="UserBean"
      * display-name="UserBean"
      * type="CMP"
      * view-type="both"
      * primkey-field="id"
      * @ejb.finder
      * signature="java.util.Collection findAll()"
      * @ejb.finder
      * signature="org.leaguemaker.ejb.entity.UserBeanRemote findByPrincipalId(java.lang.String principalId)"
      * query="SELECT OBJECT(user) FROM UserBean AS user WHERE user.principalId = ?1"
      * method-intf="Home"
      * @ejb.finder
      * signature="org.leaguemaker.ejb.entity.UserBeanLocal findByPrincipalId(java.lang.String principalId)"
      * query="SELECT OBJECT(user) FROM UserBean AS user WHERE user.principalId = ?1"
      * method-intf="Local"
      * @ejb.home
      * @ejb.interface
      * @ejb.persistence
      * table-name="UserBean"
      * @ejb.pk
      * class="java.lang.String"
      * generate="false"
      * @ejb.ejb-ref
      * ejb-name="UserBean"
      * view-type="local"
      */
      ...

      Thanks,

      -Greg-