java - Failed to start Restful service with cxf spring in osgi container -
i have created restful service maven, cxf , spring. maven archetype, choose quickstart. here pom.xml:
<groupid>com.example.examplebean</groupid> <artifactid>restexample</artifactid> <version>0.0.1-snapshot</version> <packaging>bundle</packaging> <build> <defaultgoal>install</defaultgoal> <plugins> <plugin> <groupid>org.apache.felix</groupid> <artifactid>maven-bundle-plugin</artifactid> <extensions>true</extensions> <configuration> <instructions> <bundle-symbolicname>${project.artifactid}</bundle-symbolicname> </instructions> </configuration> </plugin> </plugins> </build>
pom dependencies:
<dependency> <groupid>org.apache.cxf</groupid> <artifactid>cxf-rt-frontend-jaxrs</artifactid> <version>2.3.0</version> </dependency>
class:
package com.example.examplebean; import javax.ws.rs.get; import javax.ws.rs.path; @path("/example") public class restexample { @get @path("/") public string ping() throws exception { return "success"; } }
src/main/resources/meta-inf/spring/bundle-context.xml:
<?xml version="1.0" encoding="utf-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xmlns:jaxrs="http://cxf.apache.org/jaxrs" xmlns:context="http://www.springframework.org/schema/context" xsi:schemalocation=" http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd http://cxf.apache.org/jaxrs http://cxf.apache.org/schemas/jaxrs.xsd"> <import resource="classpath:meta-inf/cxf/cxf.xml" /> <import resource="classpath:meta-inf/cxf/cxf-extension-jaxrs-binding.xml" /> <import resource="classpath:meta-inf/cxf/cxf-extension-http.xml" /> <import resource="classpath:meta-inf/cxf/cxf-extension-http-jetty.xml" /> <import resource="classpath:meta-inf/cxf/cxf-servlet.xml"/> <bean id="examplebean" class="com.example.examplebean.restexample" /> <jaxrs:server id="exampleservice" address="/"> <jaxrs:servicebeans> <ref bean="examplebean" /> </jaxrs:servicebeans> </jaxrs:server> </beans>
maven install successful. when deploy bundle fuse esb karaf osgi container , start it, got:
[ 286] [active ] [ ] [failed ] [ 60] restexample (0.0.1.snapshot)
it failed start. can me this?
Comments
Post a Comment