2 Replies Latest reply on Feb 19, 2003 8:56 AM by Konstantin Sobolev

    INSERTING AN ALREADY EXISTING BEAN

    Artemiy Newbie

      Hello all!

      I have a Jboss version 3.0.4 an receive the same error when trying to create a EJB.

      I have tried use commit option A,B,C but it is not work.

      When I use commit option C this error appears rarely but take a place in any case.

      I have tried to inspect JBoss source code and I have found out next code in AbstractInstanceCache:

      ...

      public void insert(EnterpriseContext ctx)
      {
      if (ctx == null) throw new IllegalArgumentException("Can't insert a null object in the cache");

      CachePolicy cache = getCache();
      synchronized (getCacheLock())
      {
      // This call must be inside the sync block, otherwise can happen that I get the
      // key, then the context is passivated and I will insert in cache a meaningless
      // context.
      Object key = getKey(ctx);

      if (cache.peek(key) == null)
      {
      cache.insert(key, ctx);
      }
      else
      {
      // Here it is a bug.
      // Check for all places where insert is called, and ensure that they cannot
      // run without having acquired the cache lock via getCacheLock()
      throw new IllegalStateException("INSERTING AN ALREADY EXISTING BEAN, ID = " + key);
      }
      }
      }

      ...

      Could anyone tell me whats going on? My project under the risk, please, I need help. Is it bug or something?


      Stack trace is :

      java.lang.IllegalStateException: INSERTING AN ALREADY EXISTING BEAN, ID = [.]
      at org.jboss.ejb.plugins.AbstractInstanceCache.insert(AbstractInstanceCache.java:222)
      at org.jboss.ejb.plugins.EntityInstanceInterceptor.invokeHome(EntityInstanceInterceptor.java:103)
      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:178)
      at org.jboss.ejb.plugins.TxInterceptorCMT.invokeHome(TxInterceptorCMT.java:52)
      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 $Proxy22.create(Unknown Source)
      at com.eurooil.managers.user.basic.DefaultUserManager.createUser(DefaultUserManager.java:147)
      at com.eurooil.web.example.CreateUserAction.perform(CreateUserAction.java:79)
      at org.apache.struts.action.ActionServlet.processActionPerform(ActionServlet.java:1787)
      at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1586)
      at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:492)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:247)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)
      at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:260)
      at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
      at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
      at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
      at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
      at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
      at org.apache.catalina.valves.CertificatesValve.invoke(CertificatesValve.java:246)
      at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
      at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
      at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
      at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2396)
      at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180)
      at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
      at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:170)
      at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
      at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:172)
      at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
      at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:469)
      at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
      at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
      at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
      at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:174)
      at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
      at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
      at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
      at org.apache.catalina.connector.http.HttpProcessor.process(HttpProcessor.java:1040)
      at org.apache.catalina.connector.http.HttpProcessor.run(HttpProcessor.java:1151)
      at java.lang.Thread.run(Thread.java:484)