HI i am trying to Implementing a simple Rest service that returns a JSON response on fuse. Following is my POM.xml
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.fuse.test</groupId>
<artifactId>fuse-hw</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>bundle</packaging>
<dependencies>
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-cxf</artifactId>
<version>2.15.0</version>
</dependency>
<dependency>
<groupId>org.codehaus.jackson</groupId>
<artifactId>jackson-jaxrs</artifactId>
<version>1.9.10</version>
</dependency>
<dependency>
<groupId>org.codehaus.jackson</groupId>
<artifactId>jackson-mapper-asl</artifactId>
<version>1.9.12</version>
</dependency>
<dependency>
<groupId>org.codehaus.jackson</groupId>
<artifactId>jackson-core-asl</artifactId>
<version>1.9.12</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
</plugin>
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<extensions>true</extensions>
<version>2.4.0</version>
<configuration>
<instructions>
<Export-Package></Export-Package>
</instructions>
</configuration>
</plugin>
</plugins>
</build>
and the application.xml under /resources/META-INF/spring is
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:jaxrs="http://cxf.apache.org/jaxrs"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
http://cxf.apache.org/jaxrs http://cxf.apache.org/schemas/jaxrs.xsd">
<jaxrs:server id="restService" address="http://localhost:9000/lastmile">
<jaxrs:serviceBeans>
<ref bean="lastMileService" />
</jaxrs:serviceBeans>
<jaxrs:providers>
<ref bean="jacksonJsonProvider" />
</jaxrs:providers>
</jaxrs:server>
<bean id="lastMileService" class="com.fuse.test.RestService" />
<bean id="jacksonJsonProvider" class="org.codehaus.jackson.jaxrs.JacksonJsonProvider" />
When i install the bundle on Fuse i get the following error
**Error executing command: Error starting bundles:
Unable to start bundle 315: Unresolved constraint in bundle org.fuse.test.fuse-hw [315]:
Unable to resolve 315.0: missing requirement [315.0] osgi.wiring.package; (&
(osgi.wiring.package=org.codehaus.jackson.jaxrs)(version>=1.9.0)(!(version>=2.0.0)))**
Please assist on how this can be resolved. Also are there any good tutorials / Training videos for FUSE / Karaf. The information around OSGI seems to be very limited on the internet.
I figured it out, the issue was the version of jackson i was using was different from what was prebuilt in the fuse 6.3. use the following command to find out the version of the library you have installed in the fuse karaf env
JBossFuse:karaf@root> list -l | grep -i "jackson"
[ 146] [Active ] [ ] [ ] [ 80]
mvn:com.fasterxml.jackson.module/jackson-module-jaxb-annotations/2.6.3
[ 147] [Active ] [ ] [ ] [ 80]
mvn:com.fasterxml.jackson.module/jackson-module-paranamer/2.6.3
[ 148] [Active ] [ ] [ ] [ 80]
mvn:com.fasterxml.jackson.module/jackson-module-scala_2.10/2.6.3
[ 300] [Active ] [ ] [ ] [ 50] mvn:org.apache.camel/camel-
jackson/2.17.0.redhat-630187
[ 313] [Active ] [ ] [ ] [ 50]
mvn:com.fasterxml.jackson.dataformat/jackson-dataformat-xml/2.6.3
[ 314] [Active ] [ ] [ ] [ 50] mvn:org.apache.camel/camel-
jacksonxml/2.17.0.redhat-630187
so the version i was supposed to use was 2.6.3, or a preferable option would be to use the
<dependency>
<groupId>org.jboss.fuse.bom</groupId>
<artifactId>jboss-fuse-parent</artifactId>
<version>6.3.0.redhat-187</version>
<type>pom</type>
<scope>import</scope>
</dependency>
and there is no need to specify the versions of the jars.
Also another question related to installation of any jar not part of the fuse bunlde, use the following command
JBossFuse:karaf@root> install -s wrap:file:/<abc.jar>