进行Web服务调用时出错

时间:2012-12-17 02:57:27

标签: java axis2 webservices-client

我正在使用axis2访问由其他人作为客户端公开的Web服务,并且我已经为abcStub .java创建了一个包装器方法(通过运行一些批处理生成Stub java文件)并尝试实例化Stub文件在包装器java文件中。但我得到以下错误:  

    INFO: ERROR org.apache.struts.actions.DispatchAction  - Dispatch[/remittanceTransaction] to method 'remTransApprove' returned an exception
    java.lang.reflect.InvocationTargetException
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:601)
    Caused by: java.lang.NoSuchMethodError: org.apache.neethi.PolicyEngine.getPolicy(Ljava/lang/Object;)Lorg/apache/neethi/Policy;
    at org.tempuri.MIRSRemittanceServicesStub.getPolicy(MIRSRemittanceServicesStub.java:3558)
    at org.tempuri.MIRSRemittanceServicesStub.populateAxisService(MIRSRemittanceServicesStub.java:57)
    at org.tempuri.MIRSRemittanceServicesStub.(MIRSRemittanceServicesStub.java:268)
    at org.tempuri.MIRSRemittanceServicesStub.(MIRSRemittanceServicesStub.java:257)
    at org.tempuri.MIRSRemittanceServicesStub.(MIRSRemittanceServicesStub.java:305)
    INFO: g.tempuri.MIRSRemittanceServicesStub.(MIRSRemittanceServicesStub.java:297)
    at com.mtmrs.webservice.MIRSRemittanceTransactionManagerImpl.getAppDeclWrapper(MIRSRemittanceTransactionManagerImpl.java:201)
    at com.mtmrs.business.backoffice.impl.RemittanceTransactionManagerImpl.remTransApprove(RemittanceTransactionManagerImpl.java:1417)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at com.mtmrs.application.backoffice.action.RemittanceTransactionAction.remTransApprove(RemittanceTransactionAction.java:1409)
    ... 78 more
    INFO: WARN  org.apache.struts.action.RequestProcessor  - Unhandled Exception thrown: class javax.servlet.ServletException
     WARNING: StandardWrapperValve[action]: PWC1406: Servlet.service() for servlet action threw exception
    java.lang.NoSuchMethodError: org.apache.neethi.PolicyEngine.getPolicy(Ljava/lang/Object;)Lorg/apache/neethi/Policy;
    at org.tempuri.MIRSRemittanceServicesStub.getPolicy(MIRSRemittanceServicesStub.java:3558)
    at org.tempuri.MIRSRemittanceServicesStub.populateAxisService(MIRSRemittanceServicesStub.java:57)
    at org.tempuri.MIRSRemittanceServicesStub.(MIRSRemittanceServicesStub.java:268)

我认为这个问题一定存在问题

org.apache.neethi.PolicyEngine.getPolicy(Ljava/lang/Object;)Lorg/apache/neethi/Policy; 

或者可能是我错了。无论哪种方式,不知道如何解决。如果有人知道面对/解决过这个问题会有很大的帮助。

我在接下来的电话中得到了这个:

public String getAppDeclWrapper(String session, String parentAgent, String mirsTxnNo, String strReason, String isApprove, String modifiedBY){ String returnString = null;
try {

         mtmrsLogger.info("Entering into Approve Decline procedure, Starting to send Status to MIRS");
               MIRSRemittanceServicesStub stub  = new MIRSRemittanceServicesStub(); //Error occurs at this line

               ApproveDecline approvedEcline = new ApproveDecline();
               ApproveDeclineResponse approveResponse =  new ApproveDeclineResponse();
               approvedEcline.setCParentAgent(parentAgent);
               approvedEcline.setMirsSession(session);
               approvedEcline.setModifiedBy(modifiedBY);
               approvedEcline.setRefNo(mirsTxnNo);
               approvedEcline.setStrReason(strReason);
               approvedEcline.setIsApprove(isApprove);

mtmrsLogger.info("Entering into Approve Decline procedure, Starting to send Status to MIRS"); MIRSRemittanceServicesStub stub = new MIRSRemittanceServicesStub(); //Error occurs at this line ApproveDecline approvedEcline = new ApproveDecline(); ApproveDeclineResponse approveResponse = new ApproveDeclineResponse(); approvedEcline.setCParentAgent(parentAgent); approvedEcline.setMirsSession(session); approvedEcline.setModifiedBy(modifiedBY); approvedEcline.setRefNo(mirsTxnNo); approvedEcline.setStrReason(strReason); approvedEcline.setIsApprove(isApprove);

1 个答案:

答案 0 :(得分:1)

我猜您的类路径上有多个版本(或无效版本)的PolicyEngine。我认为你在servlet引擎中运行。请尝试以下代码来确定此版本的存储位置并进行修复:

org.apache.neethi.PolicyEngine.class.getProtectionDomain().getCodeSource().getLo‌​cation()