3 Replies Latest reply on May 8, 2008 8:49 AM by Sascha Effert

    RuntimeException using Statefull Session Bean in Session Context

    Sascha Effert Newbie

      Hello,


      I have written a SEAM-Application containing the following Statefull SessionBean:


      package de.upb.vdrive.mda.connectors.proxy;



      import java.util.List;
      
      import javax.ejb.Stateful;
      import javax.persistence.EntityManager;
      import javax.persistence.PersistenceContext;
      import javax.persistence.PersistenceContextType;
      
      import org.jboss.seam.annotations.In;
      import org.jboss.seam.annotations.Name;
      import org.jboss.seam.annotations.Scope;
      
      import de.upb.vdrive.mda.component.*;
      import de.upb.vdrive.mda.configuration.PhysicalDiskManager;
      
      import static org.jboss.seam.ScopeType.SESSION;
      
      @Stateful
      @Name("RemoteConnector")
      @Scope(SESSION)
      public class ProxyConnectorBean implements ProxyConnectorRemote {
      
           @PersistenceContext(type = PersistenceContextType.EXTENDED)
           private EntityManager entityManager;
      
           @In
           private PhysicalDiskManager physicalDiskManager;
      
           private Server server;
      
           public Server setServerByIP(String ip) {
                server = (Server) entityManager.createQuery(
                          "select a from Server a where ip=" + ip).getSingleResult();
                return server;
           }
      
           public List<PhysicalDisk> getVisiblePhysicalDisks() {
                return server.getPhysicalDisks();
           }
      
           public List<ServerPhysicalDiskConnection> getVisiblePhysicalDiskConnections() {
                return server.getPhysicalDiskConnections();
           }
      
           @SuppressWarnings("unchecked")
           public List<PhysicalDisk> getAllPhysicalDisks() {
                return physicalDiskManager.getPhysicalDisks();
           }
      
      }



      Following the Remote Interface:


      package de.upb.vdrive.mda.connectors.proxy;
      
      import java.util.List;
      
      @Remote
      public interface ProxyConnectorRemote {
      
           public Server setServerByIP(String ip);
      
           public List<PhysicalDisk> getVisiblePhysicalDisks();
      
           public List<ServerPhysicalDiskConnection> getVisiblePhysicalDiskConnections();
      
           public List<PhysicalDisk> getAllPhysicalDisks();
      }



      Local Interface is mostly same. Deploying this using SEAM 2.0.1 and JBoss 4.2.2 I get the folloging resilt:



      17:24:25,451 INFO  [Initialization] two components with same name, higher precedence wins: org.jboss.seam.core.locale
      17:24:25,457 INFO  [Initialization] two components with same name, higher precedence wins: org.jboss.seam.core.resourceLoader
      17:24:25,458 INFO  [Initialization] two components with same name, higher precedence wins: org.jboss.seam.web.userPrincipal
      17:24:25,461 INFO  [Initialization] two components with same name, higher precedence wins: org.jboss.seam.core.locale
      17:24:25,484 INFO  [Initialization] two components with same name, higher precedence wins: org.jboss.seam.core.manager
      17:24:25,488 INFO  [Initialization] two components with same name, higher precedence wins: org.jboss.seam.core.expressions
      17:24:25,489 INFO  [Initialization] two components with same name, higher precedence wins: org.jboss.seam.persistence.persistenceProvider
      17:24:25,489 INFO  [Initialization] two components with same name, higher precedence wins: org.jboss.seam.security.identity
      17:24:25,490 INFO  [Initialization] two components with same name, higher precedence wins: org.jboss.seam.web.parameters
      17:24:25,522 INFO  [Initialization] two components with same name, higher precedence wins: org.jboss.seam.bpm.businessProcess
      17:24:25,523 INFO  [Initialization] two components with same name, higher precedence wins: org.jboss.seam.web.isUserInRole
      17:24:25,524 INFO  [Initialization] two components with same name, higher precedence wins: org.jboss.seam.transaction.synchronizations
      17:24:25,557 INFO  [Component] Component: org.jboss.seam.core.init, scope: APPLICATION, type: JAVA_BEAN, class: org.jboss.seam.core.Init
      17:24:25,584 WARN  [Initialization] Did not install PojoCache due to NoClassDefFoundError: org/jgroups/MembershipListener
      17:24:25,585 INFO  [Initialization] Installing components...
      17:24:25,608 INFO  [Component] Component: RemoteConnector, scope: SESSION, type: STATEFUL_SESSION_BEAN, class: de.upb.vdrive.mda.connectors.proxy.ProxyConnectorBean, JNDI: mda2008/ProxyConnectorBean/local
      17:24:25,610 ERROR [[/mda2008]] Exception sending context initialized event to listener instance of class org.jboss.seam.servlet.SeamListener
      java.lang.RuntimeException: Could not create Component: RemoteConnector
              at org.jboss.seam.init.Initialization.addComponent(Initialization.java:976)
              at org.jboss.seam.init.Initialization.installComponents(Initialization.java:898)
              at org.jboss.seam.init.Initialization.init(Initialization.java:576)

      [...]



      I am not sure if the info messages (two components with same name) have been there before. Can anyone tell me why I get this RuntimeException?