0 Replies Latest reply on Aug 3, 2002 10:39 PM by rolivawdaneel

    I get a "INSERTING AN ALREADY EXISTING BEAN, ID = [.]" one t

    rolivawdaneel

      A simple testing JSP:
      ...
      Context context = new InitialContext();
      TelephoneHome telephoneHome = (TelephoneHome) context.lookup("java:comp/env/ejb/pagerweb/Telephone");
      Telephone telephone = telephoneHome.create( "firstTelephone", "firstdescr", "1b2cb1c2b1c" );


      HashSet telephones = new HashSet();
      telephones.add(telephone);

      TelephoneGroupHome telephoneGroupHome = (TelephoneGroupHome) context.lookup("java:comp/env/ejb/pagerweb/TelephoneGroup");
      TelephoneGroup telephoneGroup = telephoneGroupHome.create( "firsttelGROUP", "firstdescrGROUP", telephones );
      ...

      The first time i load the page it's ok. Then if i click "reload" I get:
      id requested: 1715147414
      id requested: 1732845863
      JSP: init
      id requested: 1473513553
      java.rmi.ServerException: INSERTING AN ALREADY EXISTING BEAN, ID = [.]; nested exception is:
      ateException: INSERTING AN ALREADY EXISTING BEAN, ID = [.]
      at org.jboss.ejb.plugins.AbstractTxInterceptor.invokeNext(AbstractTxInterceptor.java:119)
      at org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxInterceptorCMT.java:167)
      at org.jboss.ejb.plugins.TxInterceptorCMT.invokeHome(TxInterceptorCMT.java:52)
      at org.jboss.ejb.plugins.SecurityInterceptor.invokeHome(SecurityInterceptor.java:104)
      at org.jboss.ejb.plugins.LogInterceptor.invokeHome(LogInterceptor.java:109)
      at org.jboss.ejb.EntityContainer.invokeHome(EntityContainer.java:487)
      at org.jboss.ejb.Container.invoke(Container.java:726)
      at org.jboss.ejb.EntityContainer.invoke(EntityContainer.java:1055)
      at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:491)
      at org.jboss.invocation.local.LocalInvoker.invoke(LocalInvoker.java:98)
      at org.jboss.invocation.InvokerInterceptor.invoke(InvokerInterceptor.java:102)
      at org.jboss.proxy.TransactionInterceptor.invoke(TransactionInterceptor.java:73)
      at org.jboss.proxy.SecurityInterceptor.invoke(SecurityInterceptor.java:76)
      at org.jboss.proxy.ejb.HomeInterceptor.invoke(HomeInterceptor.java:185)
      at org.jboss.proxy.ClientContainer.invoke(ClientContainer.java:76)
      at $Proxy31.create(Unknown Source)
      at org.apache.jsp.index$jsp._jspService(index$jsp.java:69)
      at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:107)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
      at org.apache.jasper.servlet.JspServlet$JspServletWrapper.service(JspServlet.java:201)
      at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:381)
      at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:473)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
      at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:371)
      at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:607)
      at org.mortbay.http.HttpContext.handle(HttpContext.java:1387)
      at org.mortbay.http.handler.ResourceHandler.handleGet(ResourceHandler.java:387)
      at org.mortbay.http.handler.ResourceHandler.handle(ResourceHandler.java:282)
      at org.mortbay.http.HttpContext.handle(HttpContext.java:1387)
      at org.mortbay.http.HttpContext.handle(HttpContext.java:1326)
      at org.mortbay.http.HttpServer.service(HttpServer.java:757)
      at org.jboss.jetty.Jetty.service(Jetty.java:527)
      at org.mortbay.http.HttpConnection.service(HttpConnection.java:742)
      at org.mortbay.http.HttpConnection.handleNext(HttpConnection.java:915)
      at org.mortbay.http.HttpConnection.handle(HttpConnection.java:757)
      at org.mortbay.http.SocketListener.handleConnection(SocketListener.java:151)
      at org.mortbay.util.ThreadedServer.handle(ThreadedServer.java:287)
      at org.mortbay.util.ThreadPool$JobRunner.run(ThreadPool.java:715)
      at java.lang.Thread.run(Thread.java:536)
      Caused by: java.lang.IllegalStateException: INSERTING AN ALREADY EXISTING BEAN, ID = [.]
      at org.jboss.ejb.plugins.AbstractInstanceCache.insert(AbstractInstanceCache.java:221)
      at org.jboss.ejb.plugins.EntityInstanceInterceptor.invokeHome(EntityInstanceInterceptor.java:147)
      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:98)
      ... 38 more

      The "id requested : 13456" part is a System.out.println of the id (PK) of the bean inserted. (It is a weak and temporary algorithm that generate these: util.Random, but it should work fine with only one person loading the page at the time and with very limited number of rows [as soon as i will have debug this i will work for a better PK generator])

      Then, i noticed that if i press the reload button a second time, i got the same error, a third time too, but the fourth time, I see no error, then it start again, the 5th time, 6th, 7th, an error, 8th no error, and so on. The time laps between each reload does not affect the period of this strange cycle. Do you see a potential source of this problem?

      I would really appreciate any help.

      thx :)