- 浏览: 133328 次
- 性别:
- 来自: 上海
文章分类
- 全部博客 (52)
- JPA (3)
- JSF (1)
- DesignPattern (0)
- Axis2 (2)
- Ibatis (2)
- Spring (4)
- Cache (2)
- log (1)
- Java (2)
- WebService (7)
- 系统集成 (1)
- PDF Generate (2)
- NoSQL (3)
- IOS (1)
- ISO Apple (1)
- 杂谈 (2)
- 内存泄露常用工具分析 (2)
- webshpere 拓扑结构 (2)
- Hadoop (3)
- FreeMarker (1)
- Security Related (3)
- BackBone (1)
- BackBone Web前端 MVC (1)
- teste (1)
- 架构分解 原则 (1)
- 架构 (2)
- REST API (1)
最新评论
-
OMG-SOCOOL:
不用单独加载指定的文件private static Confi ...
动态加载 bean 到Spring Context -
springdata_springmvc:
spring mvc demo教程源代码下载,地址:http: ...
Spring MVC and FreeMarker Sample -
elicer:
zhongrf 写道请问为何用backbone?对银行系统合适 ...
BackBone介绍及使用 -
zhongrf:
请问为何用backbone?对银行系统合适么?
BackBone介绍及使用 -
heilinshuguang:
dear 动态加载bean已经了解。我现在有这样一个需 ...
动态加载 bean 到Spring Context
Axis2 自定义 module 实现 handler 来log soap request and response Message
- 博客分类:
- Axis2
自定义Module
1.给module写一个单独的配置文件(module.xml),放在source 同目录下的META-INF 文件中
2.实现你的自己的Module extends from org.apache.axis2.modules.Module
3.实现你的handler记录SOAP request and response Message.
Service Class的实现类
部署此service需要的services.xml
<service name="SampleService">
<description>
This is a sample service created in the Axis2 User's Guide
</description>
<module ref="logging"/>
<parameter name="ServiceClass">com.bank.webservice.SampleService</parameter>
<operation name="sayHello">
<messageReceiver class="org.apache.axis2.receivers.RawXMLINOutMessageReceiver"/>
<actionMapping>urn:sayHello</actionMapping>
</operation>
<operation name="ping">
<messageReceiver class="org.apache.axis2.receivers.RawXMLINOnlyMessageReceiver"/>
<actionMapping>urn:ping</actionMapping>
</operation>
</service>
注意<module ref="logging"/>配置来在此service中使用logging 这个module
用jar cvf 命令把此service打成一个aar包部署在tomcat 下的webapp/axis2/WEB-INF/services 文件下。
此外还要修改axis2.xml 加入我们的handler起作用的phase "loggingPhase"(红色配置).
<phaseOrder type="InFlow">
<!-- System predefined phases -->
<phase name="Transport">
<handler name="RequestURIBasedDispatcher"
class="org.apache.axis2.dispatchers.RequestURIBasedDispatcher">
<order phase="Transport"/>
</handler>
<handler name="SOAPActionBasedDispatcher"
class="org.apache.axis2.dispatchers.SOAPActionBasedDispatcher">
<order phase="Transport"/>
</handler>
</phase>
<phase name="Addressing">
<handler name="AddressingBasedDispatcher"
class="org.apache.axis2.dispatchers.AddressingBasedDispatcher">
<order phase="Addressing"/>
</handler>
</phase>
<phase name="Security"/>
<phase name="PreDispatch"/>
<phase name="Dispatch" class="org.apache.axis2.engine.DispatchPhase">
<handler name="RequestURIBasedDispatcher"
class="org.apache.axis2.dispatchers.RequestURIBasedDispatcher"/>
<handler name="SOAPActionBasedDispatcher"
class="org.apache.axis2.dispatchers.SOAPActionBasedDispatcher"/>
<handler name="RequestURIOperationDispatcher"
class="org.apache.axis2.dispatchers.RequestURIOperationDispatcher"/>
<handler name="SOAPMessageBodyBasedDispatcher"
class="org.apache.axis2.dispatchers.SOAPMessageBodyBasedDispatcher"/>
<handler name="HTTPLocationBasedDispatcher"
class="org.apache.axis2.dispatchers.HTTPLocationBasedDispatcher"/>
<handler name="GenericProviderDispatcher"
class="org.apache.axis2.jaxws.dispatchers.GenericProviderDispatcher"/>
<handler name="MustUnderstandValidationDispatcher"
class="org.apache.axis2.jaxws.dispatchers.MustUnderstandValidationDispatcher"/>
</phase>
<phase name="RMPhase"/>
<!-- System predefined phases -->
<!-- After Postdispatch phase module author or service author can add any phase he want -->
<phase name="userDefinedMessageInPhase"/>
<phase name="loggingPhase"/>
<phase name="OperationInPhase">
<handler name="MustUnderstandChecker"
class="org.apache.axis2.jaxws.dispatchers.MustUnderstandChecker">
<order phase="OperationInPhase"/>
</handler>
</phase>
<phase name="soapmonitorPhase"/>
</phaseOrder>
<phaseOrder type="OutFlow">
<!-- user can add his own phases to this area -->
<phase name="userDefinedMessageOutPhase"/>
<phase name="loggingPhase"/>
<phase name="soapmonitorPhase"/>
<phase name="OperationOutPhase"/>
<!--system predefined phase-->
<!--these phase will run irrespective of the service-->
<phase name="RMPhase"/>
<phase name="PolicyDetermination"/>
<phase name="MessageOut"/>
<phase name="Security"/>
</phaseOrder>
<phaseOrder type="InFaultFlow">
<phase name="Addressing">
<handler name="AddressingBasedDispatcher"
class="org.apache.axis2.dispatchers.AddressingBasedDispatcher">
<order phase="Addressing"/>
</handler>
</phase>
<phase name="Security"/>
<phase name="PreDispatch"/>
<phase name="Dispatch" class="org.apache.axis2.engine.DispatchPhase">
<handler name="RequestURIBasedDispatcher"
class="org.apache.axis2.dispatchers.RequestURIBasedDispatcher"/>
<handler name="SOAPActionBasedDispatcher"
class="org.apache.axis2.dispatchers.SOAPActionBasedDispatcher"/>
<handler name="RequestURIOperationDispatcher"
class="org.apache.axis2.dispatchers.RequestURIOperationDispatcher"/>
<handler name="SOAPMessageBodyBasedDispatcher"
class="org.apache.axis2.dispatchers.SOAPMessageBodyBasedDispatcher"/>
<handler name="HTTPLocationBasedDispatcher"
class="org.apache.axis2.dispatchers.HTTPLocationBasedDispatcher"/>
<handler name="GenericProviderDispatcher"
class="org.apache.axis2.jaxws.dispatchers.GenericProviderDispatcher"/>
<handler name="MustUnderstandValidationDispatcher"
class="org.apache.axis2.jaxws.dispatchers.MustUnderstandValidationDispatcher"/>
</phase>
<phase name="RMPhase"/>
<!-- user can add his own phases to this area -->
<phase name="loggingPhase"/>
<phase name="OperationInFaultPhase"/>
<phase name="soapmonitorPhase"/>
</phaseOrder>
<phaseOrder type="OutFaultFlow">
<!-- user can add his own phases to this area -->
<phase name="loggingPhase"/>
<phase name="soapmonitorPhase"/>
<phase name="OperationOutFaultPhase"/>
<phase name="RMPhase"/>
<phase name="PolicyDetermination"/>
<phase name="MessageOut"/>
<phase name="Security"/>
</phaseOrder>
好大功告成。写一个call service的client 类
如果call完后你的log文件中出现了一下log证明我们的handler已经起作用了,记录了soap response and request message。 如果你想在别的service中使用这个module中的handler 只要在那个services.xml中引用logging这个module就ok了。
Soap Request[color=darkred][/color]<?xml version='1.0' encoding='utf-8'?><soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"><soapenv:Body><example1:sayHello xmlns:example1="http://example1.org/example1"><example1:personToGreet>John</example1:personToGreet></example1:sayHello></soapenv:Body></soapenv:Envelope>
[INFO] <?xml version='1.0' encoding='utf-8'?><soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"><soapenv:Body><example1:sayHello xmlns:example1="http://example1.org/example1"><example1:personToGreet>John</example1:personToGreet></example1:sayHello></soapenv:Body></soapenv:Envelope>
Reading sayHello element
Soap Response<?xml version='1.0' encoding='utf-8'?><soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"><soapenv:Body><example1:sayHelloResponse xmlns:example1="http://example1.org/example1"><example1:greeting>Hello,John</example1:greeting></example1:sayHelloResponse></soapenv:Body></soapenv:Envelope>
[INFO] <?xml version='1.0' encoding='utf-8'?><soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"><soapenv:Body><example1:sayHelloResponse xmlns:example1="http://example1.org/example1"><example1:greeting>Hello,John</example1:greeting></example1:sayHelloResponse></soapenv:Body></soapenv:Envelope>
经验总结,在许多情况下我们打出来的aar,跟mar 放在axis2的web-inf目录下,在axis在启动时会报aar中的services.xml 找不到,同样在mar中报module.xml找不到,在这种情况下,你直接把aar,或者mar解压开来放一个普通的文件夹中,直接把这个文件夹放到axis2的相应目录下,就ok了。
1.给module写一个单独的配置文件(module.xml),放在source 同目录下的META-INF 文件中
<module name="logging" class="com.bank.webservice.LoggingModule"> <InFlow> <handler name="InFlowLogHandler" class="com.bank.webservice.LogHandler"> <order phase="loggingPhase"/> </handler> </InFlow> <OutFlow> <handler name="OutFlowLogHandler" class="com.bank.webservice.LogHandler"> <order phase="loggingPhase"/> </handler> </OutFlow> <OutFaultFlow> <handler name="FaultOutFlowLogHandler" class="com.bank.webservice.LogHandler"> <order phase="loggingPhase"/> </handler> </OutFaultFlow> <InFaultFlow> <handler name="FaultInFlowLogHandler" class="com.bank.webservice.LogHandler"> <order phase="loggingPhase"/> </handler> </InFaultFlow> </module>
2.实现你的自己的Module extends from org.apache.axis2.modules.Module
import org.apache.axis2.AxisFault; import org.apache.axis2.context.ConfigurationContext; import org.apache.axis2.description.AxisDescription; import org.apache.axis2.description.AxisModule; import org.apache.axis2.modules.Module; import org.apache.neethi.Assertion; import org.apache.neethi.Policy; public class LoggingModule implements Module { // initialize the module public void init(ConfigurationContext configContext, AxisModule module) throws AxisFault { System.out.println("init"); } public void engageNotify(AxisDescription axisDescription) throws AxisFault { } // shutdown the module public void shutdown(ConfigurationContext configurationContext) throws AxisFault { System.out.println("shutdown"); } public String[] getPolicyNamespaces() { return null; } public void applyPolicy(Policy policy, AxisDescription axisDescription) throws AxisFault { } public boolean canSupportAssertion(Assertion assertion) { return true; } }
3.实现你的handler记录SOAP request and response Message.
import org.apache.axis2.AxisFault; import org.apache.axis2.context.MessageContext; import org.apache.axis2.engine.Handler; import org.apache.axis2.handlers.AbstractHandler; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; public class LogHandler extends AbstractHandler implements Handler { private static final Log log = LogFactory.getLog(LogHandler.class); private String name; public String getName() { return name; } public InvocationResponse invoke(MessageContext msgContext) throws AxisFault { // 向Tomcat控制台输出请求和响应SOAP消息 System.out.println("Soap Request" + msgContext.getEnvelope().toString()); log.info(msgContext.getEnvelope().toString()); return InvocationResponse.CONTINUE; } public void revoke(MessageContext msgContext) { System.out.println("Soap Response" + msgContext.getEnvelope().toString()); log.info(msgContext.getEnvelope().toString()); } public void setName(String name) { this.name = name; } } [b]把以上module相关的东西用 "jar cvf logging.mar ." 打成一个mar的包。 注意一定要把module.xml放在跟source同目录的META-INF 文件中。然后把mar文件放在 tomcat下的webapp/axis2/WEB-INF/modules下。[/b] [img] d:/source.JPG [/img]
Service Class的实现类
import org.apache.axiom.om.OMAbstractFactory; import org.apache.axiom.om.OMElement; import org.apache.axiom.om.OMFactory; import org.apache.axiom.om.OMNamespace; import org.apache.xmlbeans.xml.stream.XMLStreamException; public class SampleService { public OMElement sayHello(OMElement element) { element.build(); element.detach(); String rootName = element.getLocalName(); System.out.println("Reading " + rootName + " element"); OMElement childElement = element.getFirstElement(); String personToGreet = childElement.getText(); OMFactory fac = OMAbstractFactory.getOMFactory(); OMNamespace omNs = fac.createOMNamespace( "http://example1.org/example1", "example1"); OMElement method = fac.createOMElement("sayHelloResponse", omNs); OMElement value = fac.createOMElement("greeting", omNs); value.addChild(fac.createOMText(value, "Hello," + personToGreet)); method.addChild(value); return method; } }
部署此service需要的services.xml
<service name="SampleService">
<description>
This is a sample service created in the Axis2 User's Guide
</description>
<module ref="logging"/>
<parameter name="ServiceClass">com.bank.webservice.SampleService</parameter>
<operation name="sayHello">
<messageReceiver class="org.apache.axis2.receivers.RawXMLINOutMessageReceiver"/>
<actionMapping>urn:sayHello</actionMapping>
</operation>
<operation name="ping">
<messageReceiver class="org.apache.axis2.receivers.RawXMLINOnlyMessageReceiver"/>
<actionMapping>urn:ping</actionMapping>
</operation>
</service>
注意<module ref="logging"/>配置来在此service中使用logging 这个module
用jar cvf 命令把此service打成一个aar包部署在tomcat 下的webapp/axis2/WEB-INF/services 文件下。
此外还要修改axis2.xml 加入我们的handler起作用的phase "loggingPhase"(红色配置).
<phaseOrder type="InFlow">
<!-- System predefined phases -->
<phase name="Transport">
<handler name="RequestURIBasedDispatcher"
class="org.apache.axis2.dispatchers.RequestURIBasedDispatcher">
<order phase="Transport"/>
</handler>
<handler name="SOAPActionBasedDispatcher"
class="org.apache.axis2.dispatchers.SOAPActionBasedDispatcher">
<order phase="Transport"/>
</handler>
</phase>
<phase name="Addressing">
<handler name="AddressingBasedDispatcher"
class="org.apache.axis2.dispatchers.AddressingBasedDispatcher">
<order phase="Addressing"/>
</handler>
</phase>
<phase name="Security"/>
<phase name="PreDispatch"/>
<phase name="Dispatch" class="org.apache.axis2.engine.DispatchPhase">
<handler name="RequestURIBasedDispatcher"
class="org.apache.axis2.dispatchers.RequestURIBasedDispatcher"/>
<handler name="SOAPActionBasedDispatcher"
class="org.apache.axis2.dispatchers.SOAPActionBasedDispatcher"/>
<handler name="RequestURIOperationDispatcher"
class="org.apache.axis2.dispatchers.RequestURIOperationDispatcher"/>
<handler name="SOAPMessageBodyBasedDispatcher"
class="org.apache.axis2.dispatchers.SOAPMessageBodyBasedDispatcher"/>
<handler name="HTTPLocationBasedDispatcher"
class="org.apache.axis2.dispatchers.HTTPLocationBasedDispatcher"/>
<handler name="GenericProviderDispatcher"
class="org.apache.axis2.jaxws.dispatchers.GenericProviderDispatcher"/>
<handler name="MustUnderstandValidationDispatcher"
class="org.apache.axis2.jaxws.dispatchers.MustUnderstandValidationDispatcher"/>
</phase>
<phase name="RMPhase"/>
<!-- System predefined phases -->
<!-- After Postdispatch phase module author or service author can add any phase he want -->
<phase name="userDefinedMessageInPhase"/>
<phase name="loggingPhase"/>
<phase name="OperationInPhase">
<handler name="MustUnderstandChecker"
class="org.apache.axis2.jaxws.dispatchers.MustUnderstandChecker">
<order phase="OperationInPhase"/>
</handler>
</phase>
<phase name="soapmonitorPhase"/>
</phaseOrder>
<phaseOrder type="OutFlow">
<!-- user can add his own phases to this area -->
<phase name="userDefinedMessageOutPhase"/>
<phase name="loggingPhase"/>
<phase name="soapmonitorPhase"/>
<phase name="OperationOutPhase"/>
<!--system predefined phase-->
<!--these phase will run irrespective of the service-->
<phase name="RMPhase"/>
<phase name="PolicyDetermination"/>
<phase name="MessageOut"/>
<phase name="Security"/>
</phaseOrder>
<phaseOrder type="InFaultFlow">
<phase name="Addressing">
<handler name="AddressingBasedDispatcher"
class="org.apache.axis2.dispatchers.AddressingBasedDispatcher">
<order phase="Addressing"/>
</handler>
</phase>
<phase name="Security"/>
<phase name="PreDispatch"/>
<phase name="Dispatch" class="org.apache.axis2.engine.DispatchPhase">
<handler name="RequestURIBasedDispatcher"
class="org.apache.axis2.dispatchers.RequestURIBasedDispatcher"/>
<handler name="SOAPActionBasedDispatcher"
class="org.apache.axis2.dispatchers.SOAPActionBasedDispatcher"/>
<handler name="RequestURIOperationDispatcher"
class="org.apache.axis2.dispatchers.RequestURIOperationDispatcher"/>
<handler name="SOAPMessageBodyBasedDispatcher"
class="org.apache.axis2.dispatchers.SOAPMessageBodyBasedDispatcher"/>
<handler name="HTTPLocationBasedDispatcher"
class="org.apache.axis2.dispatchers.HTTPLocationBasedDispatcher"/>
<handler name="GenericProviderDispatcher"
class="org.apache.axis2.jaxws.dispatchers.GenericProviderDispatcher"/>
<handler name="MustUnderstandValidationDispatcher"
class="org.apache.axis2.jaxws.dispatchers.MustUnderstandValidationDispatcher"/>
</phase>
<phase name="RMPhase"/>
<!-- user can add his own phases to this area -->
<phase name="loggingPhase"/>
<phase name="OperationInFaultPhase"/>
<phase name="soapmonitorPhase"/>
</phaseOrder>
<phaseOrder type="OutFaultFlow">
<!-- user can add his own phases to this area -->
<phase name="loggingPhase"/>
<phase name="soapmonitorPhase"/>
<phase name="OperationOutFaultPhase"/>
<phase name="RMPhase"/>
<phase name="PolicyDetermination"/>
<phase name="MessageOut"/>
<phase name="Security"/>
</phaseOrder>
好大功告成。写一个call service的client 类
import javax.xml.stream.XMLStreamException; import org.apache.axiom.om.OMAbstractFactory; import org.apache.axiom.om.OMElement; import org.apache.axiom.om.OMFactory; import org.apache.axiom.om.OMNamespace; import org.apache.axis2.addressing.EndpointReference; import org.apache.axis2.client.Options; import org.apache.axis2.Constants; import org.apache.axis2.client.ServiceClient; public class SampleClient { private static EndpointReference targetEPR = new EndpointReference( "http://localhost:8080/axis2/services/SampleService"); public static OMElement greetUserPayload(String personToGreet) { OMFactory fac = OMAbstractFactory.getOMFactory(); OMNamespace omNs = fac.createOMNamespace( "http://example1.org/example1", "example1"); OMElement method = fac.createOMElement("sayHello", omNs); OMElement value = fac.createOMElement("personToGreet", omNs); value.addChild(fac.createOMText(value, personToGreet)); method.addChild(value); return method; } public static void main(String[] args) { try { OMElement payload = SampleClient.greetUserPayload("John"); Options options = new Options(); options.setTo(targetEPR); options.setTransportInProtocol(Constants.TRANSPORT_HTTP); ServiceClient sender = new ServiceClient(); sender.setOptions(options); OMElement result = sender.sendReceive(payload); String response = result.getFirstElement().getText(); System.out.println(response); } catch (Exception e) { //(XMLStreamException e) { System.out.println(e.toString()); } } }
如果call完后你的log文件中出现了一下log证明我们的handler已经起作用了,记录了soap response and request message。 如果你想在别的service中使用这个module中的handler 只要在那个services.xml中引用logging这个module就ok了。
Soap Request[color=darkred][/color]<?xml version='1.0' encoding='utf-8'?><soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"><soapenv:Body><example1:sayHello xmlns:example1="http://example1.org/example1"><example1:personToGreet>John</example1:personToGreet></example1:sayHello></soapenv:Body></soapenv:Envelope>
[INFO] <?xml version='1.0' encoding='utf-8'?><soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"><soapenv:Body><example1:sayHello xmlns:example1="http://example1.org/example1"><example1:personToGreet>John</example1:personToGreet></example1:sayHello></soapenv:Body></soapenv:Envelope>
Reading sayHello element
Soap Response<?xml version='1.0' encoding='utf-8'?><soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"><soapenv:Body><example1:sayHelloResponse xmlns:example1="http://example1.org/example1"><example1:greeting>Hello,John</example1:greeting></example1:sayHelloResponse></soapenv:Body></soapenv:Envelope>
[INFO] <?xml version='1.0' encoding='utf-8'?><soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"><soapenv:Body><example1:sayHelloResponse xmlns:example1="http://example1.org/example1"><example1:greeting>Hello,John</example1:greeting></example1:sayHelloResponse></soapenv:Body></soapenv:Envelope>
经验总结,在许多情况下我们打出来的aar,跟mar 放在axis2的web-inf目录下,在axis在启动时会报aar中的services.xml 找不到,同样在mar中报module.xml找不到,在这种情况下,你直接把aar,或者mar解压开来放一个普通的文件夹中,直接把这个文件夹放到axis2的相应目录下,就ok了。
评论
1 楼
ade921068180
2012-11-07
我几乎按照你的配置完了,程序是自己写的,可以总是报下面的错:
[ERROR] The logging.mar module, which is not valid, caused server.Authentication
Handler cannot be cast to org.apache.axis2.modules.Module
org.apache.axis2.deployment.DeploymentException: server.AuthenticationHandler ca
nnot be cast to org.apache.axis2.modules.Module
at org.apache.axis2.deployment.repository.util.ArchiveReader.readModuleA
rchive(ArchiveReader.java:531)
at org.apache.axis2.deployment.ModuleDeployer.deploy(ModuleDeployer.java
:71)
at org.apache.axis2.deployment.repository.util.DeploymentFileData.deploy
(DeploymentFileData.java:136)
at org.apache.axis2.deployment.DeploymentEngine.doDeploy(DeploymentEngin
e.java:597)
at org.apache.axis2.deployment.RepositoryListener.init(RepositoryListene
r.java:237)
at org.apache.axis2.deployment.RepositoryListener.init2(RepositoryListen
er.java:68)
at org.apache.axis2.deployment.RepositoryListener.<init>(RepositoryListe
ner.java:63)
at org.apache.axis2.deployment.DeploymentEngine.loadRepository(Deploymen
tEngine.java:147)
at org.apache.axis2.deployment.WarBasedAxisConfigurator.getAxisConfigura
tion(WarBasedAxisConfigurator.java:229)
at org.apache.axis2.context.ConfigurationContextFactory.createConfigurat
ionContext(ConfigurationContextFactory.java:68)
at org.apache.axis2.transport.http.AxisServlet.initConfigContext(AxisSer
vlet.java:516)
at org.apache.axis2.transport.http.AxisServlet.init(AxisServlet.java:436
)
at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.
java:1048)
at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:95
0)
at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContex
t.java:4074)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:4
379)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase
.java:791)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:77
1)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:525)
at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.jav
a:920)
at org.apache.catalina.startup.HostConfig.deployDirectories(HostConfig.j
ava:883)
at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:492
)
at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1138)
at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java
:311)
at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(Lifecycl
eSupport.java:117)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1053)
at org.apache.catalina.core.StandardHost.start(StandardHost.java:719)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443
)
at org.apache.catalina.core.StandardService.start(StandardService.java:5
23)
at org.apache.catalina.core.StandardServer.start(StandardServer.java:709
)
at org.apache.catalina.startup.Catalina.start(Catalina.java:572)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
sorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:288)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:413)
Caused by: org.apache.axis2.deployment.DeploymentException: server.Authenticatio
nHandler cannot be cast to org.apache.axis2.modules.Module
at org.apache.axis2.deployment.ModuleBuilder.populateModule(ModuleBuilde
r.java:221)
at org.apache.axis2.deployment.repository.util.ArchiveReader.readModuleA
rchive(ArchiveReader.java:518)
... 37 more
Caused by: org.apache.axis2.deployment.DeploymentException: server.Authenticatio
nHandler cannot be cast to org.apache.axis2.modules.Module
at org.apache.axis2.deployment.ModuleBuilder.loadModuleClass(ModuleBuild
er.java:84)
at org.apache.axis2.deployment.ModuleBuilder.populateModule(ModuleBuilde
r.java:102)
... 38 more
Caused by: java.lang.ClassCastException: server.AuthenticationHandler cannot be
cast to org.apache.axis2.modules.Module
at org.apache.axis2.deployment.ModuleBuilder$1.run(ModuleBuilder.java:74
)
at org.apache.axis2.java.security.AccessController.doPrivileged(AccessCo
ntroller.java:132)
at org.apache.axis2.deployment.ModuleBuilder.loadModuleClass(ModuleBuild
er.java:72)
... 39 more
这是为什么呀?
[ERROR] The logging.mar module, which is not valid, caused server.Authentication
Handler cannot be cast to org.apache.axis2.modules.Module
org.apache.axis2.deployment.DeploymentException: server.AuthenticationHandler ca
nnot be cast to org.apache.axis2.modules.Module
at org.apache.axis2.deployment.repository.util.ArchiveReader.readModuleA
rchive(ArchiveReader.java:531)
at org.apache.axis2.deployment.ModuleDeployer.deploy(ModuleDeployer.java
:71)
at org.apache.axis2.deployment.repository.util.DeploymentFileData.deploy
(DeploymentFileData.java:136)
at org.apache.axis2.deployment.DeploymentEngine.doDeploy(DeploymentEngin
e.java:597)
at org.apache.axis2.deployment.RepositoryListener.init(RepositoryListene
r.java:237)
at org.apache.axis2.deployment.RepositoryListener.init2(RepositoryListen
er.java:68)
at org.apache.axis2.deployment.RepositoryListener.<init>(RepositoryListe
ner.java:63)
at org.apache.axis2.deployment.DeploymentEngine.loadRepository(Deploymen
tEngine.java:147)
at org.apache.axis2.deployment.WarBasedAxisConfigurator.getAxisConfigura
tion(WarBasedAxisConfigurator.java:229)
at org.apache.axis2.context.ConfigurationContextFactory.createConfigurat
ionContext(ConfigurationContextFactory.java:68)
at org.apache.axis2.transport.http.AxisServlet.initConfigContext(AxisSer
vlet.java:516)
at org.apache.axis2.transport.http.AxisServlet.init(AxisServlet.java:436
)
at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.
java:1048)
at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:95
0)
at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContex
t.java:4074)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:4
379)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase
.java:791)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:77
1)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:525)
at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.jav
a:920)
at org.apache.catalina.startup.HostConfig.deployDirectories(HostConfig.j
ava:883)
at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:492
)
at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1138)
at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java
:311)
at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(Lifecycl
eSupport.java:117)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1053)
at org.apache.catalina.core.StandardHost.start(StandardHost.java:719)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443
)
at org.apache.catalina.core.StandardService.start(StandardService.java:5
23)
at org.apache.catalina.core.StandardServer.start(StandardServer.java:709
)
at org.apache.catalina.startup.Catalina.start(Catalina.java:572)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
sorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:288)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:413)
Caused by: org.apache.axis2.deployment.DeploymentException: server.Authenticatio
nHandler cannot be cast to org.apache.axis2.modules.Module
at org.apache.axis2.deployment.ModuleBuilder.populateModule(ModuleBuilde
r.java:221)
at org.apache.axis2.deployment.repository.util.ArchiveReader.readModuleA
rchive(ArchiveReader.java:518)
... 37 more
Caused by: org.apache.axis2.deployment.DeploymentException: server.Authenticatio
nHandler cannot be cast to org.apache.axis2.modules.Module
at org.apache.axis2.deployment.ModuleBuilder.loadModuleClass(ModuleBuild
er.java:84)
at org.apache.axis2.deployment.ModuleBuilder.populateModule(ModuleBuilde
r.java:102)
... 38 more
Caused by: java.lang.ClassCastException: server.AuthenticationHandler cannot be
cast to org.apache.axis2.modules.Module
at org.apache.axis2.deployment.ModuleBuilder$1.run(ModuleBuilder.java:74
)
at org.apache.axis2.java.security.AccessController.doPrivileged(AccessCo
ntroller.java:132)
at org.apache.axis2.deployment.ModuleBuilder.loadModuleClass(ModuleBuild
er.java:72)
... 39 more
这是为什么呀?
相关推荐
标题中的“axis2学习——开发自定义的axis2服务”表明了本文主要涉及Apache Axis2框架,这是一个用于构建Web服务和SOA(Service-Oriented Architecture)应用的开放源码平台。Axis2允许开发者创建、部署和管理服务,...
### Axis2 SOAP技术详解 #### 一、Axis2概述 Axis2是一款开源的Web服务框架,主要用于构建基于SOAP协议的服务端应用。它支持多种传输协议(如HTTP、JMS等)以及多种数据编码方式(如XML、JSON等)。Axis2在Java...
Apache Axis2是Apache SOAP项目的第二代实现,提供了强大的Web服务引擎,支持多种协议,包括SOAP 1.1和1.2。除此之外,它还引入了对RESTful风格的服务的支持,使得服务开发者能够灵活选择适合的通信方式。 **2. ...
AXIS2是Apache软件基金会开发的一个开源Web服务框架,它提供了SOAP服务的实现和客户端工具,使得开发者能够方便地创建、部署和消费SOAP服务。 在Java开发环境中,IntelliJ IDEA(IDEA)是一款广泛使用的集成开发...
在实际应用中,可能需要编写自定义代码来实现消息的生产和消费,同时配置Websphere MQ和Axis2的相关设置。这可能涉及到创建JNDI上下文、设置MQ连接工厂、配置消息监听器等步骤。`基于soap over jms 的websphere mq与...
Axis2是Apache软件基金会开发的一个开源Web服务引擎,它提供了基于SOAP(Simple Object Access Protocol)的Web服务实现。本文将详细介绍Axis2的API及其在Web服务开发中的应用,同时也会探讨Axis2的帮助文档如何协助...
【标题】中的“基于axis2实现的webservice简单实现(客户端+服务端)”表明了本文将探讨如何使用Apache Axis2框架来创建和消费Web服务。Apache Axis2是Apache软件基金会开发的一个Web服务引擎,它提供了高效且灵活的...
总的来说,Axis2 是一个强大的工具,为开发者提供了在 Java 平台上实现 WebService 请求的便利。理解其工作原理和使用方法是提升你在 IT 领域尤其是企业级应用开发中的技能的重要一步。通过实践和探索提供的资源包,...
标题 "Axis2-1.6.2" 指的是Apache Axis2的1.6.2版本,这是一个开源的Web服务引擎,专为构建高效、高性能的SOAP(Simple Object Access Protocol)服务而设计。SOAP是一种基于XML的协议,用于在Web上交换结构化的和...
为了更好地理解如何在Axis框架下使用自定义数组对象,我们将通过一个具体的示例来逐步解析其工作原理。 **1. 定义自定义数组对象** ```java public class Bean implements Serializable { private int id; ...
Axis2/C supports both SOAP 1.1 and SOAP 1.2. The soap processing model is built on the AXIOM XML object model. Axis2/C is capable of handling one-way messaging (In-Only) as well as request ...
2. **Module**: 模块是Axis2中实现特定功能的可插入组件,例如安全、事务处理或消息编码。它们可以被附加到服务上,提供额外的服务行为。 3. **Transport**: 传输层负责实际的消息发送和接收,Axis2内置了HTTP和...
3. **消息处理**:理解Axis2中的消息处理流程,包括Message Receiver、Message Context和Handler链。 4. **模块和服务组件**:学习如何编写自定义模块以扩展Axis2的功能,以及如何使用Service Archive(SAR)和Web ...
总结起来,AXIS2 RCP/literal样式中的两种MESSAGE定义方式对于开发和调试SOAP Web服务客户端至关重要。硬编码XML字符串适用于简单场景,而JOM更适合处理复杂的业务逻辑和数据结构。TCPMon作为一个实用的辅助工具,...
- 多协议支持:除了基本的SOAP 1.1和1.2,Axis2还支持REST、MTOM(Message Transmission Optimization Mechanism)和SwA(Soap with Attachments)等传输方式。 - 高效的消息处理:使用了基于内存的数据结构,Axis2...
本篇文章将详细介绍如何在Spring中集成Axis2来实现Web服务,并且会提及相关的Jar包。 首先,让我们理解Spring与Axis2集成的基础知识。Spring框架提供了一个服务导向架构(SOA)的支持,允许开发者轻松地创建和消费...
3. **消息处理器(Message Processor)**:这是 Axis2 处理 SOAP 消息的核心组件。源码中包含了各种处理器,如 In-only、In-out、Robust In-only 等,它们负责消息的接收、处理和响应。 4. **传输层(Transport)**...
Axis2/C supports both SOAP 1.1 and SOAP 1.2. The soap processing model is built on the AXIOM XML object model. Axis2/C is capable of handling one-way messaging (In-Only) as well as request ...
5. **Message Flow**:在Axis2中,消息从客户端到达服务端,经过一系列处理步骤,如解码SOAP消息、执行业务逻辑、编码回传消息等。 6. **Transport层**:Axis2支持多种传输机制,包括HTTP、HTTPS、JMS等。开发者...