0 Replies Latest reply on Jan 27, 2005 5:26 AM by Chris Hall

    What am I doing wrong with jnp/jndi?

    Chris Hall Newbie

      Hi all,

      I've managed to get the Fibo application installed and running and all is fine with that, but now I want to try and access the Fibo EJB from a client and I am having a problem referencing it, the jmx-console output looks like this:

      Global JNDI Namespace
      
       +- XAConnectionFactory (class: org.jboss.mq.SpyXAConnectionFactory)
       +- UIL2ConnectionFactory[link -> ConnectionFactory] (class: javax.naming.LinkRef)
       +- UserTransactionSessionFactory (proxy: $Proxy11 implements interface org.jboss.tm.usertx.interfa
      ces.UserTransactionSessionFactory,interface org.jboss.proxy.IClientContainer)
       +- HTTPConnectionFactory (class: org.jboss.mq.SpyConnectionFactory)
       +- console (class: org.jnp.interfaces.NamingContext)
       | +- PluginManager (proxy: $Proxy36 implements interface org.jboss.console.manager.PluginManager
      MBean)
       +- UIL2XAConnectionFactory[link -> XAConnectionFactory] (class: javax.naming.LinkRef)
       +- UUIDKeyGeneratorFactory (class: org.jboss.ejb.plugins.keygenerator.uuid.UUIDKeyGeneratorFactory
      )
       +- HTTPXAConnectionFactory (class: org.jboss.mq.SpyXAConnectionFactory)
       +- topic (class: org.jnp.interfaces.NamingContext)
       | +- testDurableTopic (class: org.jboss.mq.SpyTopic)
       | +- testTopic (class: org.jboss.mq.SpyTopic)
       | +- securedTopic (class: org.jboss.mq.SpyTopic)
       +- queue (class: org.jnp.interfaces.NamingContext)
       | +- A (class: org.jboss.mq.SpyQueue)
       | +- testQueue (class: org.jboss.mq.SpyQueue)
       | +- ex (class: org.jboss.mq.SpyQueue)
       | +- DLQ (class: org.jboss.mq.SpyQueue)
       | +- D (class: org.jboss.mq.SpyQueue)
       | +- C (class: org.jboss.mq.SpyQueue)
       | +- B (class: org.jboss.mq.SpyQueue)
       +- ConnectionFactory (class: org.jboss.mq.SpyConnectionFactory)
       +- UserTransaction (class: org.jboss.tm.usertx.client.ClientUserTransaction)
       +- ejb (class: org.jnp.interfaces.NamingContext)
       | +- Fido (proxy: $Proxy51 implements interface org.jboss.proxy.IClientContainer,interface tutor
      ial.interfaces.FidoHome,interface javax.ejb.Handle)
      



      (I know it says Fido, I misread the tutorial but it does work)

      and now I have a client looking like this:
      
      public class TestClient
      {
      
       public static void main(String[] args) throws Exception
       {
       Hashtable props = new Hashtable();
       props.put(Context.INITIAL_CONTEXT_FACTORY, "org.jnp.interfaces.NamingContextFactory");
       props.put(Context.URL_PKG_PREFIXES, "org.jboss.naming:org.jnp.interfaces");
       props.put(Context.PROVIDER_URL, "jnp://localhost:1099");
       Context ctx = new InitialContext(props);
       System.out.println("Here");
       ctx.lookup("ejb/Fido");
       System.out.println("Here");
       }
      
      }
      



      But this just hangs, I get one 'Here' output on stdout and the nothing else.

      Am I right in thinking that I should be able to access this EJB? It is in the global namespace - what am I doing wrong?

      I have also tried every combination I can think of in the ctx.lookup() to no avail, I'd have thought I should have got a not bound error if I tried to look up something non-existent - I don't think lookup should hang.

      I'm running JBoss 4.0.1 (which is completely unaltered from the initial unpacking) with Sun's jdk1.5.0 on Gentoo (2.6.8-r3)

      Any help appreciated.

      Many thanks
      Chris.