Hi all,
I was hoping that someone would be able to help me. I've got a CMP bean, I create the bean and it's stored in the database correctly, but if I try to use the newly created instance I get the following stack trace...
09:49:40,390 ERROR [LogInterceptor] RuntimeException:
java.lang.NullPointerException
at org.jboss.ejb.plugins.lock.QueuedPessimisticEJBLock.removeRef(QueuedPessimisticEJBLock.java:412)
at org.jboss.ejb.BeanLockManager.removeLockRef(BeanLockManager.java:103)
at org.jboss.ejb.plugins.EntityLockInterceptor.invoke(EntityLockInterceptor.java:124)
at org.jboss.ejb.plugins.EntityCreationInterceptor.invoke(EntityCreationInterceptor.java:69)
at org.jboss.ejb.plugins.AbstractTxInterceptor.invokeNext(AbstractTxInterceptor.java:107)
at org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxInterceptorCMT.java:178)
at org.jboss.ejb.plugins.TxInterceptorCMT.invoke(TxInterceptorCMT.java:60)
at org.jboss.ejb.plugins.SecurityInterceptor.invoke(SecurityInterceptor.java:130)
at org.jboss.ejb.plugins.LogInterceptor.invoke(LogInterceptor.java:203)
at org.jboss.ejb.EntityContainer.invoke(EntityContainer.java:493)
at org.jboss.ejb.plugins.local.BaseLocalContainerInvoker.invoke(BaseLocalContainerInvoker.java:301)
at org.jboss.ejb.plugins.local.EntityProxy.invoke(EntityProxy.java:38)
at $Proxy52.getId(Unknown Source)
Here's the code that causes the problem...
LocalBeanHome beanHome = (LocalBeanHome) context.lookup(jndiName);
LocalBean newBean = beanHome.create(...);
System.out.println("new bean id="+newBean.getId());
I have also tried putting the whole thing in a UserTransaction transaction but then it throws a TransactionRolledbackLocalException and the stack trace is exactly like the one above. I thought that maybe the newBean was null, but (newBean == null) is false.
Does anyone have any ideas on this? I've been banging my head against this problem for the past week!
Many thanks in advance!
Tom
Just a guess, but you are using an old version
of jboss that does not have support for auto-generated
primary keys.
Or there is something wrong with your primary key.
Search the CMP forum where you will find info
on these issues.
Regards,
Adrian