0 Replies Latest reply on Nov 2, 2017 5:43 AM by SW Charles

    JBoss ClassCast Exception

    SW Charles Newbie

      When I try to cast a class, that I looked up, it gives me following exceptioN:

       

      10:14:13,065 ERROR [[WEUserService]] Servlet.service() for servlet WEUserService threw exception

      java.lang.ClassCastException: $Proxy87 cannot be cast to coreserviceswe.ejb.weim.ManageProcessesLocal

              at rest.utils.UserServiceLocator.lookupWEUserService(UserServiceLocator.java:78)

              at rest.services.weuser.WEUserAPI1_0.serviceLinkageTest(WEUserAPI1_0.java:51)

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

              at org.glassfish.jersey.server.model.internal.ResourceMethodInvocationHandlerFactory$1.invoke(ResourceMethodInvocationHand

      lerFactory.java:81)

              at org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher$1.run(AbstractJavaResourceMethodDispatc

      her.java:151)

              at org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher.invoke(AbstractJavaResourceMethodDispat

      cher.java:171)

              at org.glassfish.jersey.server.model.internal.JavaResourceMethodDispatcherProvider$ResponseOutInvoker.doDispatch(JavaResou

      rceMethodDispatcherProvider.java:152)

              at org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher.dispatch(AbstractJavaResourceMethodDisp

      atcher.java:104)

              at org.glassfish.jersey.server.model.ResourceMethodInvoker.invoke(ResourceMethodInvoker.java:406)

              at org.glassfish.jersey.server.model.ResourceMethodInvoker.apply(ResourceMethodInvoker.java:350)

              at org.glassfish.jersey.server.model.ResourceMethodInvoker.apply(ResourceMethodInvoker.java:106)

              at org.glassfish.jersey.server.ServerRuntime$1.run(ServerRuntime.java:259)

              at org.glassfish.jersey.internal.Errors$1.call(Errors.java:271)

              at org.glassfish.jersey.internal.Errors$1.call(Errors.java:267)

              at org.glassfish.jersey.internal.Errors.process(Errors.java:315)

              at org.glassfish.jersey.internal.Errors.process(Errors.java:297)

              at org.glassfish.jersey.internal.Errors.process(Errors.java:267)

              at org.glassfish.jersey.process.internal.RequestScope.runInScope(RequestScope.java:319)

              at org.glassfish.jersey.server.ServerRuntime.process(ServerRuntime.java:236)

              at org.glassfish.jersey.server.ApplicationHandler.handle(ApplicationHandler.java:1028)

              at org.glassfish.jersey.servlet.WebComponent.service(WebComponent.java:373)

              at org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:381)

              at org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:344)

              at org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:219)

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

              at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:84)

              at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)

              at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)

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

              at org.apache.coyote.ajp.AjpProcessor.process(AjpProcessor.java:437)

              at org.apache.coyote.ajp.AjpProtocol$AjpConnectionHandler.process(AjpProtocol.java:366)

              at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:446)

              at java.lang.Thread.run(Thread.java:619)

       

       

      I am using Jersey in an EAR on the same JBoss to call my coreservice, as shown below:

      try {

                  InitialContext ctx = new InitialContext();

                  Object o = ctx.lookup("coreserviceswetemp/ManageServicesProcessesBean/local");

                

                  return (ManageServicesProcessesLocal) o;

              }

       

      The other coreserviceswetemp.ear is running on the same Jboss 4.2. and I got the client jar files included WEB-INF/lib of the calling ejb in the jersey-war (The error persists if i do it in EAR/LIB folder)

       

      The Called EJB:

      @Stateless

      @TransactionManagement(TransactionManagementType.CONTAINER)

      public class ManageServicesProcessesBean implements ManageServicesProcessesRemote,ManageServicesProcessesLocal {...

       

      The Local File:

      @Local

      public interface ManageServicesProcessesLocal extends ManageServicesProcesses {....

       

       

       

      Any ideas?

       

      thanks in regard