java.lang.ClassCastException: $Proxy81
vedgunjan Apr 26, 2006 7:55 AMHi All,
I?m new to EJB3.0 and JBoss so struggling with all the strartup problems.
I have a session bean, which I?m testing but I?m not able to get the remote reference through JNDI lookup.
Heres?s my components
@Remote
public interface UserService extends Serializable {
public User findUser(String userName);
public boolean addUser(String userName, String firstName, String lastName);
}
--------------------------------------------------------------------------------------
Session Bean
@Stateless
@Remote(UserService.class)
public class UserServiceImpl implements UserService {
???
??..
}
--------------------------------------------------------------------------------------
This is the class which gets called from the JSP and is the client in this case.
Both EJB and web are running in the same instance of of JBoss
public class AuthenticationDelegate {
public static AuthenticationDelegate authenticationDelegate = null;
private static @EJB UserService userSvc;
??????????
??????????
Context context = new InitialContext();
String className = context.lookup("UserServiceImpl/remote").getClass().getName();
userSvc = (UserService)context.lookup("UserServiceImpl/remote"); //ejb-name
System.out.println("-->> lookup object successfully");
????
???????..
}
--------------------------------------------------------------------------------------
Im getting this exception
java.lang.ClassCastException: $Proxy81
at com.demo.delegate.AuthenticationDelegate.(AuthenticationDelegate.java:55)
at com.demo.delegate.AuthenticationDelegate.getAuthenticationDelegate(AuthenticationDelegate.java:86)
at com.demo.UserBean.executeCommand(UserBean.java:47)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at com.sun.faces.el.MethodBindingImpl.invoke(MethodBindingImpl.java:126)
at com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:72)
at javax.faces.component.UICommand.broadcast(UICommand.java:312)
at javax.faces.component.UIViewRoot.broadcastEvents(UIViewRoot.java:267)
at javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:381)
at com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:75)
at com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:200)
at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:90)
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:197)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
at org.jboss.web.tomcat.security.CustomPrincipalValve.invoke(CustomPrincipalValve.java:54)
at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:174)
at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:74)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)
at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664)
at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
at org.apache.tomcat.util.net.MasterSlaveWorkerThread.run(MasterSlaveWorkerThread.java:112)
at java.lang.Thread.run(Thread.java:595)
.
--------------------------------------------------------------------------------------
I don?t have any jboss.xml or any other configuration xml files as I suppose we don?t need those with EJB3.0.
Any help would be greatly appreciated
Thanks
Ved