title: Java Webservice java.lang.ClassCastException: org.apache.cxf.jaxws.ServiceImpl
body: <p>I am using Maven, CXF 2.2.7, JBoss 4.2.3 and JRE 1.5 <strong>Updated</strong></p>
  
  <p>I have a Webservice that I can see on the server by using the URL myURL/myService?wsdl</p>
  
  <p>I am trying to develop a web app to ping that webservice by calling this in my bean:</p>
  
  <p>MyWebService webservice = new MyWebService();</p>
  
  <p>However, it dies and throws the following error, which is very vague:</p>
  
  <pre><code>    java.lang.ClassCastException: org.apache.cxf.jaxws.ServiceImpl
  09:25:59,450 ERROR [STDERR]  at javax.xml.ws.Service.&lt;init&gt;(Service.java:81)
  09:25:59,450 ERROR [STDERR]  at org.otherservice.webservice.MyWebServiceService.&lt;init&gt;(MyWebService.java:44)
  09:25:59,450 ERROR [STDERR]  at net.myservice.beans.MyBean.getMyServiceSoap(MyBean.java:109)
  09:25:59,450 ERROR [STDERR]  at net.myservice.beans.MyBean.ack(MyBean.java:240)
  09:25:59,450 ERROR [STDERR]  at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
  09:25:59,450 ERROR [STDERR]  at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
  09:25:59,450 ERROR [STDERR]  at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
  09:25:59,450 ERROR [STDERR]  at java.lang.reflect.Method.invoke(Method.java:585)
  09:25:59,450 ERROR [STDERR]  at org.apache.el.parser.AstValue.invoke(AstValue.java:131)
  09:25:59,450 ERROR [STDERR]  at org.apache.el.MethodExpressionImpl.invoke(MethodExpressionImpl.java:276)
  09:25:59,450 ERROR [STDERR]  at org.apache.jasper.el.JspMethodExpression.invoke(JspMethodExpression.java:68)
  09:25:59,450 ERROR [STDERR]  at javax.faces.component.MethodBindingMethodExpressionAdapter.invoke(MethodBindingMethodExpressionAdapter.java:77)
  09:25:59,450 ERROR [STDERR]  at com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:95)
  09:25:59,450 ERROR [STDERR]  at javax.faces.component.UICommand.broadcast(UICommand.java:383)
  09:25:59,450 ERROR [STDERR]  at javax.faces.component.UIViewRoot.broadcastEvents(UIViewRoot.java:450)
  09:25:59,450 ERROR [STDERR]  at javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:759)
  09:25:59,450 ERROR [STDERR]  at com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:97)
  09:25:59,450 ERROR [STDERR]  at com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:266)
  09:25:59,450 ERROR [STDERR]  at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:132)
  09:25:59,450 ERROR [STDERR]  at javax.faces.webapp.FacesServlet.service(FacesServlet.java:244)
  09:25:59,450 ERROR [STDERR]  at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
  09:25:59,450 ERROR [STDERR]  at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
  09:25:59,450 ERROR [STDERR]  at org.apache.myfaces.webapp.filter.ExtensionsFilter.doFilter(ExtensionsFilter.java:301)
  09:25:59,450 ERROR [STDERR]  at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
  09:25:59,450 ERROR [STDERR]  at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
  09:25:59,450 ERROR [STDERR]  at net.faces.filters.AuthorizationFilter.doFilter(AuthorizationFilter.java:84)
  09:25:59,450 ERROR [STDERR]  at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
  09:25:59,450 ERROR [STDERR]  at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
  09:25:59,450 ERROR [STDERR]  at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
  09:25:59,450 ERROR [STDERR]  at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
  09:25:59,450 ERROR [STDERR]  at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
  09:25:59,450 ERROR [STDERR]  at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230)
  09:25:59,450 ERROR [STDERR]  at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
  09:25:59,450 ERROR [STDERR]  at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:182)
  09:25:59,450 ERROR [STDERR]  at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:84)
  09:25:59,450 ERROR [STDERR]  at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
  09:25:59,450 ERROR [STDERR]  at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
  09:25:59,450 ERROR [STDERR]  at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:157)
  09:25:59,450 ERROR [STDERR]  at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
  09:25:59,450 ERROR [STDERR]  at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:262)
  09:25:59,450 ERROR [STDERR]  at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
  09:25:59,450 ERROR [STDERR]  at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
  09:25:59,450 ERROR [STDERR]  at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:446)
  09:25:59,450 ERROR [STDERR]  at java.lang.Thread.run(Thread.java:595)
  </code></pre>
  
  <p>I am hoping someone has seen this exception before and can help me.</p>
  
  <pre><code>&lt;dependency&gt;
          &lt;groupId&gt;junit&lt;/groupId&gt;
          &lt;artifactId&gt;junit&lt;/artifactId&gt;
          &lt;version&gt;4.6&lt;/version&gt;
          &lt;scope&gt;test&lt;/scope&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.mortbay.jetty&lt;/groupId&gt;
          &lt;artifactId&gt;jetty&lt;/artifactId&gt;
          &lt;version&gt;6.1.9&lt;/version&gt;
          &lt;scope&gt;test&lt;/scope&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.apache.cxf&lt;/groupId&gt;
          &lt;artifactId&gt;cxf-rt-frontend-jaxws&lt;/artifactId&gt;
          &lt;version&gt;2.2.7&lt;/version&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.apache.cxf&lt;/groupId&gt;
          &lt;artifactId&gt;cxf-rt-transports-http&lt;/artifactId&gt;
          &lt;version&gt;2.2.7&lt;/version&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.apache.cxf&lt;/groupId&gt;
          &lt;artifactId&gt;cxf-rt-ws-security&lt;/artifactId&gt;
          &lt;version&gt;2.2.7&lt;/version&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.apache.xmlbeans&lt;/groupId&gt;
          &lt;artifactId&gt;xmlbeans&lt;/artifactId&gt;
          &lt;version&gt;2.4.0&lt;/version&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.codehaus.mojo&lt;/groupId&gt;
          &lt;artifactId&gt;xmlbeans-maven-plugin&lt;/artifactId&gt;
          &lt;version&gt;2.3.3&lt;/version&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.slf4j&lt;/groupId&gt;
          &lt;artifactId&gt;slf4j-jdk14&lt;/artifactId&gt;
          &lt;version&gt;1.5.10&lt;/version&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.hibernate&lt;/groupId&gt;
          &lt;artifactId&gt;hibernate-core&lt;/artifactId&gt;
          &lt;version&gt;3.3.2.GA&lt;/version&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.hibernate&lt;/groupId&gt;
          &lt;artifactId&gt;hibernate-c3p0&lt;/artifactId&gt;
          &lt;version&gt;3.3.2.GA&lt;/version&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;javassist&lt;/groupId&gt;
          &lt;artifactId&gt;javassist&lt;/artifactId&gt;
          &lt;version&gt;3.8.0.GA&lt;/version&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;hsqldb&lt;/groupId&gt;
          &lt;artifactId&gt;hsqldb&lt;/artifactId&gt;
          &lt;version&gt;1.8.0.7&lt;/version&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;javax.faces&lt;/groupId&gt;
          &lt;artifactId&gt;jsf-api&lt;/artifactId&gt;
          &lt;version&gt;1.2_02&lt;/version&gt;
          &lt;scope&gt;provided&lt;/scope&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;javax.faces&lt;/groupId&gt;
          &lt;artifactId&gt;jsf-impl&lt;/artifactId&gt;
          &lt;version&gt;1.2-b19&lt;/version&gt;
          &lt;scope&gt;provided&lt;/scope&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;javax.xml&lt;/groupId&gt;
          &lt;artifactId&gt;jaxrpc-api&lt;/artifactId&gt;
          &lt;version&gt;1.1&lt;/version&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.apache.axis&lt;/groupId&gt;
          &lt;artifactId&gt;axis&lt;/artifactId&gt;
          &lt;version&gt;1.4&lt;/version&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.apache.myfaces.tomahawk&lt;/groupId&gt;
          &lt;artifactId&gt;tomahawk&lt;/artifactId&gt;
          &lt;version&gt;1.1.8&lt;/version&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;commons-discovery&lt;/groupId&gt;
          &lt;artifactId&gt;commons-discovery&lt;/artifactId&gt;
          &lt;version&gt;20040218.194635&lt;/version&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;net.sf.locale4j&lt;/groupId&gt;
          &lt;artifactId&gt;locale4j&lt;/artifactId&gt;
          &lt;version&gt;1.1.3&lt;/version&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;javax.mail&lt;/groupId&gt;
          &lt;artifactId&gt;mail&lt;/artifactId&gt;
          &lt;version&gt;1.4.1&lt;/version&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;javax.activation&lt;/groupId&gt;
          &lt;artifactId&gt;activation&lt;/artifactId&gt;
          &lt;version&gt;1.1&lt;/version&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.mortbay.jetty&lt;/groupId&gt;
          &lt;artifactId&gt;jsp-api-2.1&lt;/artifactId&gt;
          &lt;version&gt;6.1.9&lt;/version&gt;
          &lt;scope&gt;test&lt;/scope&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;com.sun.el&lt;/groupId&gt;
          &lt;artifactId&gt;el-ri&lt;/artifactId&gt;
          &lt;version&gt;1.0&lt;/version&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;mysql&lt;/groupId&gt;
          &lt;artifactId&gt;mysql-connector-java&lt;/artifactId&gt;
          &lt;version&gt;5.1.10&lt;/version&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.hibernate&lt;/groupId&gt;
          &lt;artifactId&gt;hibernate-ehcache&lt;/artifactId&gt;
          &lt;version&gt;3.3.2.GA&lt;/version&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;commons-fileupload&lt;/groupId&gt;
          &lt;artifactId&gt;commons-fileupload&lt;/artifactId&gt;
          &lt;version&gt;1.0&lt;/version&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;opensymphony&lt;/groupId&gt;
          &lt;artifactId&gt;quartz-all&lt;/artifactId&gt;
          &lt;version&gt;1.6.3&lt;/version&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;de.odysseus.juel&lt;/groupId&gt;
          &lt;artifactId&gt;juel&lt;/artifactId&gt;
          &lt;version&gt;2.1.0&lt;/version&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;javax.servlet&lt;/groupId&gt;
          &lt;artifactId&gt;servlet-api&lt;/artifactId&gt;
          &lt;version&gt;2.4&lt;/version&gt;
          &lt;scope&gt;provided&lt;/scope&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;javax.servlet.jsp&lt;/groupId&gt;
          &lt;artifactId&gt;jsp-api&lt;/artifactId&gt;
          &lt;version&gt;2.0&lt;/version&gt;
          &lt;scope&gt;provided&lt;/scope&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;javax.servlet&lt;/groupId&gt;
          &lt;artifactId&gt;jstl&lt;/artifactId&gt;
          &lt;version&gt;1.2&lt;/version&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;taglibs&lt;/groupId&gt;
          &lt;artifactId&gt;standard&lt;/artifactId&gt;
          &lt;version&gt;1.1.2&lt;/version&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;log4j&lt;/groupId&gt;
          &lt;artifactId&gt;log4j&lt;/artifactId&gt;
          &lt;version&gt;1.2.15&lt;/version&gt;
          &lt;exclusions&gt;
              &lt;exclusion&gt;
                  &lt;groupId&gt;javax.mail&lt;/groupId&gt;
                  &lt;artifactId&gt;mail&lt;/artifactId&gt;
              &lt;/exclusion&gt;
              &lt;exclusion&gt;
                  &lt;groupId&gt;javax.jms&lt;/groupId&gt;
                  &lt;artifactId&gt;jms&lt;/artifactId&gt;
              &lt;/exclusion&gt;
              &lt;exclusion&gt;
                  &lt;groupId&gt;com.sun.jdmk&lt;/groupId&gt;
                  &lt;artifactId&gt;jmxtools&lt;/artifactId&gt;
              &lt;/exclusion&gt;
              &lt;exclusion&gt;
                  &lt;groupId&gt;com.sun.jmx&lt;/groupId&gt;
                  &lt;artifactId&gt;jmxri&lt;/artifactId&gt;
              &lt;/exclusion&gt;
          &lt;/exclusions&gt;
      &lt;/dependency&gt;
  </code></pre>