2 Replies Latest reply on Mar 20, 2008 11:28 AM by Marius Shekow

    Access an EJB from a servlet

    Marius Shekow Newbie

      Hello. Up to now I was able to access a EJB from a pure Java client with code similar to this one:

      Context context = new InitialContext();
      MyBeanRemote beanRemote = (MyBeanRemote)context.lookup("MyBean/remote");

      But how do I access an EJB from a servlet? Please note that the code above is NOT working within a servlet (at least not here) !! It will throw this exception:
      java.lang.ClassCastException: $Proxy141 cannot be cast to com.myself.MyBeanRemote

      Any help is appreciated! :)