[JBoss-dev] [ jboss-Bugs-472072 ] INSERTING AN ALREADY EXISTING BEAN, ID =
Bugs item #472072, was opened at 2001-10-17 09:06 You can respond by visiting: http://sourceforge.net/tracker/?func=detailatid=376685aid=472072group_id=22866 Category: JBossServer Group: v3.0 Rabbit Hole Status: Closed Resolution: Fixed Priority: 5 Submitted By: Nobody/Anonymous (nobody) Assigned to: Andreas Schaefer (schaefera) Summary: INSERTING AN ALREADY EXISTING BEAN, ID = Initial Comment: Using CMP 2.0 when calling a entity remote home's create I get the following: [Default] java.rmi.ServerException: INSERTING AN ALREADY EXISTING BEAN, ID = 111; nested exception is: java.lang.IllegalStateException: INSERTING AN ALREADY EXISTING BEAN, ID = 111 [Default] java.lang.IllegalStateException: INSERTING AN ALREADY EXISTING BEAN, ID = 111 [Default] at org.jboss.ejb.plugins.AbstractInstanceCache.insert(AbstractInstanceCache.java:249) [Default] at org.jboss.ejb.plugins.EntityInstanceInterceptor.invokeHome(EntityInstanceInterceptor.java:166) [Default] at org.jboss.ejb.plugins.EntityLockInterceptor.invokeHome(EntityLockInterceptor.java:104) [Default] at org.jboss.ejb.plugins.AbstractTxInterceptor.invokeNext(AbstractTxInterceptor.java:100) [Default] at org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxInterceptorCMT.java:156) [Default] at org.jboss.ejb.plugins.TxInterceptorCMT.invokeHome(TxInterceptorCMT.java:56) [Default] at org.jboss.ejb.plugins.SecurityInterceptor.invokeHome(SecurityInterceptor.java:106) [Default] at org.jboss.ejb.plugins.LogInterceptor.invokeHome(LogInterceptor.java:109) [Default] at org.jboss.ejb.EntityContainer.invokeHome(EntityContainer.java:441) [Default] at org.jboss.ejb.plugins.jrmp.server.JRMPContainerInvoker.invokeHome(JRMPContainerInvoker.java:421) [Default] at org.jboss.ejb.plugins.jrmp.interfaces.HomeProxy.invokeHome(HomeProxy.java:237) [Default] at org.jboss.ejb.plugins.jrmp.interfaces.HomeProxy.invoke(HomeProxy.java:182) [Default] at $Proxy16.create(Unknown Source) [Default] at _0002feditCustomer_0002ejspeditCustomer_jsp_0._jspService(_0002feditCustomer_0002ejspeditCustomer_jsp_0.java:141) [Default] at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:119) [Default] at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) [Default] at org.apache.jasper.servlet.JspServlet$JspServletWrapper.service(JspServlet.java:176) [Default] at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:307) [Default] at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:380) [Default] at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) [Default] at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:488) [Default] at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:387) [Default] at org.mortbay.http.HandlerContext.handle(HandlerContext.java:1040) [Default] at org.mortbay.http.HandlerContext.handle(HandlerContext.java:995) [Default] at org.mortbay.http.HttpServer.service(HttpServer.java:683) [Default] at org.mortbay.http.HttpConnection.service(HttpConnection.java:732) [Default] at org.mortbay.http.HttpConnection.handleNext(HttpConnection.java:889) [Default] at org.mortbay.http.HttpConnection.handle(HttpConnection.java:746) [Default] at org.mortbay.http.SocketListener.handleConnection(SocketListener.java:146) [Default] at org.mortbay.util.ThreadedServer.handle(ThreadedServer.java:287) [Default] at org.mortbay.util.ThreadPool$PoolThreadRunnable.run(ThreadPool.java:609) [Default] at java.lang.Thread.run(Thread.java:484) The key used is manualy specified and is 100% unique (not used before) in any bean. This happens for a bean that is on the Many side of a one-to-many relation with a foreign key. The ejbCreate() method of that bean just sets it's primary key and some attributes and ejbPostCreate() adds itself to the -to-many side of the related bean's Collection... This does not happen for a related bean which uses similar ejbCreate() and empty ejbPostCreate() methods. I tried to use Commit option A and B. The result is the same. -- Comment By: Dain Sundstrom (dsundstrom) Date: 2002-04-15 13:25 Message: Logged In: YES user_id=251431 This is fixed in RC1. -- Comment By: Peter Levart (plevart) Date: 2001-12-18 04:17 Message: Logged In: YES user_id=346981 This bug was discussed further on the jboss-developement list some time ago and I made a test case to recreate it. Basicaly it can be reproduced by creatin an ejbPostCreate method in the following style (in the AddressBean): private String create( String id, String street, String city, String zip,
Re: [JBoss-dev] [ jboss-Bugs-472072 ] INSERTING AN ALREADY EXISTING BEAN, ID =
On Tuesday 18 December 2001 11:17, [EMAIL PROTECTED] wrote: public void ejbPostCreate ( String cid, String id, String street, String city, String zip, String state) throws CreateException { //Log.trace(AddressBean.ejbPostCreate...); postCreate(cid); } private void postCreate (String cid) { //Log.trace(AddressBean.postCreate...); try { Context ic = new InitialContext(); LocalCustomerHome home = (LocalCustomerHome) ic.lookup(java:comp/env/ejb/CustomerRef); LocalCustomer customer = home.findByPrimaryKey(cid); customer.addAddress((LocalAddress)context.getEJBLocalObject()); } catch (Exception ex) { context.setRollbackOnly(); ex.printStackTrace(); } } ... the Customer - Address is a 1-n relation. If instead of customer.addAddress(address) the case is rewriten as address.setCustomer(customer) then this exception is not thrown... Ok, the above line should be writen: this.setCustomer(customer), not address.setCustomer(customer) (no new invocation)... If I remember correctly the problem lies in the fact that while ejbPostCreate() method is executing, the EntityEnterpriseContext of the bean is not yet put into the cache, since this is done in EntityInstanceInterceptor after the return from the getNext().invokeHome(mi). If ejbPostCreate() calls other beans through their local (or remote?) interfaces that in turn invoke our bean (is adding a local interface to the CMR field considered an invocation on the bean being added? Some kind of special invocations are needed to update both sides of relationship I suppose), a second EntityEnterpriseContext is created and inserted into the cache and this clashes with inserting the first EntityEnterpriseContext later in the EntityInstanceInterceptor.invokeHome(). So how is this actualy possible if the first bean is non-reentrant? So adding a local interface to a CMR field is not considered to be an invocation on the bean being added, or is not checked for re-entrancy constraints at least. The correct way would be for EntityEnterpriseContext to be put into the cache between the calls to ejbCreate() and ejbPostCreate() methods, but this could not be done in EntityInstanceInterceptor then. So here's another crazy idea... What about some kind of generic callback Interface that could be registered in an ordered List within the MethodInvocation as it is passed down the invocation chain of interceptors. This way an interceptor could register itself (or it's inner class implementing callback interface). The callbacks would then be invoked in the LIFO order of registration to simulate the order of normal invocation returning but this would be done between ejb and ejbPost calls where such twins exist (currently only ejbCreate/ejbPostCreate, but you never know what SUN will add in EJB 2.1 and 3.0)... This is not elegant, I know. Peter ___ Jboss-development mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/jboss-development
RE: [JBoss-dev] [ jboss-Bugs-472072 ] INSERTING AN ALREADY EXISTING BEAN, ID =
On Tuesday 18 December 2001 11:17, [EMAIL PROTECTED] wrote: public void ejbPostCreate ( String cid, String id, String street, String city, String zip, String state) throws CreateException { //Log.trace(AddressBean.ejbPostCreate...); postCreate(cid); } private void postCreate (String cid) { //Log.trace(AddressBean.postCreate...); try { Context ic = new InitialContext(); LocalCustomerHome home = (LocalCustomerHome) ic.lookup(java:comp/env/ejb/CustomerRef); LocalCustomer customer = home.findByPrimaryKey(cid); customer.addAddress((LocalAddress)context.getEJBLocalObject()); } catch (Exception ex) { context.setRollbackOnly(); ex.printStackTrace(); } } ... the Customer - Address is a 1-n relation. If instead of customer.addAddress(address) the case is rewriten as address.setCustomer(customer) then this exception is not thrown... Ok, the above line should be writen: this.setCustomer(customer), not address.setCustomer(customer) (no new invocation)... If I remember correctly the problem lies in the fact that while ejbPostCreate() method is executing, the EntityEnterpriseContext of the bean is not yet put into the cache, since this is done in EntityInstanceInterceptor after the return from the getNext().invokeHome(mi). I looked this up. The problem is that the createHome invocation calls createEntity on PersistenceManager which handles both ejbCreate and ejbPostCreate. If ejbPostCreate() calls other beans through their local (or remote?) interfaces that in turn invoke our bean (is adding a local interface to the CMR field considered an invocation on the bean being added? Some kind of special invocations are needed to update both sides of relationship I suppose), a second EntityEnterpriseContext is created and inserted into the cache and this clashes with inserting the first EntityEnterpriseContext later in the EntityInstanceInterceptor.invokeHome(). Yep, you got it. So how is this actualy possible if the first bean is non-reentrant? So adding a local interface to a CMR field is not considered to be an invocation on the bean being added, or is not checked for re-entrancy constraints at least. Adding or being added to a CMR collection is not considered an entrant call. The correct way would be for EntityEnterpriseContext to be put into the cache between the calls to ejbCreate() and ejbPostCreate() methods, but this could not be done in EntityInstanceInterceptor then. I disagree. I think the way to fix this is to break the createHome invocation into to invocations. One to handle the ejbCreate stage and one to handle the ejbPostCreate stage. I think this would be much easier to understand as this the way most calls work. Who ever fixes this could also add support for EJB 2.0 createFactoryStyle methods (create methods now must only start with create). So here's another crazy idea... What about some kind of generic callback Interface that could be registered in an ordered List within the MethodInvocation as it is passed down the invocation chain of interceptors. This way an interceptor could register itself (or it's inner class implementing callback interface). The callbacks would then be invoked in the LIFO order of registration to simulate the order of normal invocation returning but this would be done between ejb and ejbPost calls where such twins exist (currently only ejbCreate/ejbPostCreate, but you never know what SUN will add in EJB 2.1 and 3.0)... This is not elegant, I know. Peter I think breaking this into two distinct calls will be much easier to understand. -dain ___ Jboss-development mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/jboss-development
RE: [JBoss-dev] [ jboss-Bugs-472072 ] INSERTING AN ALREADY EXISTING BEAN, ID =
Guys, We need to make sure that whether or not a cache is used is hidden within EntityInstanceInterceptor. This is the only thing I care about here. Also, you need to make sure that the EntityMultiInstance interceptors still work too if you're going to change these types of interceptors. I can't help out with this until after Christmas. But would be willing to do the work. Bill -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]On Behalf Of Dain Sundstrom Sent: Tuesday, December 18, 2001 11:58 AM To: 'Peter Levart'; Andreas Schaefer; JBoss-Dev Subject: RE: [JBoss-dev] [ jboss-Bugs-472072 ] INSERTING AN ALREADY EXISTING BEAN, ID = On Tuesday 18 December 2001 11:17, [EMAIL PROTECTED] wrote: public void ejbPostCreate ( String cid, String id, String street, String city, String zip, String state) throws CreateException { //Log.trace(AddressBean.ejbPostCreate...); postCreate(cid); } private void postCreate (String cid) { //Log.trace(AddressBean.postCreate...); try { Context ic = new InitialContext(); LocalCustomerHome home = (LocalCustomerHome) ic.lookup(java:comp/env/ejb/CustomerRef); LocalCustomer customer = home.findByPrimaryKey(cid); customer.addAddress((LocalAddress)context.getEJBLocalObject()); } catch (Exception ex) { context.setRollbackOnly(); ex.printStackTrace(); } } ... the Customer - Address is a 1-n relation. If instead of customer.addAddress(address) the case is rewriten as address.setCustomer(customer) then this exception is not thrown... Ok, the above line should be writen: this.setCustomer(customer), not address.setCustomer(customer) (no new invocation)... If I remember correctly the problem lies in the fact that while ejbPostCreate() method is executing, the EntityEnterpriseContext of the bean is not yet put into the cache, since this is done in EntityInstanceInterceptor after the return from the getNext().invokeHome(mi). I looked this up. The problem is that the createHome invocation calls createEntity on PersistenceManager which handles both ejbCreate and ejbPostCreate. If ejbPostCreate() calls other beans through their local (or remote?) interfaces that in turn invoke our bean (is adding a local interface to the CMR field considered an invocation on the bean being added? Some kind of special invocations are needed to update both sides of relationship I suppose), a second EntityEnterpriseContext is created and inserted into the cache and this clashes with inserting the first EntityEnterpriseContext later in the EntityInstanceInterceptor.invokeHome(). Yep, you got it. So how is this actualy possible if the first bean is non-reentrant? So adding a local interface to a CMR field is not considered to be an invocation on the bean being added, or is not checked for re-entrancy constraints at least. Adding or being added to a CMR collection is not considered an entrant call. The correct way would be for EntityEnterpriseContext to be put into the cache between the calls to ejbCreate() and ejbPostCreate() methods, but this could not be done in EntityInstanceInterceptor then. I disagree. I think the way to fix this is to break the createHome invocation into to invocations. One to handle the ejbCreate stage and one to handle the ejbPostCreate stage. I think this would be much easier to understand as this the way most calls work. Who ever fixes this could also add support for EJB 2.0 createFactoryStyle methods (create methods now must only start with create). So here's another crazy idea... What about some kind of generic callback Interface that could be registered in an ordered List within the MethodInvocation as it is passed down the invocation chain of interceptors. This way an interceptor could register itself (or it's inner class implementing callback interface). The callbacks would then be invoked in the LIFO order of registration to simulate the order of normal invocation returning but this would be done between ejb and ejbPost calls where such twins exist (currently only ejbCreate/ejbPostCreate, but you never know what SUN will add in EJB 2.1 and 3.0)... This is not elegant, I know. Peter I think breaking this into two distinct calls will be much easier to understand. -dain ___ Jboss-development mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/jboss-development ___ Jboss-development mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo
RE: [JBoss-dev] [ jboss-Bugs-472072 ] INSERTING AN ALREADY EXISTING BEAN, ID =
I totally agree. That is why is think ejbCreate and ejbPostCreate should be separate invocations. Basically, ejbPostCreate would act just a standard method invocation that is automatically called after create. -dain -Original Message- From: Bill Burke [mailto:[EMAIL PROTECTED]] Sent: Tuesday, December 18, 2001 11:38 AM To: Dain Sundstrom; 'Peter Levart'; Andreas Schaefer; JBoss-Dev Subject: RE: [JBoss-dev] [ jboss-Bugs-472072 ] INSERTING AN ALREADY EXISTING BEAN, ID = Guys, We need to make sure that whether or not a cache is used is hidden within EntityInstanceInterceptor. This is the only thing I care about here. Also, you need to make sure that the EntityMultiInstance interceptors still work too if you're going to change these types of interceptors. I can't help out with this until after Christmas. But would be willing to do the work. Bill -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]On Behalf Of Dain Sundstrom Sent: Tuesday, December 18, 2001 11:58 AM To: 'Peter Levart'; Andreas Schaefer; JBoss-Dev Subject: RE: [JBoss-dev] [ jboss-Bugs-472072 ] INSERTING AN ALREADY EXISTING BEAN, ID = On Tuesday 18 December 2001 11:17, [EMAIL PROTECTED] wrote: public void ejbPostCreate ( String cid, String id, String street, String city, String zip, String state) throws CreateException { //Log.trace(AddressBean.ejbPostCreate...); postCreate(cid); } private void postCreate (String cid) { //Log.trace(AddressBean.postCreate...); try { Context ic = new InitialContext(); LocalCustomerHome home = (LocalCustomerHome) ic.lookup(java:comp/env/ejb/CustomerRef); LocalCustomer customer = home.findByPrimaryKey(cid); customer.addAddress((LocalAddress)context.getEJBLocalObject()); } catch (Exception ex) { context.setRollbackOnly(); ex.printStackTrace(); } } ... the Customer - Address is a 1-n relation. If instead of customer.addAddress(address) the case is rewriten as address.setCustomer(customer) then this exception is not thrown... Ok, the above line should be writen: this.setCustomer(customer), not address.setCustomer(customer) (no new invocation)... If I remember correctly the problem lies in the fact that while ejbPostCreate() method is executing, the EntityEnterpriseContext of the bean is not yet put into the cache, since this is done in EntityInstanceInterceptor after the return from the getNext().invokeHome(mi). I looked this up. The problem is that the createHome invocation calls createEntity on PersistenceManager which handles both ejbCreate and ejbPostCreate. If ejbPostCreate() calls other beans through their local (or remote?) interfaces that in turn invoke our bean (is adding a local interface to the CMR field considered an invocation on the bean being added? Some kind of special invocations are needed to update both sides of relationship I suppose), a second EntityEnterpriseContext is created and inserted into the cache and this clashes with inserting the first EntityEnterpriseContext later in the EntityInstanceInterceptor.invokeHome(). Yep, you got it. So how is this actualy possible if the first bean is non-reentrant? So adding a local interface to a CMR field is not considered to be an invocation on the bean being added, or is not checked for re-entrancy constraints at least. Adding or being added to a CMR collection is not considered an entrant call. The correct way would be for EntityEnterpriseContext to be put into the cache between the calls to ejbCreate() and ejbPostCreate() methods, but this could not be done in EntityInstanceInterceptor then. I disagree. I think the way to fix this is to break the createHome invocation into to invocations. One to handle the ejbCreate stage and one to handle the ejbPostCreate stage. I think this would be much easier to understand as this the way most calls work. Who ever fixes this could also add support for EJB 2.0 createFactoryStyle methods (create methods now must only start with create). So here's another crazy idea... What about some kind of generic callback Interface that could be registered in an ordered List within the MethodInvocation as it is passed down the invocation chain of interceptors. This way an interceptor could register itself (or it's inner class implementing callback interface). The callbacks would then be invoked in the LIFO order of registration to simulate the order of normal invocation returning
[JBoss-dev] [ jboss-Bugs-472072 ] INSERTING AN ALREADY EXISTING BEAN, ID =
Bugs item #472072, was opened at 2001-10-17 07:06 You can respond by visiting: http://sourceforge.net/tracker/?func=detailatid=376685aid=472072group_id=22866 Category: JBossServer Group: v3.0 Rabbit Hole Status: Open Resolution: Accepted Priority: 5 Submitted By: Nobody/Anonymous (nobody) Assigned to: Andreas Schaefer (schaefera) Summary: INSERTING AN ALREADY EXISTING BEAN, ID = Initial Comment: Using CMP 2.0 when calling a entity remote home's create I get the following: [Default] java.rmi.ServerException: INSERTING AN ALREADY EXISTING BEAN, ID = 111; nested exception is: java.lang.IllegalStateException: INSERTING AN ALREADY EXISTING BEAN, ID = 111 [Default] java.lang.IllegalStateException: INSERTING AN ALREADY EXISTING BEAN, ID = 111 [Default] at org.jboss.ejb.plugins.AbstractInstanceCache.insert(AbstractInstanceCache.java:249) [Default] at org.jboss.ejb.plugins.EntityInstanceInterceptor.invokeHome(EntityInstanceInterceptor.java:166) [Default] at org.jboss.ejb.plugins.EntityLockInterceptor.invokeHome(EntityLockInterceptor.java:104) [Default] at org.jboss.ejb.plugins.AbstractTxInterceptor.invokeNext(AbstractTxInterceptor.java:100) [Default] at org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxInterceptorCMT.java:156) [Default] at org.jboss.ejb.plugins.TxInterceptorCMT.invokeHome(TxInterceptorCMT.java:56) [Default] at org.jboss.ejb.plugins.SecurityInterceptor.invokeHome(SecurityInterceptor.java:106) [Default] at org.jboss.ejb.plugins.LogInterceptor.invokeHome(LogInterceptor.java:109) [Default] at org.jboss.ejb.EntityContainer.invokeHome(EntityContainer.java:441) [Default] at org.jboss.ejb.plugins.jrmp.server.JRMPContainerInvoker.invokeHome(JRMPContainerInvoker.java:421) [Default] at org.jboss.ejb.plugins.jrmp.interfaces.HomeProxy.invokeHome(HomeProxy.java:237) [Default] at org.jboss.ejb.plugins.jrmp.interfaces.HomeProxy.invoke(HomeProxy.java:182) [Default] at $Proxy16.create(Unknown Source) [Default] at _0002feditCustomer_0002ejspeditCustomer_jsp_0._jspService(_0002feditCustomer_0002ejspeditCustomer_jsp_0.java:141) [Default] at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:119) [Default] at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) [Default] at org.apache.jasper.servlet.JspServlet$JspServletWrapper.service(JspServlet.java:176) [Default] at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:307) [Default] at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:380) [Default] at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) [Default] at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:488) [Default] at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:387) [Default] at org.mortbay.http.HandlerContext.handle(HandlerContext.java:1040) [Default] at org.mortbay.http.HandlerContext.handle(HandlerContext.java:995) [Default] at org.mortbay.http.HttpServer.service(HttpServer.java:683) [Default] at org.mortbay.http.HttpConnection.service(HttpConnection.java:732) [Default] at org.mortbay.http.HttpConnection.handleNext(HttpConnection.java:889) [Default] at org.mortbay.http.HttpConnection.handle(HttpConnection.java:746) [Default] at org.mortbay.http.SocketListener.handleConnection(SocketListener.java:146) [Default] at org.mortbay.util.ThreadedServer.handle(ThreadedServer.java:287) [Default] at org.mortbay.util.ThreadPool$PoolThreadRunnable.run(ThreadPool.java:609) [Default] at java.lang.Thread.run(Thread.java:484) The key used is manualy specified and is 100% unique (not used before) in any bean. This happens for a bean that is on the Many side of a one-to-many relation with a foreign key. The ejbCreate() method of that bean just sets it's primary key and some attributes and ejbPostCreate() adds itself to the -to-many side of the related bean's Collection... This does not happen for a related bean which uses similar ejbCreate() and empty ejbPostCreate() methods. I tried to use Commit option A and B. The result is the same. -- Comment By: stan pinte (stanpinte) Date: 2001-12-07 02:15 Message: Logged In: YES user_id=154693 hello, I will try to reproduce the bug. More on this soon. -- Comment By: Ole Husgaard (sparre) Date: 2001-10-18 08:13 Message: Logged In: YES user_id=175257 Looks like the cache somehow got out of sync. This may be related to bug #463548 -- Comment By: Peter Levart (plevart) Date: 2001-10-18 06:59 Message: Logged In: YES user_id=346981 Investigating further I found that this exception is thrown after the bean's
[JBoss-dev] [ jboss-Bugs-472072 ] INSERTING AN ALREADY EXISTING BEAN, ID =
Bugs item #472072, was opened at 2001-10-17 07:06 You can respond by visiting: http://sourceforge.net/tracker/?func=detailatid=376685aid=472072group_id=22866 Category: JBossServer Group: v3.0 Rabbit Hole Status: Open Resolution: None Priority: 5 Submitted By: Nobody/Anonymous (nobody) Assigned to: Nobody/Anonymous (nobody) Summary: INSERTING AN ALREADY EXISTING BEAN, ID = Initial Comment: Using CMP 2.0 when calling a entity remote home's create I get the following: [Default] java.rmi.ServerException: INSERTING AN ALREADY EXISTING BEAN, ID = 111; nested exception is: java.lang.IllegalStateException: INSERTING AN ALREADY EXISTING BEAN, ID = 111 [Default] java.lang.IllegalStateException: INSERTING AN ALREADY EXISTING BEAN, ID = 111 [Default] at org.jboss.ejb.plugins.AbstractInstanceCache.insert(AbstractInstanceCache.java:249) [Default] at org.jboss.ejb.plugins.EntityInstanceInterceptor.invokeHome(EntityInstanceInterceptor.java:166) [Default] at org.jboss.ejb.plugins.EntityLockInterceptor.invokeHome(EntityLockInterceptor.java:104) [Default] at org.jboss.ejb.plugins.AbstractTxInterceptor.invokeNext(AbstractTxInterceptor.java:100) [Default] at org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxInterceptorCMT.java:156) [Default] at org.jboss.ejb.plugins.TxInterceptorCMT.invokeHome(TxInterceptorCMT.java:56) [Default] at org.jboss.ejb.plugins.SecurityInterceptor.invokeHome(SecurityInterceptor.java:106) [Default] at org.jboss.ejb.plugins.LogInterceptor.invokeHome(LogInterceptor.java:109) [Default] at org.jboss.ejb.EntityContainer.invokeHome(EntityContainer.java:441) [Default] at org.jboss.ejb.plugins.jrmp.server.JRMPContainerInvoker.invokeHome(JRMPContainerInvoker.java:421) [Default] at org.jboss.ejb.plugins.jrmp.interfaces.HomeProxy.invokeHome(HomeProxy.java:237) [Default] at org.jboss.ejb.plugins.jrmp.interfaces.HomeProxy.invoke(HomeProxy.java:182) [Default] at $Proxy16.create(Unknown Source) [Default] at _0002feditCustomer_0002ejspeditCustomer_jsp_0._jspService(_0002feditCustomer_0002ejspeditCustomer_jsp_0.java:141) [Default] at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:119) [Default] at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) [Default] at org.apache.jasper.servlet.JspServlet$JspServletWrapper.service(JspServlet.java:176) [Default] at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:307) [Default] at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:380) [Default] at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) [Default] at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:488) [Default] at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:387) [Default] at org.mortbay.http.HandlerContext.handle(HandlerContext.java:1040) [Default] at org.mortbay.http.HandlerContext.handle(HandlerContext.java:995) [Default] at org.mortbay.http.HttpServer.service(HttpServer.java:683) [Default] at org.mortbay.http.HttpConnection.service(HttpConnection.java:732) [Default] at org.mortbay.http.HttpConnection.handleNext(HttpConnection.java:889) [Default] at org.mortbay.http.HttpConnection.handle(HttpConnection.java:746) [Default] at org.mortbay.http.SocketListener.handleConnection(SocketListener.java:146) [Default] at org.mortbay.util.ThreadedServer.handle(ThreadedServer.java:287) [Default] at org.mortbay.util.ThreadPool$PoolThreadRunnable.run(ThreadPool.java:609) [Default] at java.lang.Thread.run(Thread.java:484) The key used is manualy specified and is 100% unique (not used before) in any bean. This happens for a bean that is on the Many side of a one-to-many relation with a foreign key. The ejbCreate() method of that bean just sets it's primary key and some attributes and ejbPostCreate() adds itself to the -to-many side of the related bean's Collection... This does not happen for a related bean which uses similar ejbCreate() and empty ejbPostCreate() methods. I tried to use Commit option A and B. The result is the same. -- Comment By: stan pinte (stanpinte) Date: 2001-12-07 02:15 Message: Logged In: YES user_id=154693 hello, I will try to reproduce the bug. More on this soon. -- Comment By: Ole Husgaard (sparre) Date: 2001-10-18 08:13 Message: Logged In: YES user_id=175257 Looks like the cache somehow got out of sync. This may be related to bug #463548 -- Comment By: Peter Levart (plevart) Date: 2001-10-18 06:59 Message: Logged In: YES user_id=346981 Investigating further I found that this exception is thrown after the bean's ejbCreate