2013-09-20 37 views
0

我有一個JAX RS服務,我試圖部署到ServiceMix 4.5.2,並且失敗並出現兩個錯誤。我一直在跟蹤和比較各種示例,並從一個maven原型開始,但我找不到錯誤或答案。將包部署到ServiceMix的錯誤

第一個錯誤;

2013-09-20 22:45:09,357 | ERROR | lixDispatchQueue | FeatureDeploymentListener  | 35 - org.apache.karaf.deployer.features - 2.2.11 | Unable to install deployed features for bundle: FleetInfoService - 1.0.0.SNAPSHOT 
java.lang.IllegalArgumentException: Malformed \uxxxx encoding. 
    at java.util.Properties.loadConvert(Properties.java:569)[:1.6.0_27] 
    at java.util.Properties.load0(Properties.java:391)[:1.6.0_27] 
    at java.util.Properties.load(Properties.java:342)[:1.6.0_27] 
    at org.apache.karaf.deployer.features.FeatureDeploymentListener.bundleChanged(FeatureDeploymentListener.java:171)[35:org.apache.karaf.deployer.features:2.2.11] 

我的POM有以下幾行wrt/encoding - 由原型提供;

<properties> 
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> 
    <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding> 
</properties> 

儘管存在此錯誤,它會嘗試加載bean定義並獲取此錯誤;

2013-09-20 22:45:10,551 | ERROR | ExtenderThread-3 | ContextLoaderListener   | 82 - org.springframework.osgi.extender - 1.2.1 | Application context refresh failed (OsgiBundleXmlApplicationContext(bundle=FleetInfoService, config=osgibundle:/META-INF/spring/*.xml)) 
org.springframework.beans.factory.parsing.BeanDefinitionParsingException: Configuration problem: Unable to locate Spring NamespaceHandler for XML schema namespace [http://www.osgi.org/xmlns/blueprint/v1.0.0] 
Offending resource: URL [bundle://200.0:0/META-INF/spring/camel-context.xml] 

camel-context.xml以以下內容開始,並且我再次檢查了拼寫錯誤;

<?xml version="1.0" encoding="UTF-8"?> 
<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0" 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
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/jaxrs http://cxf.apache.org/schemas/blueprint/jaxrs.xsd 
http://cxf.apache.org/blueprint/core http://cxf.apache.org/schemas/blueprint/core.xsd"> 

maven POM包含以下依賴項。駱駝/藍圖版本與我在ServiceMix的osgi:list中看到的版本相匹配;

<dependency> 
     <groupId>org.apache.camel</groupId> 
     <artifactId>camel-core</artifactId> 
     <version>2.10.6</version> 
    </dependency> 
    <dependency> 
     <groupId>org.apache.camel</groupId> 
     <artifactId>camel-blueprint</artifactId> 
     <version>2.10.6</version> 
    </dependency> 
    <dependency> 
     <groupId>org.apache.cxf</groupId> 
     <artifactId>cxf-rt-frontend-jaxrs</artifactId> 
     <version>2.7.6</version> 
    </dependency> 
    <dependency> 
     <groupId>javax.ws.rs</groupId> 
     <artifactId>jsr311-api</artifactId> 
     <version>1.1.1</version> 
    </dependency> 

POM插件是;

<plugins> 
     <plugin> 
      <groupId>org.apache.maven.plugins</groupId> 
      <artifactId>maven-compiler-plugin</artifactId> 
      <version>3.1</version> 
      <configuration> 
       <source>1.6</source> 
       <target>1.6</target> 
      </configuration> 
     </plugin> 
     <plugin> 
      <groupId>org.apache.maven.plugins</groupId> 
      <artifactId>maven-resources-plugin</artifactId> 
      <version>2.6</version> 
      <configuration> 
       <encoding>UTF-8</encoding> 
      </configuration> 
     </plugin> 
     <plugin> 
      <groupId>org.apache.karaf.tooling</groupId> 
      <artifactId>features-maven-plugin</artifactId> 
      <version>2.3.2</version> 
      <executions> 
       <execution> 
        <id>generate</id> 
        <phase>generate-resources</phase> 
        <goals> 
         <goal>generate-features-xml</goal> 
        </goals> 
        <configuration> 
         <!-- bundles>src/main/resources/bundles.properties</bundles --> 
         <outputFile>target/${project.artifactId}Features-${project.version}.xml</outputFile> 
        </configuration> 
       </execution> 
      </executions> 
     </plugin> 
     <plugin> 
      <groupId>org.apache.felix</groupId> 
      <artifactId>maven-bundle-plugin</artifactId> 
      <version>2.4.0</version> 
      <extensions>true</extensions> 
      <configuration> 
       <instructions> 
        <Bundle-SymbolicName>${project.artifactId}</Bundle-SymbolicName> 
        <Private-Package>${project.groupId}.*</Private-Package> 
        <Import-Package>*</Import-Package> 
       </instructions> 
      </configuration> 
     </plugin> 
    </plugins> 

回答

1

您應該查看$ SMX/data/cache/bundle/data中的FeatureDeploymentListener.cfg文件。它看起來像其中一個條目有不正確的內容。尋找\u序列或其他奇怪的字符序列。

錯誤的文件可能是您的pom.xml文件的結果(例如,您的artifactId包含\u)或者它可能只是被損壞。在後一種情況下,您可以輕鬆地刪除$ SMX/data/cache/bundle目錄並重新啓動ServiceMix。

第二個問題似乎是由於您將OSGI藍圖配置放入彈簧文件(META-INF/spring/camel-context.xml)引起的。如果您想使用藍圖,請將文件放在OSGI-INF/blueprint目錄中。或者,您可以使用Spring DM配置,如example from camel