2 Replies Latest reply on Aug 24, 2007 10:25 AM by ghosh007

    Basic EJB3 with JBOSS

    ghosh007

      I have jboss 4.2.1 GA with Eclipse 5.5 and trying to run the calculator example given on the jboss site. I have created the bin and here is my client:
      public static void main(String[] args) {
      try {


      Context context=new InitialContext();
      AdviceRemote bean = ( AdviceRemote) context.lookup("com.andy.ejb3.AdviceRemote/remote");
      System.err.println(bean.getAdvice());
      } catch (NamingException e) {
      e.printStackTrace();
      }

      javax.naming.NoInitialContextException: Need to specify class name in environment or system property, or as an applet parameter, or in an application resource file: java.naming.factory.initial

      If I use something like,

      properties.put("java.naming.factory.initial","org.jnp.interfaces.NamingContextFactory");
      properties.put("java.naming.factory.url.pkgs","=org.jboss.naming:org.jnp.interfaces");
      properties.put("java.naming.provider.url","localhost:1099");

      Context context=new InitialContext(properties);

      I get:
      javax.naming.NoInitialContextException: Cannot instantiate class: org.jnp.interfaces.NamingContextFactory [Root exception is java.lang.ClassNotFoundException:


      Please help!