2 Replies Latest reply on Sep 30, 2008 3:28 PM by Jan Groth

    Accessing SFSB @Startup

    Jan Groth Novice


      I'm stuck with the following problem and am starting to doubt my understanding of bijection and the component model.

      For some reason I am unable to access a stateful session bean AT STARTUP from within component.

      Here is the scenario:

      At the startup of the (web-)session I want to store an ActorConfig object in the session scope. In order to create the object, I need to call a method at an stateful session bean. This returns a null-pointer exception.

      Is there a conceptual misunderstanding of mine?

      Many thanks for help,


      As Code:

      @Startup(depends = { "clientManager", "clientList" })
      public class InternetInitialization implements Serializable {
           @Out(scope = ScopeType.SESSION, value = ActorConfig.CONTEXT_ID, required = true)
           private ActorConfig                         actorConfig;
           @In(create = true)
           private ClientManagerLocal     clientManager;
           public void initInternet() {
                Client client = clientManager.getClientByClientcode("SFDE");
                actorConfig = new ActorConfig(client);


      public class ClientManager implements ClientManagerLocal {
           @In(create = true)
           private ClientList     clientList;
           public Client getClientByClientcode(String clientcode) {
      [line 36]     return clientList.getClientByClientcode(clientcode); 


      public class ClientList extends EntityQuery<Client> {


      And here is the exception:

      09:32:17,154 ERROR [[/myProject]] Session event listener threw exception
      org.jboss.seam.InstantiationException: Could not instantiate Seam component: internetInit
           at org.jboss.seam.Component.newInstance(Component.java:1986)
           at org.jboss.seam.contexts.Contexts.startup(Contexts.java:304)
           at org.jboss.seam.contexts.Contexts.startup(Contexts.java:278)
           at org.jboss.seam.contexts.Lifecycle.beginSession(Lifecycle.java:191)
      Caused by: javax.ejb.EJBException: java.lang.NullPointerException
           at org.jboss.ejb3.tx.Ejb3TxPolicy.handleExceptionInOurTx(Ejb3TxPolicy.java:63)
           at org.jboss.aspects.tx.TxPolicy.invokeInOurTx(TxPolicy.java:83)
           at org.jboss.aspects.tx.TxInterceptor$Required.invoke(TxInterceptor.java:191)
           at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
      Caused by: java.lang.NullPointerException
           at com.myProject.client.ClientManager.getClientByClientcode(ClientManager.java:36)
           at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
           at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
           at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
           at java.lang.reflect.Method.invoke(Method.java:585)