1 Reply Latest reply on Mar 27, 2003 3:25 PM by thl-mot

    serious problem accessing CMR

    thl-mot

      Hi,
      I have a serious problem in the code below.
      Configuration:
      JBoss 3.0.4 and JBoss 3.0.6 (both with Tomcat)
      Benutzer and Rolle are CMP 2.0 entity beans that have a n-m relation
      DbDialogUser and DefaultGroup are DataObjects representing the data from the entities that is used in their constructors

      1 public User getUser( Object userKey) {
      2 logger.debug( "Look for user: '"+userKey+"'");
      3 Benutzer entity= (Benutzer)findUserEntity( userKey);
      4 if (entity==null) {
      5 logger.debug( " not available");
      6 return null;
      7 }
      8 logger.debug( "Ergebnis: "+entity.getLoginName());
      9
      10 DbDialogUser dbDialogUser= new DbDialogUser( entity);
      11 logger.debug( "DO erzeugt");
      12
      13 Rolle rEntity = null;
      14 DefaultGroup group = null;
      15 Collection rc= entity.getRolle();
      16 Iterator ri= rc.iterator();
      17 Vector v= new Vector();
      18 while ( ri.hasNext()) {
      19 rEntity= (Rolle)ri.next();
      20 group= new DefaultGroup();
      21 group.setGroupId( rEntity.getRolleId());
      22 group.setDescription( rEntity.getBeschreibung());
      23 logger.debug( "-- "+group.getGroupId());
      24 dbDialogUser.addGroup( group);
      25 }
      26 return dbDialogUser;
      27 }


      The server.log and the Profiler of the SQLServer gives me lots of information that I don't really understand:

      The server log tells me, for line 2 that I look for a specific userKey. After that jboss looking for the
      entity by sending "select loginName from Benutzer where loginName=?" to the database. Thats fine. In the next step jboss is loading the data of a set of Entities of Benutzer:
      SELECT loginName,vorname,.... FROM Benutzer WHERE (loginName=?) OR (loginName=?) OR (loginName=?)
      The number and data of (loginName=?) seam to depend on a result of a finder method, that was called on the same entity bean a few steps before. The log information produced by line 5, 8 and 11 are correct. Line 15 causes the following exception:

      2003-03-11 17:08:47,937 ERROR [de.netpioneer.system.users.ejb.EjbUserManager] Error in getUser(...)
      javax.transaction.TransactionRolledbackException: Load relation failed; CausedByException is:
      null; CausedByException is:
      Load relation failed; CausedByException is:
      null; nested exception is:
      javax.ejb.EJBException: Load relation failed; CausedByException is:
      null
      at org.jboss.ejb.plugins.LogInterceptor.handleException(LogInterceptor.java:271)
      at org.jboss.ejb.plugins.LogInterceptor.invoke(LogInterceptor.java:208)
      at org.jboss.ejb.StatelessSessionContainer.invoke(StatelessSessionContainer.java:313)
      at org.jboss.ejb.Container.invoke(Container.java:712)
      at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:517)
      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:77)
      at org.jboss.proxy.SecurityInterceptor.invoke(SecurityInterceptor.java:80)
      at org.jboss.proxy.ejb.StatelessSessionInterceptor.invoke(StatelessSessionInterceptor.java:111)
      at org.jboss.proxy.ClientContainer.invoke(ClientContainer.java:76)
      at $Proxy113.getUser(Unknown Source)
      at de.netpioneer.system.users.ejb.EjbUserManager.getUser(EjbUserManager.java:69)
      ...


      I checked the database for any inconsistency (not existing foreign keys, null valued fields that are mapped to int, ...).
      As this method is part of a user login procedure and user manager. After a restart of jboss this method is working perfectly for a given user.
      But after a while its impossible to access this method again without getting the exception.


      Why do I get this exception here? What do I have to do to avoid it?
      Why is jboss loading the data of a whole set of entities if just one is needed?


      thl-mot

        • 1. Re: serious problem accessing CMR
          thl-mot

          Hi again,
          After some investigations I could find out two things:
          JBoss is loading all entities from the cache that have been loaded by a finder previously called. This might take some time.
          When loading this data, jboss must have a bug here. The exception I got was the NullPointerException. Alexei could confirm this, and is having a look at it.

          At the moment I have solved this problem by adding the <read-ahead> tag for the entities.

          <read-ahead>
          <page-size>1</page-size>
          </read-ahead>

          Any better idea?

          thl-mot