5 Replies Latest reply on Feb 20, 2006 10:53 AM by William DeCoste

    The issue of calling EJB from client

    y w Newbie

      Hi,

      I followed the tutorial instruction to create stateless session bean sample. I think I could deploy it successfully, the ejb3 jar fileset looks like:

      C:\j2ee\ejb\build>jar tf StatelessSample.ejb3
      META-INF/
      META-INF/MANIFEST.MF
      beans/
      beans/SimpleSession.class
      beans/SimpleSessionBean.class


      My Client looks like:

      SimpleSession simpleSession = (SimpleSession) ctx.lookup(SimpleSession.class.getName());

      JMX console looks like:

      MBean Name: Domain Name: jboss.j2ee
      service: EJB3
      name: SimpleSessionBean
      jar: StatelessSample.ejb3
      MBean Java Class: org.jboss.ejb3.ServiceDelegateWrapper



      I assume that my ejb is deployed OK.

      However, when I ran client, I got exception:

      [java] Exception in thread "main" javax.naming.NameNotFoundException: beans
      .SimpleSession not bound


      Can anyone give me some hints what is going on?

      Thanks

        • 1. Re: The issue of calling EJB from client
          Peter Westlin Newbie

          Which version of JBoss are you running? I'll bet it is EJB3 RC5 or 4.0.4RC1. In those versions you don't lookup your EJB's with foo.class.getName(). See http://docs.jboss.org/ejb3/app-server/tutorial/jndibinding/jndi.html.

          Regards Peter

          • 2. Re: The issue of calling EJB from client
            Brian Blignaut Newbie

            Hi,

            I am also trying to run the same example (I assume it is the one from the javaworld article). I have managed to lookup up the session bean, however the object returned from InitialContext.lookup is of type org.jnp.interfaces.NamingContext and not of type SimpleSession as I expect?

            I am running version 4.0.4RC1, and any help would be greatly appreciated as I have been trying to get this to run for days now! In the jmx console it shows the following for my bean

            Domain Name: jboss.j2ee
            service: EJB3
            name: SimpleSessionBean
            jar: SimpleSessionApp.ejb3
            MBean Java Class: org.jboss.ejb3.ServiceDelegateWrapper

            so I am guessing the session bean is deployed properly?

            Regards,
            Brian

            • 3. Re: The issue of calling EJB from client
              y w Newbie

              Hi, Peter,

              I also did lookup by calling: ejbName/remote in my client, however, I still get the same "not bound " exception. Any suggestions?

              Thanks ahead.

              • 4. Re: The issue of calling EJB from client
                Jan Philipp Giel Newbie

                please have a look at the logfile if you can find messages like this:

                18:49:05,653 INFO [JmxKernelAbstraction] installing MBean: jboss.j2ee:service=EJB3,jar=gecam.ejb3,name=ListManagerBean with dependencies:
                18:49:05,653 INFO [JmxKernelAbstraction] persistence.units:jar=gecam.ejb3.jar,unitName=gecam
                


                Then you can lookup the session bean like this
                InitialContext ctx = new InitialContext();
                (ListManagerRemote) listManager = (ListManagerRemote) ctx.lookup("ListManagerBean/remote");
                


                • 5. Re: The issue of calling EJB from client
                  William DeCoste Apprentice

                  EJB3 RC4 and RC5 use the "bean/remote" default jndi binding, but are deployed using .jar files not .ejb3 files. Previous release candidates used the .ejb3 files, but used the bean.class.getName() default jndi binding. So it looks like you are using an older release candidate with the new versions default binding values.

                  I suggest you either upgrade to RC5 and deploy your beans as a .jar file.