3 Replies Latest reply on Aug 23, 2005 7:04 AM by Jeff

    EJB3.0 - trailblazer - context.lookup results in NameNotFoun

    Jeff Newbie

      I've followed the TrailBlazer example from...

      Then applied the fixed from the following post...

      I'm not stuck at the point where the code try to lookup the JNDI name, i.e.

      Context context = new InitialContext();
      authorsBean = (Authors) context.lookup(Authors.class.getName());

      This results in a NameNotFoundException from the second line.

      I've used the JMXConsole & cant see the Authors class bound to the JNDI tree (this could be me not using the console correctly)

      JBoss seems to start up normally...

      17:11:55,905 INFO [A] Bound to JNDI name: queue/A
      17:11:55,905 INFO [B] Bound to JNDI name: queue/B
      17:11:55,915 INFO [C] Bound to JNDI name: queue/C
      17:11:55,915 INFO [D] Bound to JNDI name: queue/D
      17:11:55,915 INFO [ex] Bound to JNDI name: queue/ex
      17:11:55,995 INFO [testTopic] Bound to JNDI name: topic/testTopic
      17:11:55,995 INFO [securedTopic] Bound to JNDI name: topic/securedTopic
      17:11:55,995 INFO [testDurableTopic] Bound to JNDI name: topic/testDurableTopic
      17:11:56,005 INFO [testQueue] Bound to JNDI name: queue/testQueue
      17:11:56,105 INFO [UILServerILService] JBossMQ UIL service available at : /
      17:11:56,175 INFO [DLQ] Bound to JNDI name: queue/DLQ
      17:11:56,596 INFO [ConnectionFactoryBindingService] Bound connection factory for resource adapter for ConnectionManager
       'jboss.jca:service=ConnectionFactoryBinding,name=JmsXA to JNDI name 'java:JmsXA'
      17:11:56,756 INFO [TomcatDeployer] deploy, ctxPath=/authors-web, warUrl=file:/C:/tools/jboss-4.0.2/server/default/tmp/d
      17:11:57,026 INFO [TomcatDeployer] deploy, ctxPath=/jmx-console, warUrl=file:/C:/tools/jboss-4.0.2/server/default/deplo
      17:11:57,547 INFO [Http11Protocol] Starting Coyote HTTP/1.1 on http-
      17:11:57,858 INFO [ChannelSocket] JK: ajp13 listening on /
      17:11:57,898 INFO [JkMain] Jk running ID=0 time=0/110 config=null
      17:11:57,918 INFO [Server] JBoss (MX MicroKernel) [4.0.2 (build: CVSTag=JBoss_4_0_2 date=200505022023)] Started in 22s:

      So I'm not a little suck.

      The Author Class looks ok...

      import java.util.List;
      import javax.ejb.Remote;
      public interface Authors {
       public List<Author> getAllAuthors();
       public Author addAuthor (String name);
       public void addArticle(Author author, String title, String body);

      The war file contains on the Servlet, the ejb3 file contains all the other classes.

      I'm using...


      Can someone suggest some ideas of what I'm doing wrong?

        • 1. Re: EJB3.0 - trailblazer - context.lookup results in NameNot
          Jeff Newbie

          Ok, Im sure the Bean is not registered in th JNDI tree.

          java: Namespace
           +- XAConnectionFactory (class: org.jboss.mq.SpyXAConnectionFactory)
           +- DefaultDS (class: javax.sql.DataSource)
           +- SecurityProxyFactory (class: org.jboss.security.SubjectSecurityProxyFactory)
           +- DefaultJMSProvider (class: org.jboss.jms.jndi.JNDIProviderAdapter)
           +- comp (class: javax.naming.Context)
           +- JmsXA (class: org.jboss.resource.adapter.jms.JmsConnectionFactoryImpl)
           +- ConnectionFactory (class: org.jboss.mq.SpyConnectionFactory)
           +- jaas (class: javax.naming.Context)
           | +- JmsXARealm (class: org.jboss.security.plugins.SecurityDomainContext)
           | +- jbossmq (class: org.jboss.security.plugins.SecurityDomainContext)
           | +- HsqlDbRealm (class: org.jboss.security.plugins.SecurityDomainContext)
           +- timedCacheFactory (class: javax.naming.Context)
          Failed to lookup: timedCacheFactory, errmsg=org.jboss.util.TimedCachePolicy
           +- TransactionPropagationContextExporter (class: org.jboss.tm.TransactionPropagationContextFactory)
           +- StdJMSPool (class: org.jboss.jms.asf.StdServerSessionPoolFactory)
           +- Mail (class: javax.mail.Session)
           +- TransactionPropagationContextImporter (class: org.jboss.tm.TransactionPropagationContextImporter)
           +- TransactionManager (class: org.jboss.tm.TxManager)

          As you can see there is nothing under "comp",which is where I'm expecting it to appear.

          This leads me to possibilities that its not being generated correctly or JBoss is not setup correctly.

          • 2. Re: EJB3.0 - trailblazer - context.lookup results in NameNot
            Jeff Newbie

            OK. Status update...

            My code works with..


            But not with...


            So inshort, the bean only gets registered on 4.0.3RC1

            Any ideas people?

            I'm aware the EJB3.0 install doc tell me to install the EJB3.0RC1 files into the All directory. Placing them in default doesnt seem to make a difference on JBossRC2.

            • 3. Re: EJB3.0 - trailblazer - context.lookup results in NameNot
              Jeff Newbie

              OK. Status update...

              I now have it working with

              I've deployed author-web.war & author-beans.ejb3 into the ALL container.
              The same container that has the EJB3.0 files placed in it (via the instructions for EJB3.0RC1)

              Then started JBoss via the command

              run.bat -c all

              JBoss 4.0.2 Portal will be a different matter since it doesnt have an ALL container.