在创建restful client之后在maven中获得异常

时间:2013-12-04 09:58:59

标签: java apache rest maven cxfrs

我正在使用apache-tomee-jaxrs-1.5.2服务器并使用此下面的行在java中创建了restful客户端

Response response = WebClient.create("localhost:8080/test).path("/change/event").post(userdata);

我在pom.xml中包含了以下依赖项

 <dependency>
    <groupId>org.apache.cxf</groupId>
    <artifactId>cxf-rt-rs-client</artifactId>
    <version>3.0.0-milestone1</version>
</dependency>      

现在编译成功但是当我使用mvn tomee部署时:部署然后我得到了愚蠢的例外 localhost日志文件:http://www.docdroid.net/6snb/localhost-log.txt.html catalina日志文件:http://www.docdroid.net/6sne/cataline-log.txt.html

我不知道哪个依赖项存在问题,这里是我的pom.xml文件 http://www.docdroid.net/6soc/mypom.txt.html

catalina日志文件。

引起:java.lang.ExceptionInInitializerError     at org.apache.cxf.jaxrs.AbstractJAXRSFactoryBean.setupFactory(AbstractJAXRSFactoryBean.java:320)     at org.apache.cxf.jaxrs.JAXRSServerFactoryBean.create(JAXRSServerFactoryBean.java:163)     at org.apache.openejb.server.cxf.rs.CxfRsHttpListener.deploy(CxfRsHttpListener.java:164)     at org.apache.openejb.server.cxf.rs.CxfRsHttpListener.deployPojo(CxfRsHttpListener.java:110)     在org.apache.openejb.server.rest.RESTService.deployPojo(RESTService.java:436)     在org.apache.openejb.server.rest.RESTService.afterApplicationCreated(RESTService.java:248)     在org.apache.tomee.webservices.TomeeJaxRsService.afterApplicationCreated(TomeeJaxRsService.java:51)     ... 78更多

引起:java.lang.IllegalArgumentException:接口org.apache.cxf.jaxrs.impl.tl.ThreadLocalProxy在类加载器中不可见     at java.lang.reflect.Proxy.getProxyClass0(Proxy.java:484)     在java.lang.reflect.Proxy.newProxyInstance(Proxy.java:713)     at org.apache.cxf.jaxrs.utils.InjectionUtils.createThreadLocalProxy(InjectionUtils.java:875)     at org.apache.cxf.jaxrs.model.AbstractResourceInfo.addContextMethod(AbstractResourceInfo.java:163)     at org.apache.cxf.jaxrs.model.AbstractResourceInfo.checkContextMethod(AbstractResourceInfo.java:146)     at org.apache.cxf.jaxrs.model.AbstractResourceInfo.findContextSetterMethods(AbstractResourceInfo.java:132)     在org.apache.cxf.jaxrs.model.AbstractResourceInfo。(AbstractResourceInfo.java:65)     在org.apache.cxf.jaxrs.model.ProviderInfo。(ProviderInfo.java:29)     在org.apache.cxf.jaxrs.provider.ProviderFactory.initJaxbProviders(ProviderFactory.java:127)     在org.apache.cxf.jaxrs.provider.ProviderFactory。(ProviderFactory.java:117)     在org.apache.cxf.jaxrs.provider.ProviderFactory.getInstance(ProviderFactory.java:157)     在org.apache.cxf.jaxrs.provider.ProviderFactory。(ProviderFactory.java:71)     ... 85更多

1 个答案:

答案 0 :(得分:1)

您可以将提供的范围用作pom.xml中的依赖项。然后它将工作.e.g

 <dependency>
  <groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-frontend-jaxrs</artifactId>
<version>2.6.4</version>
<scope>provided</scope>
 </dependency>

使用提供的范围。