camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jean-Baptiste Onofré ...@nanthrax.net>
Subject Re: How to import camel in a java application program
Date Thu, 26 Feb 2015 10:30:49 GMT

    
A NoClassDefFound is more related to classloader issue than class not found. In which container
are you running your camel route ?
RegardsJB


Sent from my Samsung device

-------- Original message --------
From: Morgan Hautman <morgan.hautman@gmail.com> 
Date: 26/02/2015  10:10  (GMT+01:00) 
To: users@camel.apache.org 
Subject: Re: How to import camel in a java application program 

Hi,

If you're using maven,

<dependency>
     <groupId>org.apache.httpcomponents</groupId>
     <artifactId>httpclient</artifactId>
     <version>4.4</version>
</dependency>


On 26/02/2015 10:03, imranrazakhan wrote:
> Hi, I used same example but its giving following error
>
> public void configure() {
> 		
> 		from("jetty:http://localhost:8181/mytestservice").process(
> 				new Processor() {
> 					@Override
> 					public void process(Exchange exchange) throws Exception {
> 						String message = exchange.getIn().getBody(String.class);
> 						System.out.println("Hello Mr :" + message);
> 						exchange.getOut().setBody("Hello world Mr " + message);
> 					}
> 				});
> 	}
>
> Exception in thread "main" java.lang.NoClassDefFoundError:
> org/apache/commons/httpclient/HttpConnectionManager
>          at java.lang.Class.getDeclaredConstructors0(Native Method)
>          at java.lang.Class.privateGetDeclaredConstructors(Unknown Source)
>          at java.lang.Class.getConstructor0(Unknown Source)
>          at java.lang.Class.newInstance(Unknown Source)
>          at
> org.apache.camel.util.ObjectHelper.newInstance(ObjectHelper.java:1258)
>
> Above mentioned jars are in my class-path
>
> Manifest-Version: 1.0
> Main-Class: com.my.test.jetty.MainApp
> Class-path: camel-core-2.13.1.jar
>   slf4j-api-1.6.6.jar
>   log4j-1.2.17.jar
>   slf4j-log4j12-1.7.7.jar
>   camel-spring-2.13.1.jar
>   camel-jetty-2.13.1.jar
>   camel-http-2.13.1.jar
>   camel-test-2.13.1.jar
>
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/How-to-import-camel-in-a-java-HTTP-server-application-program-tp471924p5763196.html
> Sent from the Camel - Users mailing list archive at Nabble.com.

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message