<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<body link="#355491" alink="#4262a1" vlink="#355491" style="background: #e2e2e2; margin: 0; padding: 20px;">
<div>
        <table cellpadding="0" bgcolor="#FFFFFF" border="0" cellspacing="0" style="border: 1px solid #dadada; margin-bottom: 30px; width: 100%; -moz-border-radius: 6px; -webkit-border-radius: 6px;">
                <tbody>
                        <tr>
                                <td>
                                        <table border="0" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF" style="border: solid 2px #ccc; background: #dadada; width: 100%; -moz-border-radius: 6px; -webkit-border-radius: 6px;">
                                                <tbody>
                                                        <tr>
                                                                <td bgcolor="#000000" valign="middle" height="58px" style="border-bottom: 1px solid #ccc; padding: 20px; -moz-border-radius-topleft: 3px; -moz-border-radius-topright: 3px; -webkit-border-top-right-radius: 5px; -webkit-border-top-left-radius: 5px;">
                                                                        <h1 style="color: #333333; font: bold 22px Arial, Helvetica, sans-serif; margin: 0; display: block !important;">
                                                                        <!-- To have a header image/logo replace the name below with your img tag -->
                                                                        <!-- Email clients will render the images when the message is read so any image -->
                                                                        <!-- must be made available on a public server, so that all recipients can load the image. -->
                                                                        <a href="http://community.jboss.org/index.jspa" style="text-decoration: none; color: #E1E1E1">Community</a></h1>
                                                                </td>
                                                        </tr>
                                                        <tr>
                                                                <td bgcolor="#FFFFFF" style="font: normal 12px Arial, Helvetica, sans-serif; color:#333333; padding: 20px; -moz-border-radius-bottomleft: 4px; -moz-border-radius-bottomright: 4px; -webkit-border-bottom-right-radius: 5px; -webkit-border-bottom-left-radius: 5px;"><h3 style="margin: 10px 0 5px; font-size: 17px; font-weight: normal;">
