6 Replies Latest reply on Feb 10, 2006 9:31 AM by doegi

    help on

    da.ogre

      Hi all!

      I have a problem running the simplest app, i.e. the canonical "hello world". I downloaded version 4.0.4RC1 of the AS, installed the ejb-clustered profile and packaged an hello404.ejb3 archive, containing just two files - the hello bean and its remote interface.
      The interface:

      package org.hello;
      import javax.ejb.Remote;
      
      @Remote
      public interface Hello {
       public String sayHello();
      }

      and the bean:
      package org.hello;
      
      import javax.ejb.Stateless;
      import org.hello.Hello;
      
      public @Stateless class HelloBean implements Hello {
       public String sayHello() {
       return "hello!";
       }
      }

      The client I put up is:
      package org.hello.client;
      
      import javax.naming.Context;
      import javax.naming.InitialContext;
      import javax.naming.NamingException;
      import org.hello.Hello;
      
      public class HelloClient {
       public static void main(String[] args) {
       try {
       Context ctx = new InitialContext();
       Hello hello = (Hello) ctx.lookup(Hello.class.getName());
       System.out.println(hello.sayHello());
       } catch (NamingException e) {
       e.printStackTrace();
       }
       }
      }
      

      When I run it, an exception
      javax.naming.NameNotFoundException: org.hello.Hello not bound
      ...

      is thrown.

      Actually, when deploying the bean the server outputs:
      INFO [Ejb3AnnotationHandler] found EJB3: ejbName=HelloBean, class=org.hello.HelloBean, type=STATELESS
      INFO [Ejb3Deployment] EJB3 deployment time took: 172
      INFO [JmxKernelAbstraction] installing MBean: jboss.j2ee:service=EJB3,jar=hello404.ejb3,name=HelloBean with dependencies:
      INFO [EJB3Deployer] Deployed: file:/C:/java/jboss-4.0.4RC1/server/default/deploy/hello404.ejb3

      I don't see a message, indicating that the remote interface is found and have no idea what should do.

      Running on windows, with eclipse 3.1.2 and jbossIDE 1.5.0RC1.

        • 1. Re: help on
          s.rzytki

          Hello
          I had the same problem. I still looking for an answer... :)

          Regards Sebastian


          • 2. Re: help on
            wesslan

            Naming convention in JNDI is:
            EAR_FILE_WITHOUT_EAR_SUFFIX/BEAN_NAME/remote
            and
            EAR_FILE_WITHOUT_EAR_SUFFIX/BEAN_NAME/local


            So in your case you cannot look up your bean with

            Hello.class.getName()
            because this is the old (4.0.3SP1) style. You sould do something like:
            HelloBean/remote


            I can't really remember how it works when just packaging with ejb3...

            Regards Peter

            • 3. Re: help on
              theute

              Try a lookup on "Hello/remote" instead of
              "Hello.class.getName()"

              http://wiki.jboss.org/wiki/Wiki.jsp?page=FromJBossEJB3.0RC3ToRC4PFD
              "The default JNDI name for any @Remote or @Local interfaces is no longer the FQN of the interface. It is now EJBNAME/remote or EJBNAME/local respectively."



              • 4. Re: help on
                theute

                oups yes HelloBean/remote ;)

                • 5. Re: help on
                  da.ogre

                  Many many thanks, guys!

                  I haven't read that doc about the changes and bumped my head what am I doing wrong, but haven't thought about that.

                  • 6. Re: help on
                    doegi

                    erm, isn't that a bit counterproductive?

                    I've got a Remote interface that remote clients use, but actually two different implementations depending on the enviroment.

                    Now with this change the remote client application needs to know what implementation is deployed onto JBoss, and any abstraction that EJB gave us are gone. Why is that? How do you do lookups now w/o knowing what Bean implements the remote interface?

                    Another thing: Jobss doesn't deploy to EJBNAME/remote but to EARNAME/EJBBEANNAME/remote, so you also need to know the EAR name.

                    Thanks