3 Replies Latest reply on Jan 28, 2014 7:57 AM by wdfink

    How to invoke Stateful SessionBean from remote Standalone Client

    trvajjala

      i'm trying to invoke stateful sesion bean from remote client with ?stateful  and suffix to JNDI URI. but it is giving error as session id not set.

       

      is there any way to achieve this.

        • 1. Re: How to invoke Stateful SessionBean from remote Standalone Client
          wdfink

          You give a bit less information, please provide how you set the invocation context and how the error look like.

          Also the used server version will be helpful.

          • 2. Re: How to invoke Stateful SessionBean from remote Standalone Client
            trvajjala

            Jboss Server version 6.10 EAP.

             

            initial context   is created as shown below

             

             

              final Properties env = new Properties();

              env.put(Context.INITIAL_CONTEXT_FACTORY,

              "org.jboss.naming.remote.client.InitialContextFactory");

              env.put(Context.URL_PKG_PREFIXES, "org.jboss.ejb.client.naming");

              env.put(Context.PROVIDER_URL, "remote://localhost:4447");

              Context context = new InitialContext(env);

             

            context.lookup("ejb:" + SERVICE_NAME + "/"

              + serviceMapper.get(serviceBean) + "//" + serviceBean + "!"

              + service.getName());

             

             

            with this i can able lookup stateless session beans but the issue with stateful session which is giving

             

            Caused by: java.lang.IllegalStateException: JBAS014366: Session id hasn't been set for stateful component:

             

            i have suffixed with?stateful

             

            context.lookup("ejb:" + SERVICE_NAME + "/"

              + serviceMapper.get(serviceBean) + "//" + serviceBean + "!"

              + service.getName()+"?stateful");  but there is no luck.

             

             

            i used jboss-client.jar from  JBoss\bin\client folder.  is there any other jar files required.

            • 3. Re: How to invoke Stateful SessionBean from remote Standalone Client
              wdfink

              You are mixing the ejb-client and remote-naming approach.

              If you use URL=remote:// you use remote naming and in this case you need to drop the ejb: prefix from your lookup string.

              That should work.