1 Reply Latest reply on Mar 29, 2009 7:42 AM by jaikiran

    How to access a stateless Bean from Java standalone client

    yhqian99

      Hello All,

      I am using MyEclipse5.5 + JBOSS to develop a stateless HelloEJB, after deployment, I can see the deployed bean from http://localhost:8080/jmx-console/.

      Then I use a standalone java client to access the EJB, but get the error of "javax.naming.NoInitialContextException: Cannot instantiate class: org.jnp.interfaces.NamingContextFactory [Root exception is java.lang.ClassNotFoundException: org.jnp.interfaces.NamingContextFactory]"


      Here is my code:

      package com;

      import javax.ejb.Stateless;

      @Stateless
      public class HelloEJB implements HelloEJBLocal, HelloEJBRemote
      {
      public HelloEJB()
      {
      }
      public String sayHello(String name)
      {
      return "Welcome, " + name + ", I am a stateless Session Bean";
      }
      }


      package com;

      import javax.ejb.Local;

      @Local
      public interface HelloEJBLocal
      {
      public String sayHello(String name);
      }

      package com;

      import javax.ejb.Remote;

      @Remote
      public interface HelloEJBRemote
      {
      public String sayHello(String name);
      }

      I have set the jbossall-client.jar to my java build path, is there anything I missed? Any help are highly apprieciated.

      Yhqian