即使捆绑软件部署失败,ServiceMix软件包状态仍为“活动”

时间:2014-02-07 07:47:56

标签: osgi apache-karaf osgi-bundle apache-servicemix

我(故意创建了测试我的CI设置的情况)一个没有正确配置所有依赖项的包。部署时,部署失败并出现异常:

2014-02-07 09:17:15,738 | ERROR | rint Extender: 3 | BlueprintCamelContext            | 103 - org.apache.camel.camel-blueprint - 2.10.7 | Error occurred during starting Camel: CamelContext(ura) due "org.xmlsoap.schemas.soap.envelope" doesnt contain ObjectFactory.class or jaxb.index
javax.xml.bind.JAXBException: "org.xmlsoap.schemas.soap.envelope" doesnt contain ObjectFactory.class or jaxb.index
    at com.sun.xml.bind.v2.ContextFactory.createContext(ContextFactory.java:197)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)[:1.7.0_11]
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)[:1.7.0_11]
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)[:1.7.0_11]
    at java.lang.reflect.Method.invoke(Method.java:601)[:1.7.0_11]
    at javax.xml.bind.ContextFinder.newInstance(ContextFinder.java:143)[89:org.apache.servicemix.specs.jaxb-api-2.2:2.2.0]
    at javax.xml.bind.ContextFinder.find(ContextFinder.java:310)[89:org.apache.servicemix.specs.jaxb-api-2.2:2.2.0]
    at javax.xml.bind.JAXBContext.newInstance(JAXBContext.java:412)[89:org.apache.servicemix.specs.jaxb-api-2.2:2.2.0]
    at javax.xml.bind.JAXBContext.newInstance(JAXBContext.java:375)[89:org.apache.servicemix.specs.jaxb-api-2.2:2.2.0]
    at javax.xml.bind.JAXBContext.newInstance(JAXBContext.java:279)[89:org.apache.servicemix.specs.jaxb-api-2.2:2.2.0]
    at org.apache.camel.dataformat.soap.SoapJaxbDataFormat.createContext(SoapJaxbDataFormat.java:303)[206:org.apache.camel.camel-soap:2.10.7]
    at org.apache.camel.converter.jaxb.JaxbDataFormat.doStart(JaxbDataFormat.java:254)[187:org.apache.camel.camel-jaxb:2.10.7]
    at org.apache.camel.dataformat.soap.SoapJaxbDataFormat.doStart(SoapJaxbDataFormat.java:101)[206:org.apache.camel.camel-soap:2.10.7]
    at org.apache.camel.support.ServiceSupport.start(ServiceSupport.java:61)[100:org.apache.camel.camel-core:2.10.7]
    at org.apache.camel.util.ServiceHelper.startService(ServiceHelper.java:62)

问题是捆绑包状态仍为“活动”。为什么呢?

karaf@root> osgi:list 
START LEVEL 100 , List Threshold: 50
   ID   State         Blueprint      Spring    Level  Name
[ 242] [Active     ] [Created     ] [       ] [   80] integraatiot-foo (1.0.0.SNAPSHOT)

我想将CI版本设置为使用http://code.citytechinc.com/osgi-bundle-status-maven-plugin/检测失败的捆绑包。由于捆绑状态始终为“活动”,因此此想法失败。

2 个答案:

答案 0 :(得分:1)

捆绑包处于活动状态,因为它已被激活。这个是正常的。如果在束中的某些代码中发生错误,则与OSGi活动状态无关。

因此,您需要以某种方式报告内部故障,以便可以通过CI构建来获取它。我建议使用OSGi LogService。

答案 1 :(得分:0)

您需要确保所有依赖项都是必需的并且版本正确。 在这种情况下,您的导入包可能存在于错误版本中。 或者更好的是,您确保仅使用[2,3.0]导入正确版本的软件包。特别是堆栈跟踪让我怀疑你使用不带版本范围的导入,因此导入了通常版本为0.0.0的JRE jaxb类。 要检查shell中实际用于导入的哪些包,请执行一个包:header [bundleID]