日期:2014-05-17  浏览次数:21116 次

用axis2打包发布时,报错: cannot be cast to org.apache.axis2.engine.MessageReceiver
用axis2的eclipse插件Axis2_Service_Archiver打包后,将生成的SayHello.aar放在tomcat安装目录下的\webapps\axis2\WEB-INF\services\。打开浏览器,输入 http://127.0.0.1:8080/axis2 ,并点击其中的“services”链接查看SayHello是否被部署时,报错:

Error: org.apache.axis2.deployment.DeploymentException: org.example.www.sayhello.SayHelloMessageReceiverInOut cannot be cast to org.apache.axis2.engine.MessageReceiver at org.apache.axis2.deployment.repository.util.ArchiveReader.processServiceGroup(ArchiveReader.java:151) at org.apache.axis2.deployment.ServiceDeployer.deploy(ServiceDeployer.java:81) at org.apache.axis2.deployment.repository.util.DeploymentFileData.deploy(DeploymentFileData.java:136) at org.apache.axis2.deployment.DeploymentEngine.doDeploy(DeploymentEngine.java:597) at org.apache.axis2.deployment.repository.util.WSInfoList.update(WSInfoList.java:144) at org.apache.axis2.deployment.RepositoryListener.update(RepositoryListener.java:330) at org.apache.axis2.deployment.RepositoryListener.checkServices(RepositoryListener.java:227) at org.apache.axis2.deployment.RepositoryListener.startListener(RepositoryListener.java:324) at org.apache.axis2.deployment.scheduler.SchedulerTask.checkRepository(SchedulerTask.java:64) at org.apache.axis2.deployment.scheduler.SchedulerTask.run(SchedulerTask.java:71) at org.apache.axis2.deployment.scheduler.Scheduler$SchedulerTimerTask.run(Scheduler.java:83) at java.util.TimerThread.mainLoop(Unknown Source) at java.util.TimerThread.run(Unknown Source) Caused by: java.lang.ClassCastException: org.example.www.sayhello.SayHelloMessageReceiverInOut cannot be cast to org.apache.axis2.engine.MessageReceiver at org.apache.axis2.deployment.DescriptionBuilder.loadMessageReceiver(DescriptionBuilder.java:192) at org.apache.axis2.deployment.DescriptionBuilder.processMessageReceivers(DescriptionBuilder.java:171) at org.apache.axis2.deployment.ServiceBuilder.populateService(ServiceBuilder.java:275) at org.apache.axis2.deployment.ServiceGroupBuilder.populateServiceGroup(ServiceGroupBuilder.java:101) at org.apache.axis2.deployment.repository.util.ArchiveReader.buildServiceGroup(ArchiveReader.java:110) at org.apache.axis2.deployment.repository.util.ArchiveReader.processServiceGroup(ArchiveReader.java:144) ... 12 more 


SayHello.aar的目录结构:
 ├-[lib]
 ├-[META-INF]
 │ ├-[MANIFEST.MF]
 │ ├-[SayHello.wsdl]
 │ └-[services.xml]
 └-[org]
  └-[example]
  └-[www]
  └-[sayhello]
  ├-[ExtensionMapper.class]
  ├-[SayHello$1.class]
  ├-[SayHello$Factory.class]
  ├-[SayHello.class]
  ├-[SayHelloMessageReceiverInOut.class]
  ├-[SayHelloResponse$1.class]
  ├-[SayHelloResponse$Factory.class]
  ├-[SayHelloResponse.class]
  ├-[SayHelloSkeleton.class]
  ├-[SayHelloStub$ExtensionMapper.class]
  ├-[SayHelloStub$SayHello$1.class]
  ├-[SayHelloStub$SayHello$Factory.class]
  ├-[SayHelloStub$SayHello.class]
  ├-[SayHelloStub$SayHelloResponse$1.class]
  ├-[SayHelloStub$SayHelloResponse$Factory.class]
  ├-[SayHelloStub$SayHelloResponse.class]
  └-[SayHelloStub.class]

请大家帮忙看一下,这个是错在哪里了?

多谢



------解决方案--------------------
不知道,帮顶