2 Replies Latest reply on Feb 22, 2002 12:06 AM by jbossobj

    javax.naming.ServiceUnavailableException

    epotvin

      Hi!
      I'm a newbie with JBoss and with EJB in general, and I have some trouble...

      When I run a client class from my server machine, everything is fine, but when I want to connect with a remote machine, I have this error :

      p.s.: my jndi.properties is at the end

      --------------------------------------------

      javax.naming.CommunicationException. Root exception is java.rmi.ConnectException: Connection refused to host: 127.0.0.1; nested exception is:
      java.net.ConnectException: Connection refused: connect

      java.net.ConnectException: Connection refused: connect

      at java.net.PlainSocketImpl.socketConnect(Native Method)

      at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:323)

      at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:136)

      at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:123)

      at java.net.Socket.(Socket.java:273)

      at java.net.Socket.(Socket.java:100)

      at sun.rmi.transport.proxy.RMIDirectSocketFactory.createSocket(RMIDirectSocketFactory.java:25)

      at sun.rmi.transport.proxy.RMIMasterSocketFactory.createSocket(RMIMasterSocketFactory.java:120)

      at sun.rmi.transport.tcp.TCPEndpoint.newSocket(TCPEndpoint.java:499)

      at sun.rmi.transport.tcp.TCPChannel.createConnection(TCPChannel.java:190)

      at sun.rmi.transport.tcp.TCPChannel.newConnection(TCPChannel.java:174)

      at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:83)

      at org.jnp.server.NamingServer_Stub.lookup(Unknown Source)

      at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:349)

      at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:333)

      at javax.naming.InitialContext.lookup(InitialContext.java:350)

      at org.jboss.docs.interest.InterestClient.main(InterestClient.java:33)

      -----------------------------------------------
      jndi.properties

      java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory
      java.naming.provider.url=192.168.101.158:1099
      java.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces

        • 1. Re: javax.naming.ServiceUnavailableException
          raghav75

          hai,

          here is the suggestion from me

          add this piece of code in ur java file

          Properties p = new Properties();

          p.setProperty("java.naming.factory.initial","org.jnp.interfaces.NamingContextFactory");
          p.setProperty("java.naming.provider.url","jnp://" + serverHost + ":" + serverPort);
          ctx= new InitialContext(p);
          BeanHome home= (BeanHome)ctx.lookup(beanName);
          for ex:customerBean

          CustomerHome home = (CustomerHome)ctx.lookup(CustomerHome);

          here port no is 1099
          and serverhost is ur host id

          • 2. Re: javax.naming.ServiceUnavailableException
            jbossobj

            Hello,

            I'm having sort of the same problem but trying to run from a client on the server. I have yet to try this to see if it works. Thank you for the workaround!

            However, coding it this way defeats the purpose. So can anyone illuminate me on the best way to get this working!

            TIA.