3 Replies Latest reply on Dec 30, 2007 1:28 PM by pslambh

    Jboos Lookup

    pslambh

      Hello!

      I have a problem. I have developed a Bean and deployed it with RedHatDeveloper Studio. If I look at the managed Bean JNDIView, I am able to see the Bean under the global JNDI Section. I have developed a client programm that accesses the bean, but I get allways an exception if I try to access the bean. What can I do?

      There is the client source code:
      Properties jndiProps = new Properties();
      jndiProps.setProperty(Context.INITIAL_CONTEXT_FACTORY,
      "org.jnp.interfaces.NamingContextFactory");
      jndiProps.setProperty(Context.URL_PKG_PREFIXES,
      "org.jboss.naming:org.jnp.interface");
      jndiProps.setProperty(Context.PROVIDER_URL, "jnp://jboss-server:1099");
      InitialContext txt = new InitialContext(jndiProps);
      System.out.println(txt);
      System.out.println(txt.lookup("SubBean/local"));

      And the Name of the bean in the global JNDI is:
      SubBean *
      -local
      best regards

        • 1. Re: Jboos Lookup
          jaikiran

          Which version of JBoss are you using? Is your client a standalone java class? Post the entire exception stacktrace and also the exact contents of the JNDI tree as you see from the jmx-console.

          • 2. Re: Jboos Lookup
            pslambh

            Jboss version is 4.2.0

            JNDI Tree:
            +- TopicConnectionFactory (class: org.jboss.naming.LinkRefPair)
            +- jmx (class: org.jnp.interfaces.NamingContext)
            | +- invoker (class: org.jnp.interfaces.NamingContext)
            | | +- RMIAdaptor (proxy: $Proxy48 implements interface org.jboss.jmx.adaptor.rmi.RMIAdaptor,interface org.jboss.jmx.adaptor.rmi.RMIAdaptorExt)
            | +- rmi (class: org.jnp.interfaces.NamingContext)
            | | +- RMIAdaptor[link -> jmx/invoker/RMIAdaptor] (class: javax.naming.LinkRef)
            +- HTTPXAConnectionFactory (class: org.jboss.mq.SpyXAConnectionFactory)
            +- ConnectionFactory (class: org.jboss.mq.SpyConnectionFactory)
            +- Bean (class: org.jnp.interfaces.NamingContext)
            | +- local (proxy: $Proxy131 implements interface beans.BeanBusiness,interface org.jboss.ejb3.JBossProxy,interface javax.ejb.EJBLocalObject)
            +- UserTransactionSessionFactory (proxy: $Proxy14 implements interface org.jboss.tm.usertx.interfaces.UserTransactionSessionFactory)
            +- HTTPConnectionFactory (class: org.jboss.mq.SpyConnectionFactory)
            +- XAConnectionFactory (class: org.jboss.mq.SpyXAConnectionFactory)
            +- TransactionSynchronizationRegistry (class: com.arjuna.ats.internal.jta.transaction.arjunacore.TransactionSynchronizationRegistryImple)
            +- UserTransaction (class: org.jboss.tm.usertx.client.ClientUserTransaction)
            +- UILXAConnectionFactory[link -> XAConnectionFactory] (class: javax.naming.LinkRef)
            +- XMlBean (class: org.jnp.interfaces.NamingContext)
            | +- remote (proxy: $Proxy93 implements interface slsb.XMl,interface org.jboss.ejb3.JBossProxy,interface javax.ejb.EJBObject)
            +- UIL2XAConnectionFactory[link -> XAConnectionFactory] (class: javax.naming.LinkRef)
            +- GreetingBean (class: org.jnp.interfaces.NamingContext)
            | +- local (proxy: $Proxy89 implements interface slsb.Greeting,interface org.jboss.ejb3.JBossProxy,interface javax.ejb.EJBLocalObject)
            +- 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)
            +- topic (class: org.jnp.interfaces.NamingContext)
            | +- testDurableTopic (class: org.jboss.mq.SpyTopic)
            | +- testTopic (class: org.jboss.mq.SpyTopic)
            | +- securedTopic (class: org.jboss.mq.SpyTopic)
            +- console (class: org.jnp.interfaces.NamingContext)
            | +- PluginManager (proxy: $Proxy49 implements interface org.jboss.console.manager.PluginManagerMBean)
            +- UIL2ConnectionFactory[link -> ConnectionFactory] (class: javax.naming.LinkRef)
            +- HiLoKeyGeneratorFactory (class: org.jboss.ejb.plugins.keygenerator.hilo.HiLoKeyGeneratorFactory)
            +- UILConnectionFactory[link -> ConnectionFactory] (class: javax.naming.LinkRef)
            +- SubBean (class: org.jnp.interfaces.NamingContext)
            | +- local (proxy: $Proxy134 implements interface beans.SubBeanInterface,interface org.jboss.ejb3.JBossProxy,interface javax.ejb.EJBLocalObject)
            +- QueueConnectionFactory (class: org.jboss.naming.LinkRefPair)
            +- UUIDKeyGeneratorFactory (class: org.jboss.ejb.plugins.keygenerator.uuid.UUIDKeyGeneratorFactory)

            Stacktrace:
            javax.naming.InitialContext@b6ece5
            log4j:WARN No appenders could be found for logger (org.jnp.interfaces.NamingContext).
            log4j:WARN Please initialize the log4j system properly.
            Exception in thread "main" javax.naming.CommunicationException: Could not obtain connection to any of these urls: jboss-server:1099 and discovery failed with error: javax.naming.CommunicationException: Receive timed out [Root exception is java.net.SocketTimeoutException: Receive timed out] [Root exception is javax.naming.CommunicationException: Failed to connect to server jboss-server:1099 [Root exception is javax.naming.ServiceUnavailableException: Failed to connect to server jboss-server:1099 [Root exception is java.net.UnknownHostException: jboss-server]]]
            at org.jnp.interfaces.NamingContext.checkRef(NamingContext.java:1416)
            at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:596)
            at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:589)
            at javax.naming.InitialContext.lookup(Unknown Source)
            at Main.main(Main.java:16)
            Caused by: javax.naming.CommunicationException: Failed to connect to server jboss-server:1099 [Root exception is javax.naming.ServiceUnavailableException: Failed to connect to server jboss-server:1099 [Root exception is java.net.UnknownHostException: jboss-server]]
            at org.jnp.interfaces.NamingContext.getServer(NamingContext.java:269)
            at org.jnp.interfaces.NamingContext.checkRef(NamingContext.java:1387)
            ... 4 more
            Caused by: javax.naming.ServiceUnavailableException: Failed to connect to server jboss-server:1099 [Root exception is java.net.UnknownHostException: jboss-server]
            at org.jnp.interfaces.NamingContext.getServer(NamingContext.java:243)
            ... 5 more
            Caused by: java.net.UnknownHostException: jboss-server
            at java.net.Inet6AddressImpl.lookupAllHostAddr(Native Method)
            at java.net.InetAddress$1.lookupAllHostAddr(Unknown Source)
            at java.net.InetAddress.getAddressFromNameService(Unknown Source)
            at java.net.InetAddress.getAllByName0(Unknown Source)
            at java.net.InetAddress.getAllByName(Unknown Source)
            at java.net.InetAddress.getAllByName(Unknown Source)
            at java.net.InetAddress.getByName(Unknown Source)
            at org.jnp.interfaces.TimedSocketFactory.createSocket(TimedSocketFactory.java:76)
            at org.jnp.interfaces.NamingContext.getServer(NamingContext.java:239)
            ... 5 more


            And the Client is a standalone client.

            Thanks

            • 3. Re: Jboos Lookup
              pslambh

              Thanks for the help, but I have found the problem.