1 Reply Latest reply on Oct 5, 2006 1:16 PM by Peter Johnson

    Client Application-NoclassDefFoundError

    raghu gottimukkala Newbie

      HI

      I am deploying EJB application in JBoss. When i am Compiling the Client application for EJB i am getting the below error

      Got
      Exception in thread "main" java.lang.NoClassDefFoundError: org/jboss/logging/Log
      ger
      at org.jnp.interfaces.NamingContext.(NamingContext.java:158)
      at org.jnp.interfaces.NamingContextFactory.getInitialContext(NamingConte
      xtFactory.java:56)
      at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:6
      67)
      at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:247
      )
      at javax.naming.InitialContext.init(InitialContext.java:223)
      at javax.naming.InitialContext.(InitialContext.java:197)
      at BeanClient.main(BeanClient.java:16)


      Code for the Application class is

      import javax.naming.*;
      import javax.rmi.PortableRemoteObject;
      import java.util.Properties;
      import com.brainysoftware.ejb.Adder;
      import com.brainysoftware.ejb.AdderHome;
      public class BeanClient {
      public static void main(String[] args) {
      // preparing properties for constructing an InitialContext object
      Properties properties = new Properties();
      properties.put(Context.INITIAL_CONTEXT_FACTORY,
      "org.jnp.interfaces.NamingContextFactory");
      properties.put(Context.PROVIDER_URL, "localhost:1099");
      System.out.println("Got");
      try {
      // Get an initial context
      InitialContext jndiContext = new InitialContext(properties);
      System.out.println("Got context");
      // Get a reference to the Bean
      Object ref = jndiContext.lookup("Adder");
      System.out.println("Got reference");
      // Get a reference from this to the Bean's Home interface
      AdderHome home = (AdderHome)
      PortableRemoteObject.narrow (ref, AdderHome.class);
      // Create an Adder object from the Home interface
      Adder adder = home.create();
      System.out.println ("2 + 5 = " + adder.add(2, 5));
      }
      catch(Exception e) {
      System.out.println(e.toString());
      }
      }
      }