<!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).&#160;&#160; </p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</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;">&#160;</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;">&#160;</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/>&#160;&#160;&#160; at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1006)<br/>&#160;&#160;&#160; at org.apache.catalina.core.StandardWrapper.allocate(StandardWrapper.java:777)<br/>&#160;&#160;&#160; at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:129)<br/>&#160;&#160;&#160; at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)<br/>&#160;&#160;&#160; at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:190)<br/>&#160;&#160;&#160; at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:92)<br/>&#160;&#160;&#160; at org.jboss.web.tomcat.security.SecurityContextEstablishmentValve.process(SecurityContextEstablishmentValve.java:126)<br/>&#160;&#160;&#160; at org.jboss.web.tomcat.security.SecurityContextEstablishmentValve.invoke(SecurityContextEstablishmentValve.java:70)<br/>&#160;&#160;&#160; at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)<br/>&#160;&#160;&#160; at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)<br/>&#160;&#160;&#160; at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:158)<br/>&#160;&#160;&#160; at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)<br/>&#160;&#160;&#160; at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:330)<br/>&#160;&#160;&#160; at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:829)<br/>&#160;&#160;&#160; at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:598)<br/>&#160;&#160;&#160; at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)<br/>&#160;&#160;&#160; at java.lang.Thread.run(Thread.java:619)</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>These are the changes I made to use the JBoss-CXF integration. </p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</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;">&#160;</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;">&#160;</p><p>&#160;&#160; &lt;servlet&gt; <br/>&#160;&#160;&#160;&#160;&#160; &lt;servlet-name&gt;CXFLibrary&lt;/servlet-name&gt; <br/>&#160;&#160;&#160;&#160;&#160; &lt;servlet-class&gt;com.sosnoski.ws.library.cxf.CFXLibraryImpl&lt;/servlet-class&gt; <br/>&#160;&#160; &lt;/servlet&gt; <br/>&#160;&#160; &lt;servlet-mapping&gt; <br/>&#160;&#160;&#160;&#160;&#160; &lt;servlet-name&gt;CXFLibrary&lt;/servlet-name&gt; <br/>&#160;&#160;&#160;&#160;&#160; &lt;url-pattern&gt;/*&lt;/url-pattern&gt; <br/>&#160;&#160; &lt;/servlet-mapping&gt;</p><p>* commented out all references to CxfServlet from web.xml</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>This is what my jbossws-cxf.xml looks like:</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>&lt;beans<br/><span>&#160; 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>&#160; 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>&#160; 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>&#160; 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>&#160; 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>&#160; </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>&#160; </span><a class="jive-link-external-small" href="http://cxf.apache.org/jaxws" target="_blank">http://cxf.apache.org/jaxws</a><br/><span>&#160; </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>'&gt;</span></p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>&#160; &lt;!-- one or more jaxws:endpoint POJO declarations --&gt;<br/>&#160; &lt;jaxws:endpoint<br/>&#160;&#160;&#160; id='Processor'<br/><span>&#160;&#160;&#160; 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/>&#160;&#160;&#160; wsdlLocation="WEB-INF/wsdl/library-username.wsdl"<br/>&#160;&#160;&#160; implementor='com.sosnoski.ws.library.cxf.CXFLibraryImpl'&gt;<br/>&#160;&#160;&#160;&#160;&#160; &lt;jaxws:properties&gt;<br/>&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;entry key="ws-security.callback-handler"<br/>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; value="com.sosnoski.ws.library.cxf.ServerCallback"/&gt;<br/>&#160;&#160;&#160;&#160;&#160; &lt;/jaxws:properties&gt;</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>&#160;&#160;&#160; &lt;jaxws:invoker&gt;<br/>&#160;&#160;&#160;&#160;&#160; &lt;bean class='org.jboss.wsf.stack.cxf.InvokerJSE'/&gt;<br/>&#160;&#160;&#160; &lt;/jaxws:invoker&gt;<br/>&#160; &lt;/jaxws:endpoint&gt;</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>&lt;/beans&gt;</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</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;">&#160;</p><p>@javax.jws.WebService(endpointInterface="com.sosnoski.ws.library.cxf.Library",<br/><span>&#160;&#160;&#160; 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/>&#160;&#160;&#160;&#160;&#160;&#160;&#160; wsdlLocation = "WEB-INF/wsdl/library-username.wsdl",<br/>&#160;&#160;&#160; serviceName="CXFLibrary")</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>and this is how the wsdl references it.</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>&lt;wsdl:service name="CXFLibrary"&gt;</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>&#160;&#160;&#160; &lt;wsdl:port binding="wns:LibrarySoapBinding" name="library"&gt;<br/><span>&#160;&#160;&#160;&#160;&#160; &lt;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>"/&gt;</span><br/>&#160;&#160;&#160; &lt;/wsdl:port&gt;</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>&#160; &lt;/wsdl:service&gt;</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</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;">&#160;</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>