<!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">JBoss 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;">
    Module Dependency for supporting external Handler
</h3>
<span style="margin-bottom: 10px;">
    created by <a href="http://community.jboss.org/people/paul.robinson">Paul Robinson</a> in <i>JBoss Web Services</i> - <a href="http://community.jboss.org/message/629328#629328">View the full discussion</a>
</span>
<hr style="margin: 20px 0; border: none; background-color: #dadada; height: 1px;">

<div class="jive-rendered-content"><p>Hello,</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>I'm trying to configure module dependencies for a JAX-WS Web service. The complication seems to come from the fact that the service uses a Handler that lives inside a dependency rather than the same deployment archive as the Web service. The problem is appearing in the TXBridge and XTS demos in the JBossTS project. I would ask someone on the Transactions team to fix this, but unfortunately that is me ;-)</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>In more detail this is what we have:</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>The application (txbridge-demo-service.jar) that I am deploying depends on org.jboss.xts, which is where the handler that is specified in the handler chain lives. The Web service only uses JAX-WS annotations (rather than CXF) so I have the following dependencies specified in the manifest.mf of the txbridge-demo-service.jar:</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>{code} </p><p>Dependencies: javax.xml.ws.api, org.jboss.xts, org.jboss.ws.cxf.jbossws-cxf-client services export</p><p>{code}</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>The module "org.jboss.xts" has the following module.xml, which includes dependencies to JBossWS:</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>{code:xml}</p><p>&lt;module xmlns="urn:jboss:module:1.0" name="org.jboss.xts"&gt;</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>&#160;&#160;&#160; &lt;resources&gt;</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;resource-root path="jbossxts-4.15.3.Final.jar"/&gt;</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;resource-root path="jbossxts-api-4.15.3.Final.jar"/&gt;</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;resource-root path="jbosstxbridge-4.15.3.Final.jar"/&gt;</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;!-- Insert resources here --&gt;</p><p>&#160;&#160;&#160; &lt;/resources&gt;</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>&#160;&#160;&#160; &lt;dependencies&gt;</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;module name="javax.transaction.api"/&gt;</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;module name="javax.resource.api" /&gt;</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;module name="system"/&gt;</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;module name="org.jboss.jts"/&gt;</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;module name="org.jboss.ws.api" services="export"/&gt;</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;module name="org.jboss.ws.jaxws-client" services="export"/&gt;</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;module name="org.jboss.ws.cxf.jbossws-cxf-client" services="export"/&gt;</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;module name="org.jboss.logging"/&gt;</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;module name="javax.xml.soap.api"/&gt;</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;module name="javax.xml.ws.api"/&gt;</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;module name="javax.xml.stream.api"/&gt;</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;!-- this is needed to get javax.xml.namespace.QName but it would be better if it were exposed on its own --&gt;</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;module name="javax.api"/&gt;</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;!-- this is needed because our endpoints are not in a normal deployment and we need to be able</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; to resolve the javax.jws.WebService annotation attached to them. presumably an endpoint</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; found in a deployment gets this package auto-added to its module loader</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; --&gt;</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;module name="javax.jws.api"/&gt;</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;!-- this is needed to ensure @Resource annotations on the JaxWS endpoint classes are in the</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; classloader scope--&gt;</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;module name="javax.annotation.api"/&gt;</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;!-- this is needed to ensure the JaxWS endpoint classes canb refer to HttpServletRequest etc --&gt;</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;module name="javax.servlet.api"/&gt;</p><p>&#160;&#160;&#160; &lt;/dependencies&gt;</p><p>&lt;/module&gt;</p><p>{code}</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>When I deploy my application I get the following stack trace:</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>{code}</p><p>10:14:55,883 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-8) MSC00001: Failed to start service jboss.deployment.unit."txbridge-demo-service.jar".INSTALL: org.jboss.msc.service.StartException in service jboss.deployment.unit."txbridge-demo-service.jar".INSTALL: Failed to process phase INSTALL of deployment "txbridge-demo-service.jar"</p><p>&#160;&#160;&#160; at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:121) [jboss-as-server-7.1.0.Alpha2-SNAPSHOT.jar:7.1.0.Alpha2-SNAPSHOT]</p><p>&#160;&#160;&#160; at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1824) [jboss-msc-1.0.1.GA.jar:1.0.1.GA]</p><p>&#160;&#160;&#160; at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1759) [jboss-msc-1.0.1.GA.jar:1.0.1.GA]</p><p>&#160;&#160;&#160; at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110) [:1.6.0_22]</p><p>&#160;&#160;&#160; at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603) [:1.6.0_22]</p><p>&#160;&#160;&#160; at java.lang.Thread.run(Thread.java:679) [:1.6.0_22]</p><p>Caused by: javax.xml.ws.WebServiceException: javax.xml.ws.WebServiceException: Failed to instantiate handler</p><p>&#160;&#160;&#160; at org.apache.cxf.jaxws.EndpointImpl.doPublish(EndpointImpl.java:350)</p><p>&#160;&#160;&#160; at org.jboss.wsf.stack.cxf.deployment.EndpointImpl.doPublish(EndpointImpl.java:88)</p><p>&#160;&#160;&#160; at org.apache.cxf.jaxws.EndpointImpl.publish(EndpointImpl.java:239)</p><p>&#160;&#160;&#160; at org.apache.cxf.jaxws.EndpointImpl.publish(EndpointImpl.java:509)</p><p>&#160;&#160;&#160; at org.jboss.wsf.stack.cxf.configuration.NonSpringBusHolder.configure(NonSpringBusHolder.java:116)</p><p>&#160;&#160;&#160; at org.jboss.wsf.stack.cxf.deployment.aspect.BusDeploymentAspect.startDeploymentBus(BusDeploymentAspect.java:109)</p><p>&#160;&#160;&#160; at org.jboss.wsf.stack.cxf.deployment.aspect.BusDeploymentAspect.start(BusDeploymentAspect.java:132)</p><p>&#160;&#160;&#160; at org.jboss.as.webservices.deployers.AspectDeploymentProcessor.internalDeploy(AspectDeploymentProcessor.java:79)</p><p>&#160;&#160;&#160; at org.jboss.as.webservices.deployers.TCCLDeploymentProcessor.deploy(TCCLDeploymentProcessor.java:42)</p><p>&#160;&#160;&#160; at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:115) [jboss-as-server-7.1.0.Alpha2-SNAPSHOT.jar:7.1.0.Alpha2-SNAPSHOT]</p><p>&#160;&#160;&#160; ... 5 more</p><p>Caused by: javax.xml.ws.WebServiceException: Failed to instantiate handler</p><p>&#160;&#160;&#160; at org.apache.cxf.jaxws.handler.HandlerChainBuilder.buildHandlerChain(HandlerChainBuilder.java:131)</p><p>&#160;&#160;&#160; at org.apache.cxf.jaxws.handler.AnnotationHandlerChainBuilder.processHandlerElement(AnnotationHandlerChainBuilder.java:267)</p><p>&#160;&#160;&#160; at org.apache.cxf.jaxws.handler.AnnotationHandlerChainBuilder.processHandlerChainElement(AnnotationHandlerChainBuilder.java:167)</p><p>&#160;&#160;&#160; at org.apache.cxf.jaxws.handler.AnnotationHandlerChainBuilder.buildHandlerChainFromClass(AnnotationHandlerChainBuilder.java:120)</p><p>&#160;&#160;&#160; at org.apache.cxf.jaxws.handler.AnnotationHandlerChainBuilder.buildHandlerChainFromClass(AnnotationHandlerChainBuilder.java:284)</p><p>&#160;&#160;&#160; at org.apache.cxf.jaxws.JaxWsServerFactoryBean.buildHandlerChain(JaxWsServerFactoryBean.java:237)</p><p>&#160;&#160;&#160; at org.apache.cxf.jaxws.JaxWsServerFactoryBean.initializeResourcesAndHandlerChain(JaxWsServerFactoryBean.java:216)</p><p>&#160;&#160;&#160; at org.apache.cxf.jaxws.JaxWsServerFactoryBean.create(JaxWsServerFactoryBean.java:203)</p><p>&#160;&#160;&#160; at org.apache.cxf.jaxws.EndpointImpl.getServer(EndpointImpl.java:433)</p><p>&#160;&#160;&#160; at org.apache.cxf.jaxws.EndpointImpl.doPublish(EndpointImpl.java:322)</p><p>&#160;&#160;&#160; ... 14 more</p><p>Caused by: java.lang.ClassCastException: class org.jboss.jbossts.txbridge.inbound.JaxWSTxInboundBridgeHandler</p><p>&#160;&#160;&#160; at java.lang.Class.asSubclass(Class.java:3039) [:1.6.0_22]</p><p>&#160;&#160;&#160; at org.apache.cxf.jaxws.handler.HandlerChainBuilder.buildHandlerChain(HandlerChainBuilder.java:121)</p><p>&#160;&#160;&#160; ... 23 more</p><p>{code}</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>The ClassCastException refers to org.jboss.jbossts.txbridge.inbound.JaxWSTxInboundBridgeHandler which is the handler that lives in the org.jboss.xts module. I think the problem is that when JBossWS creates the endpoint it does not have JaxWSTxInboundBridgeHandler in it's Classloader as JBossWS does not depend on org.jboss.xts (which of course it shouldn't as org.jboss.xts depends on JBossWS). However, the application does depend on org.jboss.xts, which I don't think is of any help to JBossWS.</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>Is my reasoning about what is wrong correct and can anyone suggest how I can fix this?</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>Many thanks,</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>Paul Robinson.</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/629328#629328">going to Community</a></p>
        <p style="margin: 0;">Start a new discussion in JBoss Web Services at <a href="http://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2044">Community</a></p>
</div></td>
                        </tr>
                    </tbody>
                </table>


                </td>
            </tr>
        </tbody>
    </table>

</div>

</body>
</html>