3 Replies Latest reply on Feb 7, 2005 5:47 PM by firepoet

    Trouble using cmp2.x jdbc2 pm

    firepoet Newbie

      Greetings all:

      We've been trying to convert our application to use the container configuration "cmp2.x jdbc2 pm" and are hitting some problems. For example, just trying to get an object by primary key throws the below exception. Any help would be greatly appreciated...

      java.lang.NullPointerException
       at org.jboss.ejb.plugins.cmp.jdbc2.schema.Schema$1.initialValue(Schema.java:42)
       at org.jboss.tm.TransactionLocal.get(TransactionLocal.java:145)
       at org.jboss.tm.TransactionLocal.get(TransactionLocal.java:128)
       at org.jboss.ejb.plugins.cmp.jdbc2.schema.Schema.getView(Schema.java:98)
       at org.jboss.ejb.plugins.cmp.jdbc2.schema.EntityTable.getView(EntityTable.java:782)
       at org.jboss.ejb.plugins.cmp.jdbc2.schema.EntityTable.hasRow(EntityTable.java:437)
       at org.jboss.ejb.plugins.cmp.jdbc2.FindByPrimaryKeyCommand.fetchOne(FindByPrimaryKeyCommand.java:91)
       at org.jboss.ejb.plugins.cmp.jdbc2.JDBCStoreManager2.findEntity(JDBCStoreManager2.java:331)
       at org.jboss.ejb.plugins.CMPPersistenceManager.findEntity(CMPPersistenceManager.java:300)
       at org.jboss.resource.connectionmanager.CachedConnectionInterceptor.findEntity(CachedConnectionInterceptor.java:298)
       at org.jboss.ejb.EntityContainer.findSingleObject(EntityContainer.java:1086)
       at org.jboss.ejb.EntityContainer.findLocal(EntityContainer.java:663)
       at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
       at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
       at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
       at java.lang.reflect.Method.invoke(Method.java:585)
       at org.jboss.invocation.Invocation.performCall(Invocation.java:345)
       at org.jboss.ejb.EntityContainer$ContainerInterceptor.invokeHome(EntityContainer.java:1113)
       at org.jboss.ejb.plugins.AbstractInterceptor.invokeHome(AbstractInterceptor.java:90)
       at org.jboss.ejb.plugins.EntitySynchronizationInterceptor.invokeHome(EntitySynchronizationInterceptor.java:192)
       at org.jboss.resource.connectionmanager.CachedConnectionInterceptor.invokeHome(CachedConnectionInterceptor.java:212)
       at org.jboss.ejb.plugins.AbstractInterceptor.invokeHome(AbstractInterceptor.java:90)
       at org.jboss.ejb.plugins.EntityInstanceInterceptor.invokeHome(EntityInstanceInterceptor.java:117)
       at org.jboss.ejb.plugins.EntityCreationInterceptor.invokeHome(EntityCreationInterceptor.java:28)
       at org.jboss.ejb.plugins.AbstractTxInterceptor.invokeNext(AbstractTxInterceptor.java:109)
       at org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxInterceptorCMT.java:339)
       at org.jboss.ejb.plugins.TxInterceptorCMT.invokeHome(TxInterceptorCMT.java:126)
       at org.jboss.ejb.plugins.SecurityInterceptor.invokeHome(SecurityInterceptor.java:101)
       at org.jboss.ejb.plugins.LogInterceptor.invokeHome(LogInterceptor.java:121)
       at org.jboss.ejb.plugins.ProxyFactoryFinderInterceptor.invokeHome(ProxyFactoryFinderInterceptor.java:93)
       at org.jboss.ejb.EntityContainer.internalInvokeHome(EntityContainer.java:508)
       at org.jboss.ejb.Container.invoke(Container.java:891)
       at org.jboss.ejb.plugins.local.BaseLocalProxyFactory.invokeHome(BaseLocalProxyFactory.java:342)
       at org.jboss.ejb.plugins.local.LocalHomeProxy.invoke(LocalHomeProxy.java:118)
       at $Proxy169.findByPrimaryKey(Unknown Source)


        • 1. More Info: Trouble using cmp2.x jdbc2 pm
          firepoet Newbie

          Btw, We're running JBoss 4.0.1 and had to replace all the container-configurations with the cmp2.x jdbc2 pm configuration to avoid conflicts with the jdbc.JDBCStoreManager.

          • 2. Re: Trouble using cmp2.x jdbc2 pm
            Alexey Loubyansky Master

            Try with transactions. I know it's just a findByPrimaryKey. You could open an issue in jira for this.

            • 3. Re: Trouble using cmp2.x jdbc2 pm
              firepoet Newbie

              Thanks Alexey,

              After setting all EJBs to require transactions, everything seems to be working. During testing, however, I noticed an interesting (and potentially destructive) side effect. We have the following setup:

              1. A one-to-many CMR between type A and type B
              2. A class which can remove items of type B directly

              Whenever we remove items of type B, and then try and list all items related to a particular item of type A, upon iterating through the resultant list one of the items does not exist:

              javax.ejb.NoSuchObjectLocalException: Row not found: 8238
               at org.jboss.ejb.plugins.AbstractTxInterceptor.invokeNext(AbstractTxInterceptor.java:182)
               at org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxInterceptorCMT.java:313)
               at org.jboss.ejb.plugins.TxInterceptorCMT.invoke(TxInterceptorCMT.java:146)
               at org.jboss.ejb.plugins.SecurityInterceptor.invoke(SecurityInterceptor.java:123)
               at org.jboss.ejb.plugins.LogInterceptor.invoke(LogInterceptor.java:192)
               at org.jboss.ejb.plugins.ProxyFactoryFinderInterceptor.invoke(ProxyFactoryFinderInterceptor.java:122)
               at org.jboss.ejb.EntityContainer.internalInvoke(EntityContainer.java:514)
               at org.jboss.ejb.Container.invoke(Container.java:870)
               at org.jboss.ejb.plugins.local.BaseLocalProxyFactory.invoke(BaseLocalProxyFactory.java:413)
               at org.jboss.ejb.plugins.local.EntityProxy.invoke(EntityProxy.java:44)
               at $Proxy300.getType(Unknown Source)


              I believe this is because we deleted the item on the destination-side of the CMR, but the source-side did not get updated.

              A reminder: we're now using the "cmp2.x jdbc2 pm" container configuration, and did not experience this problem when we were using the "Standard CMP 2.x EntityBean" configuration.

              Any thoughts on this?