ClassCastException: MyImpl cannot be cast to javax.servlet.Servlet
</h3>
<span style="margin-bottom: 10px;">
created by <a href="http://community.jboss.org/people/cvoraintuit">Chet Vora</a> in <i>JBoss Web Services CXF</i> - <a href="http://community.jboss.org/message/547878#547878">View the full discussion</a>
</span>
<hr style="margin: 20px 0; border: none; background-color: #dadada; height: 1px;">
<div class="jive-rendered-content"><p>Hi all,</p><p><br/>I'm trying to get the sample application from <a class="jive-link-external-small" href="http://www.ibm.com/developerworks/java/library/j-jws13.html">http://www.ibm.com/developerworks/java/library/j-jws13.html</a> to work on JBoss Enterprise 5.0.0RC1 with Apache CXF integration (jbossws-cxf-3.2.2.GA).   </p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>I could get it to work using CXF servlet (after a few tweaks which took me some time to figure out). </p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>But when I try to use the CXF integration using jbossws-cxf.xml, I am running into this error: </p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>2010-06-14 14:09:35,595 ERROR [org.apache.catalina.core.ContainerBase.[jboss.web].[localhost].[/cxf-library-username-jboss].[CXFLibrary]] (http-127.0.0.1-8080-1) Allocate exception for servlet CXFLibrary</p><p>java.lang.ClassCastException: com.sosnoski.ws.library.cxf.CXFLibraryImpl cannot be cast to javax.servlet.Servlet<br/>    at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1006)<br/>    at org.apache.catalina.core.StandardWrapper.allocate(StandardWrapper.java:777)<br/>    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:129)<br/>    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)<br/>    at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:190)<br/>    at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:92)<br/>    at org.jboss.web.tomcat.security.SecurityContextEstablishmentValve.process(SecurityContextEstablishmentValve.java:126)<br/>    at org.jboss.web.tomcat.security.SecurityContextEstablishmentValve.invoke(SecurityContextEstablishmentValve.java:70)<br/>    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)<br/>    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)<br/>    at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:158)<br/>    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)<br/>    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:330)<br/>    at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:829)<br/>    at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:598)<br/>    at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)<br/>    at java.lang.Thread.run(Thread.java:619)</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>These are the changes I made to use the JBoss-CXF integration. </p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>* removed cxf-servlet.xml from war WEB-INF and replaced with jbossws-cxf.xml </p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>* changed web.xml to this based on the testcases inside of jbossws-cxf-src-dist</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>   <servlet> <br/>      <servlet-name>CXFLibrary</servlet-name> <br/>      <servlet-class>com.sosnoski.ws.library.cxf.CFXLibraryImpl</servlet-class> <br/>   </servlet> <br/>   <servlet-mapping> <br/>      <servlet-name>CXFLibrary</servlet-name> <br/>      <url-pattern>/*</url-pattern> <br/>   </servlet-mapping></p><p>* commented out all references to CxfServlet from web.xml</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>This is what my jbossws-cxf.xml looks like:</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p><beans<br/><span>  xmlns='</span><a class="jive-link-external-small" href="http://www.springframework.org/schema/beans" target="_blank">http://www.springframework.org/schema/beans</a><span>'</span><br/><span>  xmlns:xsi='</span><a class="jive-link-external-small" href="http://www.w3.org/2001/XMLSchema-instance" target="_blank">http://www.w3.org/2001/XMLSchema-instance</a><span>'</span><br/><span>  xmlns:beans='</span><a class="jive-link-external-small" href="http://www.springframework.org/schema/beans" target="_blank">http://www.springframework.org/schema/beans</a><span>'</span><br/><span>  xmlns:jaxws='</span><a class="jive-link-external-small" href="http://cxf.apache.org/jaxws" target="_blank">http://cxf.apache.org/jaxws</a><span>'</span><br/><span>  xsi:schemaLocation='</span><a class="jive-link-external-small" href="http://www.springframework.org/schema/beans" target="_blank">http://www.springframework.org/schema/beans</a><br/><span>  </span><a class="jive-link-external-small" href="http://www.springframework.org/schema/beans/spring-beans.xsd" target="_blank">http://www.springframework.org/schema/beans/spring-beans.xsd</a><br/><span>  </span><a class="jive-link-external-small" href="http://cxf.apache.org/jaxws" target="_blank">http://cxf.apache.org/jaxws</a><br/><span>  </span><a class="jive-link-external-small" href="http://cxf.apache.org/schemas/jaxws.xsd" target="_blank">http://cxf.apache.org/schemas/jaxws.xsd</a><span>'></span></p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>  <!-- one or more jaxws:endpoint POJO declarations --><br/>  <jaxws:endpoint<br/>    id='Processor'<br/><span>    address='</span><a class="jive-link-external-small" href="http://localhost:8080/cxf-library-username" target="_blank">http://localhost:8080/cxf-library-username</a><span>'</span><br/>    wsdlLocation="WEB-INF/wsdl/library-username.wsdl"<br/>    implementor='com.sosnoski.ws.library.cxf.CXFLibraryImpl'><br/>      <jaxws:properties><br/>        <entry key="ws-security.callback-handler"<br/>            value="com.sosnoski.ws.library.cxf.ServerCallback"/><br/>      </jaxws:properties></p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>    <jaxws:invoker><br/>      <bean class='org.jboss.wsf.stack.cxf.InvokerJSE'/><br/>    </jaxws:invoker><br/>  </jaxws:endpoint></p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p></beans></p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>My impl POJO is annotated as such (this works with cxf-servlet.xml and i didn't change it for Jbossws-cxf ):</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>@javax.jws.WebService(endpointInterface="com.sosnoski.ws.library.cxf.Library",<br/><span>    portName="library", targetNamespace="</span><a class="jive-link-external-small" href="http://ws.sosnoski.com/library/wsdl" target="_blank">http://ws.sosnoski.com/library/wsdl</a><span>",</span><br/>        wsdlLocation = "WEB-INF/wsdl/library-username.wsdl",<br/>    serviceName="CXFLibrary")</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>and this is how the wsdl references it.</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p><wsdl:service name="CXFLibrary"></p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>    <wsdl:port binding="wns:LibrarySoapBinding" name="library"><br/><span>      <wsdlsoap:address location="</span><a class="jive-link-external-small" href="http://localhost:8080/cxf-library-username" target="_blank">http://localhost:8080/cxf-library-username</a><span>"/></span><br/>    </wsdl:port></p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>  </wsdl:service></p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>Let me know if I can provide any more details. I'm really bummed as to why it doesn't work.</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>Thanks in advance for your help.</p><p>CV</p></div>
<div style="background-color: #f4f4f4; padding: 10px; margin-top: 20px;">
<p style="margin: 0;">Reply to this message by <a href="http://community.jboss.org/message/547878#547878">going to Community</a></p>
        <p style="margin: 0;">Start a new discussion in JBoss Web Services CXF at <a href="http://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2046">Community</a></p>
</div></td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
</div>
</body>
</html>