2016-10-01 64 views
0

我在使用「org.apache.cxf.archetype:cxf-jaxrs-service」maven原型構建一個RESTful Web服務。當我在Apache Tomee部署它,我得到以下錯誤:錯誤在Apache Tomee上運行CXF REST Web服務

SEVERE: Context initialization failed org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'services': Invocation of init method failed; nested exception is org.apache.cxf.service.factory.ServiceConstructionException ... ... Caused by: org.apache.cxf.service.factory.ServiceConstructionException at org.apache.cxf.jaxrs.JAXRSServerFactoryBean.create(JAXRSServerFactoryBean.java:219) ... ... Caused by: java.lang.ClassCastException: Cannot cast org.apache.cxf.management.jmx.InstrumentationManagerImpl to org.apache.cxf.management.InstrumentationManager*

我的猜測是我錯過了一些配置,但我以爲原型會「只是工作」。

任何想法?

回答

1

此錯誤表示您在webapp(WEB-INF/lib)和tomee中的cxf之間存在衝突。您必須配置classloading來做到這一點,或者(由EE推薦和期望的),只需從Web應用程序中移除CXF,因爲它正處於正常工作狀態,並且tomee爲您完成了這項工作。

備註:您還可能需要清理web.xml,因爲tomee將處理部署而無需註冊servlet。