1 Reply Latest reply on Dec 28, 2006 8:17 AM by Ramanuj Bhardwaj

    java.lang.NoClassDefFoundError: java.net.SocketAddress

    Praveen Kumar Newbie

      Hi All,

      I have created a Stateless Session Bean, which contains a function called info. Now when i am trying to call the same unction using my client, here is the code of the client class:
      package Samplemypackage1;
      import java.util.Hashtable;
      import javax.naming.Context;
      import javax.naming.InitialContext;
      import javax.rmi.PortableRemoteObject;
      import mypackage1.MySessionEJB;
      import mypackage1.MySessionEJBHome;
      import javax.naming.NamingException;

      public class MySessionEJBClient
      {
      public static void main(String [] args)
      {
      MySessionEJBClient mySessionEJBClient = new MySessionEJBClient();
      try
      {
      Hashtable env = new Hashtable();

      env.put(Context.INITIAL_CONTEXT_FACTORY, "org.jnp.interfaces.NamingContextFactory");
      env.put(Context.PROVIDER_URL, "jnp://localhost:1099");
      env.put(Context.URL_PKG_PREFIXES, "org.jboss.naming:org.jnp.interfaces" );

      Context ctx = new InitialContext(env);
      MySessionEJBHome mySessionEJBHome = (MySessionEJBHome)ctx.lookup("MySessionEJB");
      MySessionEJB mySessionEJB = mySessionEJBHome.create( );
      mySessionEJB.info();
      }
      catch(Throwable ex)
      {
      ex.printStackTrace();
      }
      }
      }


      I gets the follwoing error message:

      java.lang.NoClassDefFoundError: java.net.SocketAddress

      javax.naming.Context org.jnp.interfaces.NamingContextFactory.getInitialContext(java.util.Hashtable)

      NamingContextFactory.java:41

      javax.naming.Context javax.naming.spi.NamingManager.getInitialContext(java.util.Hashtable)

      NamingManager.java:665

      javax.naming.Context javax.naming.InitialContext.getDefaultInitCtx()

      InitialContext.java:246

      void javax.naming.InitialContext.init(java.util.Hashtable)

      InitialContext.java:222

      void javax.naming.InitialContext.(java.util.Hashtable)

      InitialContext.java:198

      void Samplemypackage1.MySessionEJBClient.main(java.lang.String[])

      MySessionEJBClient.java:23

      I even tried with:
      env.put(Context.PROVIDER_URL, "localhost");

      Its not working...can anyone please help...its very very urgent....

      Thanks to All in Advance...

        • 1. Re: java.lang.NoClassDefFoundError: java.net.SocketAddress
          Ramanuj Bhardwaj Newbie

          Hi,

          Does anyone knows about this error:

          java.lang.NoClassDefFoundError: java/net/SocketAddress at org.jnp.interfaces.NamingContextFactory.getInitialContext(NamingContextFactory.java:41) at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:665) at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:246) at javax.naming.InitialContext.init(InitialContext.java:222) at javax.naming.InitialContext.(InitialContext.java:198) at

          Any kind of input is welcome, please respond as soon as possible.