1 Reply Latest reply on Jan 7, 2004 2:47 PM by Adrian Brock

    Problem: Lost connection to Informix Database

    Dries De Moor Newbie

      Hello,

      I'm using JBoss 3.0.4 for our J2EE application. As DBMS we use Informix.
      It is a production application which runs 24h a day, 5 days a week.
      After 2 days I have to restart jboss because the beans I use don't find the data in the database.
      In the logging I get the following Error:





      2004-01-06 17:38:48,371 WARN [org.jboss.tm.TxCapsule] Transaction XidImpl [FormatId=257, GlobalId=rs021.awe.be//
      27248, BranchQual=] timed out. status=STATUS_ACTIVE
      2004-01-06 17:38:48,876 INFO [be.awe.beans.session.CoderingBean] TuftCodeVariatie is: TMTNAVAYRA03A TMTNAVA YRA0
      3A
      2004-01-06 17:38:54,547 ERROR [org.jboss.ejb.plugins.LogInterceptor] EJBException, causedBy:
      be.awe.beans.util.UnknownObjectException: Error voor id: Verfkwaliteit Method only for queries
      at be.awe.beans.session.IDManagerBean.getNextID(IDManagerBean.java:110)
      at sun.reflect.GeneratedMethodAccessor76.invoke(Unknown Source)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java(Compiled Code))
      at java.lang.reflect.Method.invoke(Method.java(Compiled Code))
      at org.jboss.ejb.StatelessSessionContainer$ContainerInterceptor.invoke(StatelessSessionContainer.java(Com
      piled Code))
      at org.jboss.resource.connectionmanager.CachedConnectionInterceptor.invoke(CachedConnectionInterceptor.ja
      va(Compiled Code))
      at org.jboss.ejb.plugins.StatelessSessionInstanceInterceptor.invoke(StatelessSessionInstanceInterceptor.j
      ava(Compiled Code))
      at org.jboss.ejb.plugins.AbstractTxInterceptor.invokeNext(AbstractTxInterceptor.java(Compiled Code))
      at org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxInterceptorCMT.java(Compiled Code))
      at org.jboss.ejb.plugins.TxInterceptorCMT.invoke(TxInterceptorCMT.java(Compiled Code))
      at org.jboss.ejb.plugins.SecurityInterceptor.invoke(SecurityInterceptor.java(Compiled Code))
      at org.jboss.ejb.plugins.LogInterceptor.invoke(LogInterceptor.java(Compiled Code))
      at org.jboss.ejb.StatelessSessionContainer.invoke(StatelessSessionContainer.java(Compiled Code))
      at org.jboss.ejb.Container.invoke(Container.java(Compiled Code))
      at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java(Compiled Code))
      at org.jboss.invocation.local.LocalInvoker.invoke(LocalInvoker.java(Compiled Code))
      at org.jboss.invocation.InvokerInterceptor.invoke(InvokerInterceptor.java(Compiled Code))
      at org.jboss.proxy.TransactionInterceptor.invoke(TransactionInterceptor.java(Compiled Code))
      at org.jboss.proxy.SecurityInterceptor.invoke(SecurityInterceptor.java(Compiled Code))
      at org.jboss.proxy.ejb.StatelessSessionInterceptor.invoke(StatelessSessionInterceptor.java(Compiled Code)
      )
      at org.jboss.proxy.ClientContainer.invoke(ClientContainer.java(Compiled Code))
      at $Proxy146.getNextID(Unknown Source)
      at be.awe.beans.session.VerfkeukenBean.createVerfkwaliteit(VerfkeukenBean.java:1117)



      This is the code corresponding with the getNextID method

      int i = 0;
       try
       {
       InitialContext ctx = new InitialContext();
       dataSource = (DataSource) ctx.lookup(resourceBundle.getString("datasource"));
       conn = dataSource.getConnection();
       Statement selectStmt = conn.createStatement();
       Statement updateStmt = conn.createStatement();
       Integer id = null;
       synchronized (selectStmt)
       {
       ResultSet rs = selectStmt.executeQuery("SELECT * FROM k_IDMANAGER WHERE OBJECTNAAM = '" + objectName + "'");
       rs.next();
       i = rs.getInt(1);
       rs.close();
       i++;
       updateStmt.executeUpdate("UPDATE k_IDMANAGER SET ID = " + i + " WHERE OBJECTNAAM = '" + objectName + "'");
       id = new Integer(i);
       return id;
       }
       }
       catch (SQLException e)
       {
       throw new UnknownObjectException("Error voor id: " + objectName, e);
       }
       catch (NamingException e)
       {
       e.printStackTrace();
       throw new EJBException(e.getMessage());
       }


      Getting this error message ( Method only for queries ) is strange because I don't see a problem in the code.

      I'm having the same problem all over the application. Looking up data in the Informix Database whether it is with EJB finder methods or with a DAO gives Exception. Although the data which the application wants to look up is in the database.

      Maybe the following error is causing this problem.

      javax.ejb.EJBException: Could not passivate; CausedByException is:
      org.jboss.resource.adapter.jdbc.local.LocalConnection
      at org.jboss.ejb.plugins.StatefulSessionFilePersistenceManager.passivateSession(StatefulSessionFilePersis
      tenceManager.java:293)
      at org.jboss.ejb.plugins.StatefulSessionInstanceCache.passivate(StatefulSessionInstanceCache.java:78)
      at org.jboss.ejb.plugins.AbstractInstanceCache$1.execute(AbstractInstanceCache.java(Compiled Code))
      at org.jboss.util.WorkerQueue$QueueLoop.run(WorkerQueue.java:206)
      at java.lang.Thread.run(Thread.java:568)
      java.io.NotSerializableException: org.jboss.resource.adapter.jdbc.local.LocalConnection
      at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java(Compiled Code))
      at java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java(Inlined Compiled Code))
      at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java(Compiled Code))
      at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java(Compiled Code))
      at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java(Compiled Code))
      at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java(Compiled Code))
      at org.jboss.ejb.plugins.StatefulSessionFilePersistenceManager.passivateSession(StatefulSessionFilePersis
      tenceManager.java:287)
      at org.jboss.ejb.plugins.StatefulSessionInstanceCache.passivate(StatefulSessionInstanceCache.java:78)
      at org.jboss.ejb.plugins.AbstractInstanceCache$1.execute(AbstractInstanceCache.java(Compiled Code))
      at org.jboss.util.WorkerQueue$QueueLoop.run(WorkerQueue.java:206)
      at java.lang.Thread.run(Thread.java:568)




      When using Connection in Objects that are send from server to client or client to server, I declare it as transient so it is not serialized.


      Can somebody help me with this problem. Is there a way to see how much Connections there are used by JBoss?
      I hope it is clear enough. Let me know if you want some additional information.


      Thx a lot,

      Dries De Moor