2 Replies Latest reply on Apr 6, 2007 2:47 PM by JOURNADE Valerie

    Pb with EJB Client(javax.naming.CommunicationException)

    JOURNADE Valerie Newbie

      I use JBoss 4.0.5 with the installer and option EJB3. I'm getting the error:

      Failed to initalize plugin: org.jboss.logging.Log4jLoggerPlugin@1a758cb, cause: org/apache/log4j/LogManager
      javax.naming.CommunicationException: Could not obtain connection to any of these urls: localhost:8080 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 retrieve stub from server localhost:8080 [Root exception is java.io.EOFException]]
       at org.jnp.interfaces.NamingContext.checkRef(NamingContext.java:1414)
       at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:594)
       at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:587)
       at javax.naming.InitialContext.lookup(Unknown Source)
       at client.ClientPremierEJB3.main(ClientPremierEJB3.java:14)
      Caused by: javax.naming.CommunicationException: Failed to retrieve stub from server localhost:8080 [Root exception is java.io.EOFException]
       at org.jnp.interfaces.NamingContext.getServer(NamingContext.java:263)
       at org.jnp.interfaces.NamingContext.checkRef(NamingContext.java:1385)
       ... 4 more
      Caused by: java.io.EOFException
       at java.io.ObjectInputStream$PeekInputStream.readFully(Unknown Source)
       at java.io.ObjectInputStream$BlockDataInputStream.readShort(Unknown Source)
       at java.io.ObjectInputStream.readStreamHeader(Unknown Source)
       at java.io.ObjectInputStream.<init>(Unknown Source)
       at org.jnp.interfaces.NamingContext.getServer(NamingContext.java:250)
       ... 5 more


      For your information :
      - my Interface:
      @Remote
      public interface PremierEJB3 {
       public String ditBonjour(String aQui);
      }


      - My Bean:
      @Stateless
      public class PremierEJB3Bean implements PremierEJB3{
       public String ditBonjour(String aQui) {
       return "Réponse EJB Bean : Bonjour, "+aQui+" !!!";
      }}


      -my jndi.properties:
      java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory
      java.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces
      java.naming.provider.url=localhost:8080


      - my client:
      public class ClientPremierEJB3 {
      
       public static void main(String[] args) {
       try {
       Context context = new InitialContext();
       PremierEJB3 beanRemote = (PremierEJB3) context.lookup("ejbSession.PremierEJB3Bean/remote");
       System.out.println(beanRemote.ditBonjour("Julie ma princesse"));
       } catch (NamingException e) {e.printStackTrace();}
       }
      }


      Please, i need help, i don't understand what i can do.... Thanks