2013-09-20 5 views
0

ServiceMix 4.5.2에 배포하려고하는 JAX RS 서비스가 있는데 두 가지 오류로 인해 실패합니다. 나는 여러 가지 예제를 따르고 비교해 왔으며, 메이븐 아키타 입을 가지고 시작했지만, 오류나 대답을 찾을 수 없다.번들을 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에는 archetype에서 제공하는 다음 줄이 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 : 목록에있는 것과 일치합니다.

<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 디렉토리에 저장하십시오. 또는 example from camel과 같은 스프링 DM 구성을 사용할 수 있습니다.