4 Replies Latest reply on Jan 12, 2006 8:24 PM by Bill Burke

    How to make a simple EJB 3.0 client?

    Fabricio Braga Newbie

      Hello,

      I'm trying to create a simples stand alone EJB 3.0 client but it jut don't work.

      The client woks fine when running on Servet class, but when running a class with public static void main it does not work.

      I'm doing something like this:



      public class SimpleClient {
       public static void main(String...args) throws Exception {
      
       Hashtable t = new Hashtable();
       t.put(Context.INITIAL_CONTEXT_FACTORY, "org.jnp.interfaces.NamingContextFactory");
       t.put(Context.PROVIDER_URL, "localhost");
      
      
       Context ic = new InitialContext(t);
       ProjectService projetService = (ProjectService) ic.lookup( SaqueHome.class.getName());
      
       }
      }
      


      And I got a ClassCastException: Proxy0

      What am I doing wrong? Can anyone help me to wirte a simple EJB 3.0 client?

      Thanks,
      Fabricio Braga