4 Replies Latest reply on Nov 6, 2013 11:12 AM by vandiesel

    Ignoring 'stateful' option on lookup of home interface

    vandiesel

      Hi,

       

      Please let me know if stateful ejb bean is created if this warning appears.

       

      19:21:02,729 WARN  [org.jboss.ejb.client.naming] (http-localhost-127.0.0.1-80-1) Ignoring 'stateful' option on lookup of home interface com.mysedan.application.limonet.control.ejb.EJBControllerHome

       

       

      I am doing lookup of EJB using the home interface like

       

      public static EJBControllerHome getEJBControllerHome() throws NamingException {         

      Hashtable env = new Hashtable();

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

      InitialContext initialContext = new InitialContext(env);

        return (EJBControllerHome)initialContext.lookup("ejb:savoya/savoya.jar/ControllerEJB!com.mysedan.application.limonet.control.ejb.EJBControllerHome?stateful");

      }

       

      this.ejbController = getEJBControllerHome().create();

       

       

      In ejb-jar.xml

       

      <session>

                  <display-name>EJBController Service</display-name>

                  <ejb-name>ControllerEJB</ejb-name>

                  <home>com.mysedan.application.limonet.control.ejb.EJBControllerHome</home>

                  <remote>com.mysedan.application.limonet.control.ejb.EJBController</remote>

                  <ejb-class>com.mysedan.application.limonet.control.ejb.EJBControllerBean</ejb-class>

                  <session-type>Stateful</session-type>

                  <transaction-type>Container</transaction-type>

                  <resource-ref>

                      <description>The mysedan DS</description>

                      <res-ref-name>mysedanDS</res-ref-name>

                      <res-type>javax.sql.DataSource</res-type>

                      <res-auth>Container</res-auth>

                      <lookup-name>java:/mysedanDS</lookup-name>

                  </resource-ref>

              </session>

       

      In jboss.xml

       

      <session>

                  <ejb-name>ControllerEJB</ejb-name>

                  <jndi-name>com.mysedan.application.limonet.control.ejb.EJBControllerHome?stateful</jndi-name>

                  <resource-ref>

                      <res-ref-name>mysedanDS</res-ref-name>

                      <resource-name>mysedanDS</resource-name>

                  </resource-ref>

              </session>

       

       

      Let me know your thoughts!

       

      Thank you,

       

      Diesel

        • 1. Re: Ignoring 'stateful' option on lookup of home interface
          swd847

          You do not need ?stateful if using the home interference, only if you are looking up business interfaces directly.

          • 2. Re: Ignoring 'stateful' option on lookup of home interface
            vandiesel

            Hi Douglas,

             

            Thank you, I see the following statement in the Jboss 7.1 documentation.

             

            "For stateful beans, the JNDI name expects an additional "?stateful" to be appended after the fully qualified interface name part. This is because for stateful beans, a new session gets created on JNDI lookup and the EJB client API implementation doesn't contact the server during the JNDI lookup to know what kind of a bean the JNDI name represents (we'll come to this in a while). So the JNDI name itself is expected to indicate that the client is looking up a stateful bean, so that an appropriate session can be created."

             

            So, in my case, how come the container knows that my bean is stateful or stateless during JNDI lookup.  Is it through ejb-jar.xml file?

             

            Thank you,

             

            Diesel

            • 3. Re: Ignoring 'stateful' option on lookup of home interface
              swd847

              I think because it implements the EHJHome interface.

               

              Stuart

              • 4. Re: Ignoring 'stateful' option on lookup of home interface
                vandiesel

                Hi Stuart

                 

                Is it EJBHome interface. Like my stateful and stateless beans' remote interface extends same EJBHome Interface.

                 

                Please let me know how can I test if my Stateful Bean has infact created a sessionID. Is it possible to test from console view   "localhost:9990/console"?

                 

                Any examples would be good!

                 

                Thank you,

                 

                Diesel