我有一个试图部署到 ServiceMix 4.5.2 的 JAX RS 服务,但它失败并出现两个错误。我一直在关注并与各种示例进行比较,并从 Maven 原型开始,但我找不到错误或答案。
第一个错误;
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>