gpt4 book ai didi

java - AXIS 2 Web 服务访问中的 ClassCastException : RequestURIBasedDispatcher

转载 作者:行者123 更新时间:2023-12-01 16:40:42 26 4
gpt4 key购买 nike

我正在将 AXIS 1 Web 服务发展为 AXIS 2。我已成功部署没有处理程序的 Web 服务,并且它们运行良好,但现在,我正在尝试添加处理程序以处理 SOAP header (安全原因)。在 AXIS 1 中,我在 WSDD 文件中定义了处理程序,但根据 AXIS 2 文档,现在我需要定义一个模块,以便将处理程序包含到 AXIS 引擎中。但是,在我的 WildFly 服务器中部署该服务后,我向该服务发送 SOAP 请求,并收到以下响应:

<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>

而且,在我的应用程序日志中,我可以看到:

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

我使用了maven插件“axis2-repo-maven-plugin”来生成.mar和.list文件。services.xml 是这样的:

    <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>

模块.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>

默认情况下模块实现(使用空方法),并且处理程序扩展为 AbstractHandler 类。

我做错了什么?

最佳答案

终于,我发现了问题所在。我添加了“rampart”依赖项,该依赖项与其他 Axis 库冲突,因此,在阶段加载过程中,Axis 引擎在转换处理程序时崩溃。

我使用“rampart”依赖项来执行“axis2-mar-maven-plugin”maven 插件( following this guide ),但最后我在 axis2.xml 文件中添加了处理程序,所以,我没有需要定义Axis模块。

关于java - AXIS 2 Web 服务访问中的 ClassCastException : RequestURIBasedDispatcher,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/61867650/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com