java 8 - JbossFuse - not found a way to get a simple rest-dsl example to work... Odd, somewhat indecipherable exception -
do not know make of exception, continues appear on each deployment attempt...
2017-07-27 16:54:15,583 | warn | edhat-187/deploy | fileinstall | 9 - org.apache.felix.fileinstall - 3.5.0 | error while starting bundle: file:/c:/tools/jboss-fuse-6.3.0.redhat-187/deploy/cxf-rest4-1.jar org.osgi.framework.bundleexception: unresolved constraint in bundle aaa.bbb.ccc.cxf-rest4 [307]: unable resolve 307.0: missing requirement [307.0] osgi.wiring.package; (&(osgi.wiring.package=org.apache.camel)(version>=2.19.0)(!(version>=3.0.0))) @ org.apache.felix.framework.felix.resolvebundlerevision(felix.java:4002)[org.apache.felix.framework-4.4.1.jar:] @ org.apache.felix.framework.felix.startbundle(felix.java:2045)[org.apache.felix.framework-4.4.1.jar:] @ org.apache.felix.framework.bundleimpl.start(bundleimpl.java:976)[org.apache.felix.framework-4.4.1.jar:] @ org.apache.felix.fileinstall.internal.directorywatcher.startbundle(directorywatcher.java:1245)[9:org.apache.felix.fileinstall:3.5.0] @ org.apache.felix.fileinstall.internal.directorywatcher.startbundles(directorywatcher.java:1217)[9:org.apache.felix.fileinstall:3.5.0] @ org.apache.felix.fileinstall.internal.directorywatcher.doprocess(directorywatcher.java:509)[9:org.apache.felix.fileinstall:3.5.0] @ org.apache.felix.fileinstall.internal.directorywatcher.process(directorywatcher.java:358)[9:org.apache.felix.fileinstall:3.5.0] @ org.apache.felix.fileinstall.internal.directorywatcher.run(directorywatcher.java:310)[9:org.apache.felix.fileinstall:3.5.0] jbossfuse:karaf@root>
baffled exception (see below). jboss-fuse newby i'm unable past it, though, lord knows, i've tried :-)
below, code simple app, derived word-for-word from: https://github.com/rhtconsulting/fuse-quickstarts/tree/jboss-fuse-6.3/karaf/rest_dsl_simple
here project structure...
sampleroute.java
package aaa.bbb.ccc; import org.apache.camel.exchange; import org.apache.camel.logginglevel; import org.apache.camel.builder.routebuilder; import org.apache.camel.model.rest.restbindingmode; public class sampleroute extends routebuilder { @override public void configure() throws exception { restconfiguration().component("restlet").host("localhost").port(8182).bindingmode(restbindingmode.off); rest("/simplerest") .consumes("application/json") // consume json .produces("application/json") // return json .get("/get").to("direct:get") //get request .post("/post").to("direct:post"); //post request from("direct:get") .transform().constant("successful request"); //returns plain string payload from("direct:post")//returns no response data , logs success of request .log(logginglevel.info, "com.redhat.consulting.fusequickstarts.karaf.rest.dsl.route", "successful post request") .setheader(exchange.http_response_code,simple("200")); } }
camel-route.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:cm="http://aries.apache.org/blueprint/xmlns/blueprint-cm/v1.0.0" xmlns:jaxws="http://cxf.apache.org/blueprint/jaxws" xmlns:camel="http://camel.apache.org/schema/blueprint" 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/jaxws http://cxf.apache.org/schemas/blueprint/jaxws.xsd http://cxf.apache.org/blueprint/core http://cxf.apache.org/schemas/blueprint/core.xsd "> <!-- camel context registers route --> <camel:camelcontext id="fusequickstart-restdsl-simple-camel" xmlns="http://camel.apache.org/schema/blueprint"> <!-- package scanning finds routes --> <packagescan> <package>aaa.bbb.ccc</package> </packagescan> </camel:camelcontext> </blueprint>
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>aaa.bbb.ccc</groupid> <artifactid>cxf-rest4</artifactid> <version>1</version> <packaging>bundle</packaging> <name>cxf-rest4</name> <description>cxf-rest4</description> <properties> <project.build.sourceencoding>utf-8</project.build.sourceencoding> <skiptests>true</skiptests> </properties> <dependencies> <dependency> <groupid>org.slf4j</groupid> <artifactid>slf4j-log4j12</artifactid> <version>1.7.25</version> <scope>provided</scope> </dependency> <dependency> <groupid>org.slf4j</groupid> <artifactid>slf4j-api</artifactid> <version>1.7.25</version> <scope>provided</scope> </dependency> <dependency> <groupid>org.apache.camel</groupid> <artifactid>camel-core</artifactid> <version>2.19.1</version> <scope>provided</scope> </dependency> <dependency> <groupid>org.apache.camel</groupid> <artifactid>camel-restlet</artifactid> <version>2.19.1</version> <scope>provided</scope> </dependency> </dependencies> <build> <finalname>${project.artifactid}-${project.version}</finalname> <resources> <resource> <directory>src/main/resources</directory> <filtering>true</filtering> </resource> </resources> <plugins> <plugin> <groupid>org.apache.maven.plugins</groupid> <artifactid>maven-compiler-plugin</artifactid> <version>3.1</version> <configuration> <source>1.8</source> <target>1.8</target> <showdeprecation>true</showdeprecation> </configuration> </plugin> <plugin> <groupid>org.apache.felix</groupid> <artifactid>maven-bundle-plugin</artifactid> <version>3.3.0</version> <extensions>true</extensions> <configuration> <manifestlocation>target/meta-inf</manifestlocation> <instructions> <bundle-symbolicname>${project.groupid}.${project.artifactid}</bundle-symbolicname> <export-package /> <import-package> org.apache.camel.* </import-package> </instructions> </configuration> </plugin> </plugins> </build> </project>
default.properties
appname=system
environment:
java 8
jboss-fuse-6.3.0.redhat-187
maven
you need import fuse jboss-fuse-parent, (edited - claus said - add repository:
<properties> <project.reporting.outputencoding>utf-8</project.reporting.outputencoding> <version.maven-bundle-plugin>2.3.7</version.maven-bundle-plugin> <jboss.fuse.bom.version>6.2.1.redhat-084</jboss.fuse.bom.version> <maven.compiler.source>1.8</maven.compiler.source> <project.build.sourceencoding>utf-8</project.build.sourceencoding> <maven.compiler.target>1.8</maven.compiler.target> </properties> <dependencymanagement> <dependencies> <dependency> <groupid>org.jboss.fuse.bom</groupid> <artifactid>jboss-fuse-parent</artifactid> <version>${jboss.fuse.bom.version}</version> <type>pom</type> <scope>import</scope> </dependency> </dependencies> </dependencymanagement> ... <dependency> <groupid>org.apache.camel</groupid> <artifactid>camel-core</artifactid> </dependency> ... <repositories> <repository> <releases> <enabled>true</enabled> <updatepolicy>never</updatepolicy> </releases> <snapshots> <enabled>false</enabled> </snapshots> <id>fuse-public-repository</id> <name>fusesource community release repository</name> <url>https://repo.fusesource.com/nexus/content/groups/public</url> </repository> <repository> <releases> <enabled>true</enabled> <updatepolicy>never</updatepolicy> </releases> <snapshots> <enabled>false</enabled> </snapshots> <id>red-hat-ga-repository</id> <name>red hat ga repository</name> <url>https://maven.repository.redhat.com/ga</url> </repository> </repositories> <pluginrepositories> <pluginrepository> <releases> <enabled>true</enabled> <updatepolicy>never</updatepolicy> </releases> <snapshots> <enabled>false</enabled> </snapshots> <id>fuse-public-repository</id> <name>fusesource community release repository</name> <url>https://repo.fusesource.com/nexus/content/groups/public</url> </pluginrepository> <pluginrepository> <releases> <enabled>true</enabled> <updatepolicy>never</updatepolicy> </releases> <snapshots> <enabled>false</enabled> </snapshots> <id>red-hat-ga-repository</id> <name>red hat ga repository</name> <url>https://maven.repository.redhat.com/ga</url> </pluginrepository> </pluginrepositories> ...
Comments
Post a Comment