将bundle部署到ServiceMix的错误

时间:2013-09-20 23:03:16

标签: maven jax-rs bundle apache-servicemix

我有一个JAX RS服务,我正在尝试部署到ServiceMix 4.5.2,它失败并出现两个错误。我一直在跟踪和比较各种例子,并从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>

1 个答案:

答案 0 :(得分:1)

您应该查看$ SMX / data / cache / bundle / data中的FeatureDeploymentListener.cfg文件。它看起来像其中一个条目有不正确的内容。查找\u序列或其他奇怪的字符序列。

不正确的文件可能是您的pom.xml的结果(例如,您的artifactId包含\u),或者它可能已损坏。在后一种情况下,您可以轻松删除$ SMX / data / cache / bundle目录并重新启动ServiceMix。

第二个问题似乎是由于您将OSGI蓝图配置放到spring文件(META-INF/spring/camel-context.xml)这一事实。如果要使用蓝图,请将文件放在OSGI-INF/blueprint目录中。或者,您可以使用像example from camel这样的Spring DM配置。