[jboss-user] [EJB 3.0] - Access an EJB from a servlet

NameZero912 do-not-reply at jboss.com
Thu Mar 20 09:50:43 EDT 2008


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! :)

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4138046#4138046

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4138046



More information about the jboss-user mailing list