7 Replies Latest reply on Oct 3, 2012 2:38 AM by mmatloka

    Lookup stateful ejb

    mmatloka

      According to https://docs.jboss.org/author/display/AS71/EJB+invocations+from+a+remote+client+using+JNDI proper jndi name of stateful eban ends with "?stateful". When I use my jndi name with ?stateful, during lookup I receive javax.naming.NameNotFoundException. When I does not add "?stateful" to jndi name everything is ok. Is this bug in application server, in documentation or on my side?

        • 1. Re: Lookup stateful ejb
          nickarls

          What is the complete JNDI string for the working version?

          • 2. Re: Lookup stateful ejb
            mmatloka

            project.server/MyService!com.ja.MyServiceIf

            • 3. Re: Lookup stateful ejb
              nickarls

              Perhaps the ?stateful is only applicable for

               

               

              ejb:<app-name>/<module-name>/<distinct-name>/<bean-name>!<fully-qualified-classname-of-the-remote-interface>?stateful

               

              • 4. Re: Lookup stateful ejb
                jaikiran

                Are you sure you are using EJB client JNDI lookup and not the remoting API. See this for the differences https://docs.jboss.org/author/display/AS71/Remote+EJB+invocations+via+JNDI+-+EJB+client+API+or+remote-naming+project

                • 5. Re: Lookup stateful ejb
                  mmatloka

                  I have

                   

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

                   

                  in my code, so theoretically ejb client?

                  • 6. Re: Lookup stateful ejb
                    jaikiran

                    But your JNDI lookup string that you posted, doesn't start with the ejb: namespace so it isn't using the EJB client project and instead is using remoting naming, I believe. Please post the relevant code and the entire exception stacktrace.

                    • 7. Re: Lookup stateful ejb
                      mmatloka

                      I've moved configuration to jndi.properties

                       

                      java.naming.provider.url                    = remote://localhost:4447

                      java.naming.security.principal              = testuser

                      java.naming.security.credentials            = testpassword

                       

                       

                      java.naming.factory.url.pkgs                = org.jboss.ejb.client.naming

                      java.naming.factory.initial                 = org.jboss.naming.remote.client.InitialContextFactory

                      Code does simply context lookup.

                       

                      My ejb is in war.

                       

                      For jndi name:

                       

                      ejb:project.server/MyService!com.ja.MyServiceIf?stateful

                       

                      java.lang.IllegalArgumentException: object is not an instance of declaring class

                       

                       

                      For jndi name:

                       

                      ejb:project.server//MyService!com.ja.MyServiceIf?stateful

                      ejb:project.server///MyService!com.ja.MyServiceIf?stateful

                       

                      java.lang.IllegalStateException: No EJB receiver available for handling [appName:project.server,modulename:,distinctname:] combination

                                at org.jboss.ejb.client.EJBClientContext.requireEJBReceiver(EJBClientContext.java:517)

                                at org.jboss.ejb.client.EJBClient.createSession(EJBClient.java:161)

                                at org.jboss.ejb.client.naming.ejb.EjbNamingContext.doCreateProxy(EjbNamingContext.java:135)

                                at org.jboss.ejb.client.naming.ejb.EjbNamingContext.createEjbProxy(EjbNamingContext.java:113)