4 Replies Latest reply on Mar 17, 2004 8:28 AM by Alexey Loubyansky

    findByPrimaryKey throws NullPointerException under load

    Jeff Bannister Newbie

      Hi,

      I have an application that makes heavy use of JMS. One particular queue may have 30,000 messages an hour written to it. I have limited the number of MDBs processing messages on this queue to 10 and this appears to work OK.

      The work done by this MDB in onMessage() always involves a lookup of an EntityBean using findByPrimaryKey. However I find that 1 in 1000 of the messages consumed will throw a NullPointerException for the findByPrimaryKey, see the stack trace below.

      I am using a Firebird1.0.1 database running on Redhat linux v9. I have configured the firebird datasource as recommend by the firebird JDBC driver i.e. To deploy the firebirdsql.rar file, and also to deploy a firebird-ds.xml.

      Note:- This JCA-JDBC configuration is currently configured to support XA semantics. The application only needs XA support for 1 tiny part of the application and I am going to try changing to use local transactions instead and see if that makes any difference.

      What puzzles me if why problem only occurs under load.

      Has anyone every seen a similar issue? as I'm running out of ideas apart from loosing the entity beans.

      So to summize I have 10 MDBs all concurrently processing messages from a queue. Each of these MDBs will attempt to find the same entity bean and update a progress counter. However 1 in 1000 messages processed with throw a NPE as shown below.

      regards,

      Jeff.

      STACK TRACE BEGIN[###################
      javax.ejb.FinderException: Find failed: java.lang.NullPointerException
      at org.jboss.ejb.plugins.cmp.jdbc.JDBCAbstractQueryCommand.execute(JDBCAbstractQueryCommand.java:238)
      at org.jboss.ejb.plugins.cmp.jdbc.JDBCAbstractQueryCommand.execute(JDBCAbstractQueryCommand.java:111)
      at org.jboss.ejb.plugins.cmp.jdbc.JDBCFindByPrimaryKeyQuery.execute(JDBCFindByPrimaryKeyQuery.java:108)
      at org.jboss.ejb.plugins.cmp.jdbc.JDBCFindEntityCommand.execute(JDBCFindEntityCommand.java:49)
      at org.jboss.ejb.plugins.cmp.jdbc.JDBCStoreManager.findEntity(JDBCStoreManager.java:571)
      at org.jboss.ejb.plugins.CMPPersistenceManager.findEntity(CMPPersistenceManager.java:299)
      at org.jboss.resource.connectionmanager.CachedConnectionInterceptor.findEntity(CachedConnectionInterceptor.java:300)
      at org.jboss.ejb.EntityContainer.findLocal(EntityContainer.java:637)
      at sun.reflect.GeneratedMethodAccessor379.invoke(Unknown Source)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:324)
      at org.jboss.ejb.EntityContainer$ContainerInterceptor.invokeHome(EntityContainer.java:1043)
      at org.jboss.ejb.plugins.AbstractInterceptor.invokeHome(AbstractInterceptor.java:88)
      at org.jboss.ejb.plugins.AbstractInterceptor.invokeHome(AbstractInterceptor.java:88)
      at org.jboss.ejb.plugins.EntitySynchronizationInterceptor.invokeHome(EntitySynchronizationInterceptor.java:197)
      at org.jboss.resource.connectionmanager.CachedConnectionInterceptor.invokeHome(CachedConnectionInterceptor.java:214)
      at org.jboss.ejb.plugins.AbstractInterceptor.invokeHome(AbstractInterceptor.java:88)
      at org.jboss.ejb.plugins.EntityInstanceInterceptor.invokeHome(EntityInstanceInterceptor.java:89)
      at org.jboss.ejb.plugins.EntityLockInterceptor.invokeHome(EntityLockInterceptor.java:61)
      at org.jboss.ejb.plugins.EntityCreationInterceptor.invokeHome(EntityCreationInterceptor.java:28)
      at org.jboss.ejb.plugins.AbstractTxInterceptor.invokeNext(AbstractTxInterceptor.java:88)
      at org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxInterceptorCMT.java:267)
      at org.jboss.ejb.plugins.TxInterceptorCMT.invokeHome(TxInterceptorCMT.java:98)
      at org.jboss.ejb.plugins.SecurityInterceptor.invokeHome(SecurityInterceptor.java:92)
      at org.jboss.ejb.plugins.LogInterceptor.invokeHome(LogInterceptor.java:120)
      at org.jboss.ejb.plugins.ProxyFactoryFinderInterceptor.invokeHome(ProxyFactoryFinderInterceptor.java:93)
      at org.jboss.ejb.EntityContainer.internalInvokeHome(EntityContainer.java:483)
      at org.jboss.ejb.Container.invoke(Container.java:720)
      at org.jboss.ejb.plugins.local.BaseLocalProxyFactory.invokeHome(BaseLocalProxyFactory.java:293)
      at org.jboss.ejb.plugins.local.LocalHomeProxy.invoke(LocalHomeProxy.java:110)
      at $Proxy126.findByPrimaryKey(Unknown Source)