我有一個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>