java - CXF BusException No DestinationFactory for namespace http://cxf.apache.org/transports/http -
i'm trying stand [basic cxf rs example][1], own service impl
simpler , methods return strings. when try run server exception
i built clean project i'm starting fresh..
master pom http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelversion>4.0.0</modelversion> <name>tests</name> <groupid>com.crush</groupid> <artifactid>tests</artifactid> <version>1.0</version> <packaging>pom</packaging> <properties> <cxf.version>2.7.11</cxf.version> <httpclient.version>3.1</httpclient.version> <rs-api.version>2.0</rs-api.version> <disclaimer/> <project.build.sourceencoding>utf-8</project.build.sourceencoding> <slf4j.version>1.6.2</slf4j.version> <guava.version>13.0-rc2</guava.version> <jgroups.version>3.1.0.final</jgroups.version> <infinispan.version>5.1.4.cr1</infinispan.version> <commons.cli.version>1.2</commons.cli.version> <jettison.version>1.3.2</jettison.version> <spring.version>3.1.0.release</spring.version> <bouncycastle.version>1.46</bouncycastle.version> <junit.version>4.8</junit.version> <jasypt.version>1.9.0</jasypt.version> <!-- additional dependencies --> <cxf.buildtools.version>2.2.12</cxf.buildtools.version> <!-- maven plugin versions --> <shade.plugin.version>1.7.1</shade.plugin.version> <buildnumber.plugin.version>1.1</buildnumber.plugin.version> <jar.plugin.version>2.4</jar.plugin.version> <resources.plugin.version>2.5</resources.plugin.version> <versions.plugin.version>1.3.1</versions.plugin.version> <!-- plugin versions --> <compiler.plugin.version>2.4</compiler.plugin.version> <surefire.plugin.version>2.12.4</surefire.plugin.version> <skiptests>true</skiptests> <jboss.cache.version>3.2.5.ga</jboss.cache.version> <maven.build.timestamp.format>yyyymmdd-hhmmss</maven.build.timestamp.format> </properties> <modules> <module>sample-service</module> </modules> <dependencymanagement> <dependencies> <dependency> <groupid>org.apache.cxf</groupid> <artifactid>cxf-rt-frontend-jaxws</artifactid> <version>${cxf.version}</version> </dependency> <dependency> <groupid>org.apache.cxf</groupid> <artifactid>cxf-rt-transports-http</artifactid> <version>${cxf.version}</version> </dependency> <!-- dependency needed if you're using jetty container --> <dependency> <groupid>org.apache.cxf</groupid> <artifactid>cxf-rt-transports-http-jetty</artifactid> <version>${cxf.version}</version> </dependency> <dependency> <groupid>org.apache.cxf</groupid> <artifactid>cxf-rt-frontend-jaxrs</artifactid> <version>${cxf.version}</version> </dependency> <dependency> <groupid>commons-httpclient</groupid> <artifactid>commons-httpclient</artifactid> <version>${httpclient.version}</version> </dependency> <dependency> <groupid>javax.ws.rs</groupid> <artifactid>javax.ws.rs-api</artifactid> <version>${rs-api.version}</version> </dependency> </dependencies> </dependencymanagement> <build> <pluginmanagement> <plugins> <plugin> <!-- plugin used update version numbers of project during release process. --> <groupid>org.codehaus.mojo</groupid> <artifactid>versions-maven-plugin</artifactid> <version>${versions.plugin.version}</version> <configuration> <generatebackuppoms>false</generatebackuppoms> </configuration> </plugin> </plugins> </pluginmanagement> <plugins> <plugin> <!-- plugin configuration plugin specifies base file encoding. --> <groupid>org.apache.maven.plugins</groupid> <artifactid>maven-resources-plugin</artifactid> <version>${resources.plugin.version}</version> <configuration> <encoding>utf-8</encoding> <outputdirectory>${project.build.outputdirectory}</outputdirectory> </configuration> </plugin> <plugin> <groupid>org.apache.maven.plugins</groupid> <artifactid>maven-compiler-plugin</artifactid> <version>${compiler.plugin.version}</version> <configuration> <source>1.6</source> <target>1.6</target> </configuration> </plugin> </plugins> </build>
sample-service pom
<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/maven- v4_0_0.xsd"> <modelversion>4.0.0</modelversion> <parent> <groupid>com.crush</groupid> <artifactid>tests</artifactid> <version>1.0</version> </parent> <artifactid>sample-service</artifactid> <version>1.0</version> <packaging>jar</packaging> <name>simple cxf project using spring configuration</name> <dependencies> <dependency> <groupid>org.apache.cxf</groupid> <artifactid>cxf-rt-frontend-jaxws</artifactid> </dependency> <dependency> <groupid>org.apache.cxf</groupid> <artifactid>cxf-rt-transports-http</artifactid> </dependency> <dependency> <groupid>org.apache.cxf</groupid> <artifactid>cxf-rt-transports-http-jetty</artifactid> </dependency> <dependency> <groupid>org.apache.cxf</groupid> <artifactid>cxf-rt-frontend-jaxrs</artifactid> </dependency> <dependency> <groupid>commons-httpclient</groupid> <artifactid>commons-httpclient</artifactid> </dependency> <dependency> <groupid>javax.ws.rs</groupid> <artifactid>javax.ws.rs-api</artifactid> </dependency> </dependencies> <profiles> <profile> <id>server</id> <build> <defaultgoal>test</defaultgoal> <plugins> <plugin> <groupid>org.codehaus.mojo</groupid> <artifactid>exec-maven-plugin</artifactid> <version>1.2.1</version> <executions> <execution> <phase>test</phase> <goals> <goal>java</goal> </goals> <configuration> <mainclass>com.crush.tests.service.test</mainclass> </configuration> </execution> </executions> </plugin> </plugins> </build> </profile> </profiles> <build> <plugins> <plugin> <artifactid>maven-assembly-plugin</artifactid> <configuration> <descriptorrefs> <descriptorref>jar-with-dependencies</descriptorref> </descriptorrefs> <archive> <manifest> <mainclass>com.crush.tests.service.test</mainclass> </manifest> </archive> </configuration> <executions> <execution> <id>make-assembly</id> <phase>package</phase> <goals> <goal>single</goal> </goals> </execution> </executions> </plugin> </plugins> </build>
manifest.mf manifest-version: 1.0 archiver-version: plexus archiver created-by: apache maven built-by: crush build-jdk: 1.7.0_55
main-class: com.crush.tests.service.test
sampleserviceimpl
package com.crush.tests.service.ws.impl; import javax.jws.webservice; import com.crush.tests.service.ws.sampleservice; import javax.ws.rs.delete; import javax.ws.rs.get; import javax.ws.rs.post; import javax.ws.rs.put; import javax.ws.rs.path; import javax.ws.rs.pathparam; impo rt javax.ws.rs.produces; import javax.ws.rs.core.response; @webservice(endpointinterface = "com.crush.tests.service.ws.sampleservice") @path("/sample/") @produces("text/xml") public class sampleserviceimpl implements sampleservice { public sampleserviceimpl() { } @get @path("/hi/{text}") public string sayhi(@pathparam("text") string text) { return "hello " + text; } }
when run with: mvn -pserver
jun 27, 2014 3:10:26 pm org.apache.cxf.endpoint.serverimpl initdestination
info: setting server's publish address http ://localhost:9000/
slf4j: failed load class "org.slf4j.impl.staticloggerbinder". slf4j: defaulting no-operation (nop) logger implementation slf4j: see http://www.slf4j.org/codes.html#staticloggerbinder further details.
server ready...
like before, , running bundled jar
java -cp sample-service-1.0-jar-with-dependencies.jar com.crush.tests.service.test exception in thread "main" org.apache.cxf.service.factory.serviceconstructionexception @ org.apache.cxf.jaxrs.jaxrsserverfactorybean.create(jaxrsserverfactorybean.java:205) @ com.crush.tests.service.test.(test.java:25) @ com.crush.tests.service.test.main(test.java:30) caused by: org.apache.cxf.busexception: no destinationfactory found namespace http://cxf.apache.org/transports/http. @ org.apache.cxf.bus.managers.destinationfactorymanagerimpl.getdestinationfactory(destinationfactorymanagerimpl.java:130) @ org.apache.cxf.endpoint.serverimpl.initdestination(serverimpl.java:78) @ org.apache.cxf.endpoint.serverimpl.(serverimpl.java:62) @ org.apache.cxf.jaxrs.jaxrsserverfactorybean.create(jaxrsserverfactorybean.java:159) ... 2 more
if browse sample-service-1.0-jar-with-dependencies.jar can navigate /org/apache/cxf/transport(s) find of classes in dependent jars.
problem cxf classes needed set on classpath though bundled jar... didn't make sense why fix.
Comments
Post a Comment