目前,我正在karaf prject上工作,我已经部署了3个处于Active状态的捆绑模块数据,module-service和module-jaxrs,然后当我配置karaf功能以自动部署jar时,module-jaxrs的状态变为 失败是因为cxf。我已经尝试了所有方法,但总是遇到相同的错误。
诊断结果:
org.osgi.service.blueprint.container.ComponentDefinitionException: Unable to initialize bean cxf
at org.apache.aries.blueprint.container.BeanRecipe.runBeanProcInit(BeanRecipe.java:714)
at org.apache.aries.blueprint.container.BeanRecipe.internalCreate2(BeanRecipe.java:824)
at org.apache.aries.blueprint.container.BeanRecipe.internalCreate(BeanRecipe.java:787)
at org.apache.aries.blueprint.di.AbstractRecipe$1.call(AbstractRecipe.java:79)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at org.apache.aries.blueprint.di.AbstractRecipe.create(AbstractRecipe.java:88)
Caused by: org.apache.cxf.bus.extension.ExtensionException: Could not create object of extension class org.apache.cxf.ws.policy.PolicyEngineImpl.
at org.apache.cxf.bus.extension.Extension.load(Extension.java:241)
at org.apache.cxf.bus.osgi.CXFExtensionBundleListener$OSGiExtension.load(CXFExtensionBundleListener.java:145)
这是蓝图:
<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:jaxws="http://cxf.apache.org/blueprint/jaxws"
xmlns:jaxrs="http://cxf.apache.org/blueprint/jaxrs"
xmlns:cxf="http://cxf.apache.org/blueprint/core"
xsi:schemaLocation="
http://www.osgi.org/xmlns/blueprint/v1.0.0 http://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd
http://cxf.apache.org/blueprint/jaxws http://cxf.apache.org/schemas/blueprint/jaxws.xsd
http://cxf.apache.org/blueprint/jaxrs http://cxf.apache.org/schemas/blueprint/jaxrs.xsd
http://cxf.apache.org/blueprint/core http://cxf.apache.org/schemas/blueprint/core.xsd">
<!-- Configuration des logs CXF afin de faire apparaître les requetes recues et les reponses fournies, dans le journal de Karaf -->
<cxf:bus id="bus">
<cxf:features>
<cxf:logging/>
</cxf:features>
</cxf:bus>
<!-- Configuration du endpoint JAX-RS dans le container OSGI-->
<jaxrs:server address="/tuto" id="tut">
<jaxrs:serviceBeans>
<ref component-id="customerRestService"/>
</jaxrs:serviceBeans>
</jaxrs:server>
<!-- Declaration du bean customerRestService implemente par le POJO com.exemple.karaf.jaxrs.CustomerRestService-->
<!-- Ce bean possede une propriete a injecter. L'injection de cette propriete (ici une instance de la classe CustomerService) est faite
immediatement apres la creation du bean -->
<bean id="customerRestService" class="com.exemple.customerRestFulHibernateWS.jaxrs.CustomerRestService">
<property name="customerService" ref="customerService"/>
</bean>
<!-- Definition des dependances -->
<reference id="customerService" interface="com.exemple.customerRestFulHibernateWS.services.CustomerService"></reference>
</blueprint>