title: ClassCastException: org.jboss.as.ee.component.BasicComponent cannot be cast to org.jboss.as.webservices.injection.WSComponent
body: <p>I get the following error, while automatically publishing the changes made to code. We use JRebel for class reload,</p>
  
  <p>I found a few stackoverflow and other links which recommended removing duplicate jars. My guess was probably the issue is due to the CXF library. I tried two approaches,</p>
  
  <p><strong>First Approach:</strong> Include a jboss-deployment-structure.xml, to exclude the apache cxf library.</p>
  
  <p>This didn't work for me as during deployment there were other errors that turned up, probably due to the WebService classes being declared in web.xml as servlets, and the application never comes up.</p>
  
  <p><strong>Second Approach:</strong> Specify apache cxf library scope as compile in Maven pom. The deployment is successful, but still the issue persists, on change of code and redeployment to JBoss.</p>
  
  <p>The application seems to work fine when there is no redeployment of classes by JRebel is involved. But I am not sure if this a JRebel tool issue or Jboss Classloading issue because of jars.</p>
  
  <p><em>Your help in pointing me in the right direction will be helpful. Please comment if you need further details.</em></p>
  
  <p><strong>Complete Stack Trace Below:</strong></p>
  
  <p>5:53:03,750 WARNING [org.apache.cxf.phase.PhaseInterceptorChain] (http-localhost/127.0.0.1:8080-1) Application {##########}iws#{##########}   createSubscriberXxxxxx has thrown exception, unwinding now: org.apache.cxf.interceptor.Fault: org.jboss.as.ee.component.BasicComponent cannot be cast to org.jboss.as.webservices.injection.WSComponent</p>
  
  <pre><code>   at org.apache.cxf.service.invoker.AbstractInvoker.createFault(AbstractInvoker.java:162)
  
     at org.apache.cxf.jaxws.AbstractJAXWSMethodInvoker.createFault(AbstractJAXWSMethodInvoker.java:213)
  
     at org.apache.cxf.service.invoker.AbstractInvoker.invoke(AbstractInvoker.java:128)
  
     at org.apache.cxf.jaxws.AbstractJAXWSMethodInvoker.invoke(AbstractJAXWSMethodInvoker.java:178)
  
     at org.apache.cxf.jaxws.JAXWSMethodInvoker.invoke(JAXWSMethodInvoker.java:66)
  
     at org.jboss.wsf.stack.cxf.JBossWSInvoker.invoke(JBossWSInvoker.java:129)
  
     at org.apache.cxf.interceptor.ServiceInvokerInterceptor$1.run(ServiceInvokerInterceptor.java:58)
  
     at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:439) [rt.jar:1.6.0_43]
  
     at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303) [rt.jar:1.6.0_43]
  
     at java.util.concurrent.FutureTask.run(FutureTask.java:138) [rt.jar:1.6.0_43]
  
     at org.apache.cxf.workqueue.SynchronousExecutor.execute(SynchronousExecutor.java:37)
  
     at org.apache.cxf.interceptor.ServiceInvokerInterceptor.handleMessage(ServiceInvokerInterceptor.java:107)
  
     at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:262) [cxf-api-2.2.6.jar:2.2.6]
  
     at org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:121)
  
     at org.apache.cxf.transport.http.AbstractHTTPDestination.invoke(AbstractHTTPDestination.java:237)
  
     at org.jboss.wsf.stack.cxf.RequestHandlerImpl.handleHttpRequest(RequestHandlerImpl.java:95)
  
     at org.jboss.wsf.stack.cxf.transport.ServletHelper.callRequestHandler(ServletHelper.java:156)
  
     at org.jboss.wsf.stack.cxf.CXFServletExt.invoke(CXFServletExt.java:87)
  
     at org.apache.cxf.transport.servlet.AbstractHTTPServlet.handleRequest(AbstractHTTPServlet.java:225)
  
     at org.apache.cxf.transport.servlet.AbstractHTTPServlet.doPost(AbstractHTTPServlet.java:145)
  
     at javax.servlet.http.HttpServlet.service(HttpServlet.java:754) [jboss-servlet-api_3.0_spec-1.0.2.Final-redhat-1.jar:1.0.2.Final-redhat-1]
  
     at org.jboss.wsf.stack.cxf.CXFServletExt.service(CXFServletExt.java:135)
  
     at org.jboss.wsf.spi.deployment.WSFServlet.service(WSFServlet.java:140) [jbossws-spi-2.1.2.Final-redhat-1.jar:2.1.2.Final-redhat-1]
  
     at javax.servlet.http.HttpServlet.service(HttpServlet.java:847) [jboss-servlet-api_3.0_spec-1.0.2.Final-redhat-1.jar:1.0.2.Final-redhat-1]
  
     at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:295) [jbossweb-7.2.0.Final-redhat-1.jar:7.2.0.Final-redhat-1]
  
     at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:214) [jbossweb-7.2.0.Final-redhat-1.jar:7.2.0.Final-redhat-1]
  
     at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230) [jbossweb-7.2.0.Final-redhat-1.jar:7.2.0.Final-redhat-1]
  
     at org.apache.catalina.core.StandardContextValve.__invoke(StandardContextValve.java:149) [jbossweb-7.2.0.Final-redhat-1.jar:7.2.0.Final-redhat-1]
  
     at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java) [jbossweb-7.2.0.Final-redhat-1.jar:7.2.0.Final-redhat-1]
  
     at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:481) [jbossweb-7.2.0.Final-redhat-1.jar:7.2.0.Final-redhat-1]
  
     at org.jboss.as.jpa.interceptor.WebNonTxEmCloserValve.invoke(WebNonTxEmCloserValve.java:50) [jboss-as-jpa-7.2.0.Final-redhat-8.jar:7.2.0.Final-redhat-8]
  
     at org.jboss.as.jpa.interceptor.WebNonTxEmCloserValve.invoke(WebNonTxEmCloserValve.java:50) [jboss-as-jpa-7.2.0.Final-redhat-8.jar:7.2.0.Final-redhat-8]
  
     at org.jboss.as.web.security.SecurityContextAssociationValve.invoke(SecurityContextAssociationValve.java:169) [jboss-as-web-7.2.0.Final-redhat-8.jar:7.2.0.Final-redhat-8]
  
     at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:145) [jbossweb-7.2.0.Final-redhat-1.jar:7.2.0.Final-redhat-1]
  
     at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:97) [jbossweb-7.2.0.Final-redhat-1.jar:7.2.0.Final-redhat-1]
  
     at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:102) [jbossweb-7.2.0.Final-redhat-1.jar:7.2.0.Final-redhat-1]
  
     at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:336) [jbossweb-7.2.0.Final-redhat-1.jar:7.2.0.Final-redhat-1]
  
     at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:856) [jbossweb-7.2.0.Final-redhat-1.jar:7.2.0.Final-redhat-1]
  
     at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:653) [jbossweb-7.2.0.Final-redhat-1.jar:7.2.0.Final-redhat-1]
  
     at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:920) [jbossweb-7.2.0.Final-redhat-1.jar:7.2.0.Final-redhat-1]
  
     at java.lang.Thread.run(Thread.java:662) [rt.jar:1.6.0_43]
  </code></pre>
  
  <p>Caused by: java.lang.ClassCastException: org.jboss.as.ee.component.BasicComponent cannot be cast to org.jboss.as.webservices.injection.WSComponent</p>
  
  <pre><code>   at org.jboss.as.webservices.deployers.WSComponentInstanceAssociationInterceptor.processInvocation(WSComponentInstanceAssociationInterceptor.java:46)
  
     at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.1.Final-redhat-2.jar:1.1.1.Final-redhat-2]
  
     at org.jboss.invocation.ChainedInterceptor.processInvocation(ChainedInterceptor.java:61) [jboss-invocation-1.1.1.Final-redhat-2.jar:1.1.1.Final-redhat-2]
  
     at org.jboss.as.ee.component.ViewService$View.invoke(ViewService.java:165) [jboss-as-ee-7.2.0.Final-redhat-8.jar:7.2.0.Final-redhat-8]
  
     at org.jboss.as.webservices.invocation.AbstractInvocationHandler.invoke(AbstractInvocationHandler.java:111)
  
     at org.jboss.wsf.stack.cxf.JBossWSInvoker.performInvocation(JBossWSInvoker.java:149)
  
     at org.apache.cxf.service.invoker.AbstractInvoker.invoke(AbstractInvoker.java:96)
  
     ... 38 more
  </code></pre>