I'm evolving my AXIS 1 web service to a AXIS 2. I have managed to deploy the web services wihtout handlers and they run fine, but now, I'm trying to add handlers in order to process the SOAP headers (security reasons). In AXIS 1, I defined handlers in WSDD files, but according with the AXIS 2 documentation, now I need to define a module in order to include the handler into the AXIS engine. However, After deploying the service in my WildFly server, I send a SOAP request to the service and I get the following response:
<html>
<head>
...
</head>
<body>
<div class="header">
<div class="error-div"/>
<div class="error-text-div">Error processing request</div>
</div>
<div class="label">Context Path:</div>
<div class="value">/pao</div>
<br/>
<div class="label">Servlet Path:</div>
<div class="value">/services</div>
<br/>
<div class="label">Path Info:</div>
<div class="value">/PAOSynchronizationServiceSOAP</div>
<br/>
<div class="label">Query String:</div>
<div class="value">null</div>
<br/>
<b>Stack Trace</b>
<br/>
javax.servlet.ServletException: javax.servlet.ServletException: org.apache.axis2.deployment.DeploymentException: org.apache.axis2.dispatchers.RequestURIBasedDispatcher cannot be cast to org.apache.axis2.engine.Handler
<br/>
org.apache.axis2.transport.http.AxisServlet.init(AxisServlet.java:479)
<br/>
io.undertow.servlet.core.LifecyleInterceptorInvocation.proceed(LifecyleInterceptorInvocation.java:117)
<br/>
org.wildfly.extension.undertow.security.RunAsLifecycleInterceptor.init(RunAsLifecycleInterceptor.java:78)
<br/>
io.undertow.servlet.core.LifecyleInterceptorInvocation.proceed(LifecyleInterceptorInvocation.java:103)
<br/>
io.undertow.servlet.core.ManagedServlet$DefaultInstanceStrategy.start(ManagedServlet.java:250)
<br/>
io.undertow.servlet.core.ManagedServlet.getServlet(ManagedServlet.java:171)
<br/>
io.undertow.servlet.handlers.ServletHandler.handleRequest(ServletHandler.java:84)
<br/>
io.undertow.servlet.handlers.security.ServletSecurityRoleHandler.handleRequest(ServletSecurityRoleHandler.java:62)
<br/>
io.undertow.servlet.handlers.ServletDispatchingHandler.handleRequest(ServletDispatchingHandler.java:36)
<br/>
org.wildfly.extension.undertow.security.SecurityContextAssociationHandler.handleRequest(SecurityContextAssociationHandler.java:78)
<br/>
io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
<br/>
io.undertow.servlet.handlers.security.SSLInformationAssociationHandler.handleRequest(SSLInformationAssociationHandler.java:131)
<br/>
io.undertow.servlet.handlers.security.ServletAuthenticationCallHandler.handleRequest(ServletAuthenticationCallHandler.java:57)
<br/>
io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
<br/>
io.undertow.security.handlers.AbstractConfidentialityHandler.handleRequest(AbstractConfidentialityHandler.java:46)
<br/>
io.undertow.servlet.handlers.security.ServletConfidentialityConstraintHandler.handleRequest(ServletConfidentialityConstraintHandler.java:64)
<br/>
io.undertow.security.handlers.AuthenticationMechanismsHandler.handleRequest(AuthenticationMechanismsHandler.java:60)
<br/>
io.undertow.servlet.handlers.security.CachedAuthenticatedSessionHandler.handleRequest(CachedAuthenticatedSessionHandler.java:77)
<br/>
io.undertow.security.handlers.NotificationReceiverHandler.handleRequest(NotificationReceiverHandler.java:50)
<br/>
io.undertow.security.handlers.AbstractSecurityContextAssociationHandler.handleRequest(AbstractSecurityContextAssociationHandler.java:43)
<br/>
io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
<br/>
org.wildfly.extension.undertow.security.jacc.JACCContextIdHandler.handleRequest(JACCContextIdHandler.java:61)
<br/>
io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
<br/>
io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
<br/>
io.undertow.servlet.handlers.ServletInitialHandler.handleFirstRequest(ServletInitialHandler.java:292)
<br/>
io.undertow.servlet.handlers.ServletInitialHandler.access$100(ServletInitialHandler.java:81)
<br/>
io.undertow.servlet.handlers.ServletInitialHandler$2.call(ServletInitialHandler.java:138)
<br/>
io.undertow.servlet.handlers.ServletInitialHandler$2.call(ServletInitialHandler.java:135)
<br/>
io.undertow.servlet.core.ServletRequestContextThreadSetupAction$1.call(ServletRequestContextThreadSetupAction.java:48)
<br/>
io.undertow.servlet.core.ContextClassLoaderSetupAction$1.call(ContextClassLoaderSetupAction.java:43)
<br/>
io.undertow.servlet.api.LegacyThreadSetupActionWrapper$1.call(LegacyThreadSetupActionWrapper.java:44)
<br/>
io.undertow.servlet.api.LegacyThreadSetupActionWrapper$1.call(LegacyThreadSetupActionWrapper.java:44)
<br/>
io.undertow.servlet.api.LegacyThreadSetupActionWrapper$1.call(LegacyThreadSetupActionWrapper.java:44)
<br/>
io.undertow.servlet.api.LegacyThreadSetupActionWrapper$1.call(LegacyThreadSetupActionWrapper.java:44)
<br/>
io.undertow.servlet.api.LegacyThreadSetupActionWrapper$1.call(LegacyThreadSetupActionWrapper.java:44)
<br/>
io.undertow.servlet.api.LegacyThreadSetupActionWrapper$1.call(LegacyThreadSetupActionWrapper.java:44)
<br/>
io.undertow.servlet.handlers.ServletInitialHandler.dispatchRequest(ServletInitialHandler.java:272)
<br/>
io.undertow.servlet.handlers.ServletInitialHandler.access$000(ServletInitialHandler.java:81)
<br/>
io.undertow.servlet.handlers.ServletInitialHandler$1.handleRequest(ServletInitialHandler.java:104)
<br/>
io.undertow.server.Connectors.executeRootHandler(Connectors.java:202)
<br/>
io.undertow.server.HttpServerExchange$1.run(HttpServerExchange.java:805)
<br/>
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
<br/>
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
<br/>
java.lang.Thread.run(Thread.java:748)
<br/>
</body>
And, in my application log, I can see this:
2020-05-18 11:43:24,418 DEBUG [org.apache.axis2.transport.http.AxisServlet] (default task-3) OnDemandLogger initialized for class org.apache.axis2.transport.http.AxisServlet is:org.apache.commons.logging.impl.SLF4JLocationAwareLog@2500e603
2020-05-18 11:43:24,418 INFO [org.apache.axis2.transport.http.AxisServlet] (default task-3)
org.apache.axis2.deployment.DeploymentException: org.apache.axis2.dispatchers.RequestURIBasedDispatcher cannot be cast to org.apache.axis2.engine.Handler
2020-05-18 11:43:24,419 ERROR [io.undertow.request] (default task-3) UT005023: Exception handling request to /pao/services/PAOSynchronizationServiceSOAP: javax.servlet.ServletException: javax.servlet.ServletException: org.apache.axis2.deployment.DeploymentException: org.apache.axis2.dispatchers.RequestURIBasedDispatcher cannot be cast to org.apache.axis2.engine.Handler
at org.apache.axis2.transport.http.AxisServlet.init(AxisServlet.java:479)
at io.undertow.servlet.core.LifecyleInterceptorInvocation.proceed(LifecyleInterceptorInvocation.java:117)
at org.wildfly.extension.undertow.security.RunAsLifecycleInterceptor.init(RunAsLifecycleInterceptor.java:78)
at io.undertow.servlet.core.LifecyleInterceptorInvocation.proceed(LifecyleInterceptorInvocation.java:103)
at io.undertow.servlet.core.ManagedServlet$DefaultInstanceStrategy.start(ManagedServlet.java:250)
at io.undertow.servlet.core.ManagedServlet.getServlet(ManagedServlet.java:171)
at io.undertow.servlet.handlers.ServletHandler.handleRequest(ServletHandler.java:84)
at io.undertow.servlet.handlers.security.ServletSecurityRoleHandler.handleRequest(ServletSecurityRoleHandler.java:62)
at io.undertow.servlet.handlers.ServletDispatchingHandler.handleRequest(ServletDispatchingHandler.java:36)
at org.wildfly.extension.undertow.security.SecurityContextAssociationHandler.handleRequest(SecurityContextAssociationHandler.java:78)
at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
at io.undertow.servlet.handlers.security.SSLInformationAssociationHandler.handleRequest(SSLInformationAssociationHandler.java:131)
at io.undertow.servlet.handlers.security.ServletAuthenticationCallHandler.handleRequest(ServletAuthenticationCallHandler.java:57)
at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
at io.undertow.security.handlers.AbstractConfidentialityHandler.handleRequest(AbstractConfidentialityHandler.java:46)
at io.undertow.servlet.handlers.security.ServletConfidentialityConstraintHandler.handleRequest(ServletConfidentialityConstraintHandler.java:64)
at io.undertow.security.handlers.AuthenticationMechanismsHandler.handleRequest(AuthenticationMechanismsHandler.java:60)
at io.undertow.servlet.handlers.security.CachedAuthenticatedSessionHandler.handleRequest(CachedAuthenticatedSessionHandler.java:77)
at io.undertow.security.handlers.NotificationReceiverHandler.handleRequest(NotificationReceiverHandler.java:50)
at io.undertow.security.handlers.AbstractSecurityContextAssociationHandler.handleRequest(AbstractSecurityContextAssociationHandler.java:43)
at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
at org.wildfly.extension.undertow.security.jacc.JACCContextIdHandler.handleRequest(JACCContextIdHandler.java:61)
at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
at io.undertow.servlet.handlers.ServletInitialHandler.handleFirstRequest(ServletInitialHandler.java:292)
at io.undertow.servlet.handlers.ServletInitialHandler.access$100(ServletInitialHandler.java:81)
at io.undertow.servlet.handlers.ServletInitialHandler$2.call(ServletInitialHandler.java:138)
at io.undertow.servlet.handlers.ServletInitialHandler$2.call(ServletInitialHandler.java:135)
at io.undertow.servlet.core.ServletRequestContextThreadSetupAction$1.call(ServletRequestContextThreadSetupAction.java:48)
at io.undertow.servlet.core.ContextClassLoaderSetupAction$1.call(ContextClassLoaderSetupAction.java:43)
at io.undertow.servlet.api.LegacyThreadSetupActionWrapper$1.call(LegacyThreadSetupActionWrapper.java:44)
at io.undertow.servlet.api.LegacyThreadSetupActionWrapper$1.call(LegacyThreadSetupActionWrapper.java:44)
at io.undertow.servlet.api.LegacyThreadSetupActionWrapper$1.call(LegacyThreadSetupActionWrapper.java:44)
at io.undertow.servlet.api.LegacyThreadSetupActionWrapper$1.call(LegacyThreadSetupActionWrapper.java:44)
at io.undertow.servlet.api.LegacyThreadSetupActionWrapper$1.call(LegacyThreadSetupActionWrapper.java:44)
at io.undertow.servlet.api.LegacyThreadSetupActionWrapper$1.call(LegacyThreadSetupActionWrapper.java:44)
at io.undertow.servlet.handlers.ServletInitialHandler.dispatchRequest(ServletInitialHandler.java:272)
at io.undertow.servlet.handlers.ServletInitialHandler.access$000(ServletInitialHandler.java:81)
at io.undertow.servlet.handlers.ServletInitialHandler$1.handleRequest(ServletInitialHandler.java:104)
at io.undertow.server.Connectors.executeRootHandler(Connectors.java:202)
at io.undertow.server.HttpServerExchange$1.run(HttpServerExchange.java:805)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:748)
Caused by: javax.servlet.ServletException: org.apache.axis2.deployment.DeploymentException: org.apache.axis2.dispatchers.RequestURIBasedDispatcher cannot be cast to org.apache.axis2.engine.Handler
at org.apache.axis2.transport.http.AxisServlet.initConfigContext(AxisServlet.java:627)
at org.apache.axis2.transport.http.AxisServlet.init(AxisServlet.java:471)
... 43 more
Caused by: org.apache.axis2.deployment.DeploymentException: org.apache.axis2.dispatchers.RequestURIBasedDispatcher cannot be cast to org.apache.axis2.engine.Handler
at org.apache.axis2.deployment.util.Utils.loadHandler(Utils.java:148)
at org.apache.axis2.deployment.AxisConfigBuilder.processPhaseList(AxisConfigBuilder.java:575)
at org.apache.axis2.deployment.AxisConfigBuilder.processPhaseOrders(AxisConfigBuilder.java:606)
at org.apache.axis2.deployment.AxisConfigBuilder.populateConfig(AxisConfigBuilder.java:149)
at org.apache.axis2.deployment.DeploymentEngine.populateAxisConfiguration(DeploymentEngine.java:629)
at org.apache.axis2.deployment.WarBasedAxisConfigurator.<init>(WarBasedAxisConfigurator.java:157)
at org.apache.axis2.transport.http.AxisServlet.initConfigContext(AxisServlet.java:620)
... 44 more
Caused by: java.lang.ClassCastException: org.apache.axis2.dispatchers.RequestURIBasedDispatcher cannot be cast to org.apache.axis2.engine.Handler
at org.apache.axis2.deployment.util.Utils.loadHandler(Utils.java:133)
... 50 more
I have used the maven plugin "axis2-repo-maven-plugin" to generate the .mar and .list files. The services.xml is this:
<service name="PAOSynchronizationServiceSOAP" targetNamespace="urn:es:pao:services:messages:1.0.0">
<description>Servicios PAO.</description>
<module ref="AuthModule" />
<schema schemaNamespace="urn:es:pao:services:messages:1.0.0" />
<parameter name="ServiceClass" locked="false">es.gob.afirma.pao.impl.PAOSynchronizationServiceSOAPBindingImpl
</parameter>
<!-- <parameter name="disableSOAP11" locked="true">true</parameter> -->
<parameter name="disableREST" locked="false">true</parameter>
<messageReceivers>
<messageReceiver mep="http://www.w3.org/ns/wsdl/in-out"
class="es.gob.afirma.pao.utilities.PAOSynchronizationServiceMessageReceiverInOut" />
</messageReceivers>
</service>
The module.xml:
<module name="AuthModule" class="es.gob.afirma.pao.utilities.AuthModule">
<InFlow>
<handler name="AuthHandler" class="es.gob.afirma.pao.impl.AuthHandler">
<order phase="Security" />
</handler>
</InFlow>
<OutFlow>
</OutFlow>
<OutFaultFlow>
</OutFaultFlow>
<InFaultFlow>
</InFaultFlow>
The module implementation is by default (with empty methods) and the handler extends to AbstractHandler class.
What am I doing wrong?