0 Replies Latest reply on Aug 24, 2001 2:34 PM by mickjordan

    RI Account example not working on JBOss

    mickjordan

      After some glitches with naming, I managed to deploy and run the simple Account entity bean example that comes with the Sun RI. I have previously run this as a simple test on the RI and on Weblogic.

      The example does not work properly with JBOSS 2.2.2. It's initial test which creates an account, debits some cash and then deletes the account works. The second phase which creates three new accounts and then does a find by name fails to find any rows in the database, vis:

      java AccountClient
      balance = 68.25
      balance = 32.55
      Caught an exception.
      javax.ejb.ObjectNotFoundException: No rows found.

      The server trace is:

      [AccountBean] setEntityContext
      [AccountBean] makeConnection
      [AccountBean] ejbCreate: 123
      [AccountBean] ejbStore: 123
      [AccountBean] ejbStore: 123
      [AccountBean] ejbStore: 123
      [AccountBean] ejbRemove: 123
      [AccountBean] ejbCreate: 836
      [AccountBean] ejbStore: 836
      [AccountBean] setEntityContext
      [AccountBean] makeConnection
      [AccountBean] ejbStore: 836
      [AccountBean] ejbStore: 836
      [AccountBean] ejbCreate: 456
      [AccountBean] ejbStore: 456
      [AccountBean] setEntityContext
      [AccountBean] makeConnection
      [AccountBean] ejbCreate: 730
      [AccountBean] ejbStore: 730
      [AccountBean] setEntityContext
      [AccountBean] makeConnection
      [AccountBean] ejbCreate: 268
      [AccountBean] ejbStore: 268
      [AccountBean] setEntityContext
      [AccountBean] makeConnection
      [AccountBean] ejbFindByLastName: Smith


      The relevant piece of the code is:

      Account duke = home.create("123", "Duke", "Earl", 0.00);
      duke.credit(88.50);
      duke.debit(20.25);
      double balance = duke.getBalance();
      System.out.println("balance = " + String.valueOf(balance));
      duke.remove();

      Account joe = home.create("836", "Joe", "Jones", 0.00);
      joe.credit(34.55);
      Account jones = home.findByPrimaryKey("836");
      jones.debit(2.00);
      balance = jones.getBalance();
      System.out.println("balance = " + String.valueOf(balance));
      Account pat = home.create("456", "Pat", "Smith", 0.00);
      pat.credit(44.77);
      Account john = home.create("730", "John", "Smith", 0.00);
      john.credit(19.54);
      Account mary = home.create("268", "Mary", "Smith", 0.00);
      mary.credit(100.07);

      Collection c = home.findByLastName("Smith");

      It is the "find" that returns no rows as if the previous operations did not commit. Indeed, the (Oracle) database shows no rows when queried externally. I am using the Oracle thin driver.

      The server gets wedged if the client is run a second time. It logs the first account ejbCreate and then hangs. Killing the server then hangs during:


      [OracleDB] XA Connection pool OracleDB removed from JNDI

      A hard kill (-9) is needed to get out of this state.



      The ejb-jar.xml file for this app, which defines the transaction attributes etc., is unchanged from the version shipped with the RI, which works with the RI and Weblogic.

      Something as simple as this not working is surprising. Any comments?

      Mick Jordan