1 Reply Latest reply on Feb 15, 2002 12:03 PM by Armin

    Timeout while exec. Oracle BMP Bean

    Rafal Walecki Newbie

      Hi,

      Please help, I do not know what to try next.
      The problem is: I have configured JBoss 2.4.4 with Tomcat 4.01 to work with Oracle 8.1.7.0.0. I'm using a OCI8 JDBC connection and OracleXid. Config is:

      30
      oracle.jdbc.xa.OracleXid

      -----------

      oracle.jdbc.driver.OracleDriver



      OracleDB
      org.jboss.pool.jdbc.xa.wrapper.XADataSourceImpl

      jdbc:oracle:oci8:@TRDB
      1200000
      transl
      1000
      mincom
      false
      false
      false
      true
      120000
      1800000
      false
      false
      1.0
      0

      Now I have Bean Managed Persistance bean which makes a connection in setEntityContext and releases that connection in unsetEntityContext.
      Bean is deployed OK with resource java:/OracleDB.
      Also I have little test client which uses ejbFindAll():
      // Get a naming context
      InitialContext jndiContext = new InitialContext();

      // Get a reference to LanguagesBean
      Object ref = jndiContext.lookup("trdb/LanguagesBean");

      // Get a reference from this to Beans Home Interface
      LanguagesHome home = (LanguagesHome)PortableRemoteObject.narrow(ref, LanguagesHome.class);

      Collection lngs = home.findAll();
      System.out.println ("Number of items: " + lngs.size());

      Languages ar[] = (Languages[])lngs.toArray(new Languages[0]);

      for (int i= 1; i < 25; i++) {
      System.out.println (ar.getLanguage() + " -> " + ar.getName());
      }
      }
      catch (Exception e) {
      System.out.println(e.toString());
      }
      }

      When I run it goes well for simetime and stops after a couple of rows retreived. After another cople of seconds it writes a message:[WARN,TxCapsule] Transaction XidImpl [FormatId=257, GlobalId=RAFALPC//37, BranchQual=] timed out. status=STATUS_ACTIVE
      It goes further if I increase MaxSize under JDBC section in jboss.jcml but alwas stop no mater wht this value is.
      In log I have something like that:
      ......
      [12:35:45,876,TxInterceptorCMT] Current thread transaction is null
      [12:35:45,876,TxInterceptorCMT] Current method public abstract java.lang.String cz.mincom.trdb.ejb.languages.Languages.getLanguage() throws java.rmi.RemoteException
      [12:35:45,876,TxInterceptorCMT] TX_REQUIRED for getLanguage
      [12:35:45,876,TxInterceptorCMT] TX_REQUIRED begin
      [12:35:45,876,TxInterceptorCMT] Starting new transaction
      [12:35:45,886,TxInterceptorCMT] Current transaction is TransactionImpl:XidImpl [FormatId=257, GlobalId=RAFALPC//37, BranchQual=]
      [12:35:45,886,EntityLockInterceptor] Begin invoke, key=46
      [12:35:45,886,EntityInstancePool] Get instance org.jboss.ejb.plugins.EntityInstancePool@786286#true#class cz.mincom.trdb.ejb.languages.LanguagesBean
      [12:35:45,886,Default] Debug: LanguagesBean: setEntityContext
      [12:35:46,066,EntityInstancePool] Add instance org.jboss.ejb.plugins.EntityInstancePool@786286#org.jboss.ejb.EntityEnterpriseContext@78920a
      [12:35:46,066,Default] Debug: LanguagesBean: ejbActivate
      [12:35:46,076,EntityInstanceCache] Activated bean LanguagesBean with id = 46
      [12:35:46,076,EntityInstanceInterceptor] Begin invoke, key=46
      [12:35:46,076,EntitySynchronizationInterceptor] invoke called for ctx org.jboss.ejb.EntityEnterpriseContext@78920a, tx=TransactionImpl:XidImpl [FormatId=257, GlobalId=RAFALPC//37, BranchQual=]
      [12:35:46,076,Default] Debug: LanguagesBean: ejbLoad
      [12:35:46,076,Default] Debug: ->> loadRow: after loading description LOB from ORACLE
      [12:35:46,076,Default] Debug: ->> loadRow: after getCharacterStrem
      [12:35:46,086,Default] Debug: ->> loadRow: after reading a strem
      [12:35:46,086,Default] Debug: ->> loadRow:
      [12:35:46,086,Default] Debug: LanguagesBean: getLanguage
      [12:35:46,096,EntitySynchronizationInterceptor] register, ctx=org.jboss.ejb.EntityEnterpriseContext@78920a, tx=TransactionImpl:XidImpl [FormatId=257, GlobalId=RAFALPC//37, BranchQual=]
      [12:35:46,096,EntityInstanceInterceptor] End invoke, key=46, ctx=org.jboss.ejb.EntityEnterpriseContext@78920a
      [12:35:46,096,EntityLockInterceptor] End invoke, key=46
      [12:35:46,096,TxInterceptorCMT] in finally
      [12:35:46,096,TxInterceptorCMT] newTransaction is not null
      [12:35:46,096,TxInterceptorCMT] before commit
      [12:35:46,096,EntitySynchronizationInterceptor] beforeCompletion called for ctx org.jboss.ejb.EntityEnterpriseContext@78920a
      [12:35:46,096,EntitySynchronizationInterceptor] Checking ctx=org.jboss.ejb.EntityEnterpriseContext@78920a, for status of tx=TransactionImpl:XidImpl [FormatId=257, GlobalId=RAFALPC//37, BranchQual=]
      [12:35:46,096,Default] Debug: LanguagesBean: ejbStore
      [12:35:46,096,Default] Debug: ->> storeRow: START of the function
      [12:35:46,096,Default] Debug: ->> storeRow: after prepare update
      [12:35:46,096,Default] Debug: ->> storeRow: after set update values
      [12:36:15,879,TxCapsule] Transaction XidImpl [FormatId=257, GlobalId=RAFALPC//37, BranchQual=] timed out. status=STATUS_ACTIVE

      Does anyone know what is going on? Please help ...
      If you need some more infor please let me know.

      RAFAL

        • 1. Re: Timeout while exec. Oracle BMP Bean
          Armin Newbie

          It is not a good idea to get the connection in setEntityContext(). Not sure if this is causing the problem, but it is likely to give you some headaches. setEntityContext() is called when the bean instance is first created, before it has a primary key associated with it (pooled state). The container will assign an identity pooled entities when needed. Later, a bean with identity may get passivated and the identity will be removed. unsetEntity() will be called before that instance is destroyed which may not happen until the server is shut down. So, in your case, suppose there are no pooled instances when you call findAll() which returns a collection of 50. The container is going to create 50 instances, also taking 50 connections out of the pool, if that many exist. That's alot of connections. Besides, it defeats the purpose of having a pool, since the beans are going to hold on to their connections.

          It's better to get your connections in the methods that need them.