neethi和WSO2 DStudio客户端存根问题

时间:2013-10-06 01:02:04

标签: wso2 axis2

我需要连接到具有相互身份验证安全策略的Web服务。

因此,我在maven java项目中的WSO2 Developer Studio 3.1.0中创建了一个存根客户端。 我的项目使用maven来管理我的依赖项,所以我包含了所需的库以使客户端工作,但我发现了一个有趣的问题。

如果我按照这个顺序放置这个neethi依赖项,那么一切正常:

<dependency>
    <groupId>org.apache.neethi.wso2</groupId>
    <artifactId>neethi</artifactId>
    <version>2.0.4.wso2v4</version>
</dependency>         
<dependency>
    <groupId>org.apache.neethi</groupId>
    <artifactId>neethi</artifactId>
    <version>3.0.2</version>
</dependency>

如果我更改了订单,我发现了这个错误:

Exception in thread "main" java.lang.ClassCastException: java.lang.Class cannot be cast to java.lang.reflect.ParameterizedType
    at org.apache.neethi.AssertionBuilderFactoryImpl.findAssertionBuilderTarget(AssertionBuilderFactoryImpl.java:145)
    at org.apache.neethi.AssertionBuilderFactoryImpl.invokeBuilder(AssertionBuilderFactoryImpl.java:134)
    at org.apache.neethi.AssertionBuilderFactoryImpl.build(AssertionBuilderFactoryImpl.java:117)
    at org.apache.neethi.PolicyBuilder.processOperationElement(PolicyBuilder.java:224)
    at org.apache.neethi.PolicyBuilder.getAllOperator(PolicyBuilder.java:184)
    at org.apache.neethi.PolicyBuilder.processOperationElement(PolicyBuilder.java:217)
    at org.apache.neethi.PolicyBuilder.getExactlyOneOperator(PolicyBuilder.java:180)
    at org.apache.neethi.PolicyBuilder.processOperationElement(PolicyBuilder.java:215)
    at org.apache.neethi.PolicyBuilder.getPolicyOperator(PolicyBuilder.java:174)
    at org.apache.neethi.PolicyBuilder.getPolicy(PolicyBuilder.java:113)
    at org.apache.neethi.PolicyBuilder.getPolicy(PolicyBuilder.java:99)
    at org.apache.neethi.PolicyEngine.getPolicy(PolicyEngine.java:78)
    at org.test.ws.recibews.RecibeWSServiceStub.getPolicy(RecibeWSServiceStub.java:292)
    at org.test.ws.recibews.RecibeWSServiceStub.populateAxisService(RecibeWSServiceStub.java:57)
    at org.test.ws.recibews.RecibeWSServiceStub.<init>(RecibeWSServiceStub.java:96)
    at org.test.ws.recibews.RecibeWSServiceStub.<init>(RecibeWSServiceStub.java:85)
    at org.test.ws.recibews.RecibeWSServiceStub.<init>(RecibeWSServiceStub.java:133)
    at org.test.webservicesTest.recibews_Test.recibews(recibews_Test.java:329)
    at org.test.webservicesTest.recibews_Test.obtienews(recibews_Test.java:120)
    at org.test.webservicesTest.recibews_Test.main(recibews_Test.java:88)   

我的问题是我需要在jar文件中打包这个实现,所以我在Eclipse STS中创建了一个可运行的jar文件但是当我运行jar时我看到了这个错误: 注意:如果我删除3.0.2 neethi依赖项,我的eclipse项目工作正常,但jar不行,下面有相同的错误。

Exception in thread "main" java.lang.reflect.InvocationTargetException
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
        at java.lang.reflect.Method.invoke(Unknown Source)
        at org.eclipse.jdt.internal.jarinjarloader.JarRsrcLoader.main(JarRsrcLoader.java:58)
Caused by: java.lang.NoSuchMethodError: org.apache.neethi.Constants.isPolicyElement(Ljavax/xml/namespace/QName;)Z
        at org.apache.axis2.util.PolicyUtil.getPolicyChildren(PolicyUtil.java:287)
        at org.apache.axis2.deployment.AxisConfigBuilder.populateConfig(AxisConfigBuilder.java:157)
        at org.apache.axis2.deployment.DeploymentEngine.populateAxisConfiguration(DeploymentEngine.java:857)
        at org.apache.axis2.deployment.FileSystemConfigurator.getAxisConfiguration(FileSystemConfigurator.java:116)
        at org.apache.axis2.context.ConfigurationContextFactory.createConfigurationContext(ConfigurationContextFactory.java:64)
        at org.apache.axis2.context.ConfigurationContextFactory.createConfigurationContextFromFileSystem(ConfigurationContextFactory.java:210)
        at org.apache.axis2.client.ServiceClient.configureServiceClient(ServiceClient.java:151)
        at org.apache.axis2.client.ServiceClient.<init>(ServiceClient.java:144)
        at org.test.ws.recibews.RecibeWSServiceStub.<init>(RecibeWSServiceStub.java:99)
        at org.test.ws.recibews.RecibeWSServiceStub.<init>(RecibeWSServiceStub.java:85)
        at org.test.ws.recibews.RecibeWSServiceStub.<init>(RecibeWSServiceStub.java:133)
        at org.test.webservicesTest.recibews_Test.recibews(recibews_Test.java:329)
        at org.test.webservicesTest.recibews_Test.obtienews(recibews_Test.java:120)
        at org.test.webservicesTest.recibews_Test.main(recibews_Test.java:88)
        ... 5 more

关于解决这个问题的任何想法??

感谢。

0 个答案:

没有答案