[jboss-user] [EJB 3.0 Users] - Re: JBoss 4.2.1 RemoteEJB Lookup ClassCastException

kyle.bober do-not-reply at jboss.com
Thu Nov 12 14:47:19 EST 2009


So I modified my code as you stated by injecting the RemoteEJB interface using @EJB like so:


  | @EJB(mappedName=ICustomizationRemote.EJB_JNDI)
  | ICustomizationRemote theCustomizationService;
  | 

I now see the following exception. 


  | com.thesearchagency.mms.service.user.UserException: Non matching type for inject of field: com.thesearchagency.mms.service.customization.ICustomizationRemote com.thesearchagency.mms.service.user.impl.UserEJB.theCustomizationService for type: $Proxy164 of jndiName env/com.thesearchagency.mms.service.user.impl.UserEJB/theCustomizationService
  | intfs: , com.thesearchagency.mms.service.customization.ICustomizationRemote, org.jboss.ejb3.JBossProxy, javax.ejb.EJBObject; nested exception is: 
  | 	java.lang.RuntimeException: Non matching type for inject of field: com.thesearchagency.mms.service.customization.ICustomizationRemote com.thesearchagency.mms.service.user.impl.UserEJB.theCustomizationService for type: $Proxy164 of jndiName env/com.thesearchagency.mms.service.user.impl.UserEJB/theCustomizationService
  | intfs: , com.thesearchagency.mms.service.customization.ICustomizationRemote, org.jboss.ejb3.JBossProxy, javax.ejb.EJBObject
  | 	at com.thesearchagency.mms.service.user.impl.UserWS.login(UserWS.java:36)
  | 	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 org.jboss.ws.core.server.ServiceEndpointInvokerJSE.invokeServiceEndpointInstance(ServiceEndpointInvokerJSE.java:104)
  | 	at org.jboss.ws.core.server.AbstractServiceEndpointInvoker.invoke(AbstractServiceEndpointInvoker.java:207)
  | 	at org.jboss.ws.core.server.ServiceEndpoint.processRequest(ServiceEndpoint.java:212)
  | 	at org.jboss.ws.core.server.ServiceEndpointManager.processRequest(ServiceEndpointManager.java:448)
  | 	at org.jboss.ws.core.server.AbstractServiceEndpointServlet.doPost(AbstractServiceEndpointServlet.java:114)
  | 	at javax.servlet.http.HttpServlet.service(HttpServlet.java:710)
  | 	at org.jboss.ws.core.server.AbstractServiceEndpointServlet.service(AbstractServiceEndpointServlet.java:75)
  | 	at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
  | 	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
  | 	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
  | 	at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
  | 	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
  | 	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
  | 	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230)
  | 	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
  | 	at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:179)
  | 	at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:84)
  | 	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
  | 	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:104)
  | 	at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:157)
  | 	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
  | 	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:241)
  | 	at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
  | 	at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:580)
  | 	at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
  | 	at java.lang.Thread.run(Thread.java:595)
  | Caused by: java.lang.RuntimeException: Non matching type for inject of field: com.thesearchagency.mms.service.customization.ICustomizationRemote com.thesearchagency.mms.service.user.impl.UserEJB.theCustomizationService for type: $Proxy164 of jndiName env/com.thesearchagency.mms.service.user.impl.UserEJB/theCustomizationService
  | intfs: , com.thesearchagency.mms.service.customization.ICustomizationRemote, org.jboss.ejb3.JBossProxy, javax.ejb.EJBObject
  | 	at org.jboss.injection.JndiFieldInjector.inject(JndiFieldInjector.java:127)
  | 	at org.jboss.injection.JndiFieldInjector.inject(JndiFieldInjector.java:105)
  | 	at org.jboss.injection.JndiFieldInjector.inject(JndiFieldInjector.java:62)
  | 	at org.jboss.ejb3.AbstractPool.create(AbstractPool.java:111)
  | 	at org.jboss.ejb3.ThreadlocalPool.get(ThreadlocalPool.java:61)
  | 	at org.jboss.ejb3.stateless.StatelessInstanceInterceptor.invoke(StatelessInstanceInterceptor.java:54)
  | 	at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
  | 	at org.jboss.aspects.security.AuthenticationInterceptor.invoke(AuthenticationInterceptor.java:77)
  | 	at org.jboss.ejb3.security.Ejb3AuthenticationInterceptor.invoke(Ejb3AuthenticationInterceptor.java:106)
  | 	at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
  | 	at org.jboss.ejb3.ENCPropagationInterceptor.invoke(ENCPropagationInterceptor.java:46)
  | 	at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
  | 	at org.jboss.ejb3.asynchronous.AsynchronousInterceptor.invoke(AsynchronousInterceptor.java:106)
  | 	at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
  | 	at org.jboss.ejb3.stateless.StatelessContainer.dynamicInvoke(StatelessContainer.java:278)
  | 	at org.jboss.ejb3.remoting.IsLocalInterceptor.invokeLocal(IsLocalInterceptor.java:79)
  | 	at org.jboss.ejb3.remoting.IsLocalInterceptor.invoke(IsLocalInterceptor.java:70)
  | 	at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
  | 	at org.jboss.ejb3.stateless.StatelessRemoteProxy.invoke(StatelessRemoteProxy.java:103)
  | 	at $Proxy178.login(Unknown Source)
  | 	at com.thesearchagency.mms.service.user.impl.UserWS.login(UserWS.java:27)
  | 	... 30 more
  | Caused by: java.lang.IllegalArgumentException
  | 	at sun.reflect.UnsafeObjectFieldAccessorImpl.set(UnsafeObjectFieldAccessorImpl.java:63)
  | 	at java.lang.reflect.Field.set(Field.java:656)
  | 	at org.jboss.injection.JndiFieldInjector.inject(JndiFieldInjector.java:115)
  | 	... 50 more

Which is a much better sign then the ClassCastException :) What exactly does the mappedName parameter refer too? 

I have the following in my EJB Implementation class:


  | @Stateless
  | @LocalBinding(jndiBinding=ICustomizationLocal.EJB_JNDI)
  | @RemoteBinding(jndiBinding=ICustomizationRemote.EJB_JNDI)
  | @Interceptors(SpringBeanAutowiringInterceptor.class)
  | @XmlTransient
  | public class CustomizationEJB implements ICustomizationLocal, ICustomizationRemote {	
  | 


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

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



More information about the jboss-user mailing list