You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by newbiee <m_...@hotmail.com> on 2012/02/21 23:15:13 UTC
Spring DSL route
If I define my route using JAVA DSL and then if I want to run my program from
a different computer where maven does not exist, I can do the following:
java -cp dependency/*;chapter1-file-copy-1.0.jar
camelinaction.FileCopierWithCamel
Here my route is in "FileCopierWithCamel"
My question is: If my route is defined using Spring DSL i.e.
"camel-context.xml" then how can I execute the route from a different
computer where maven does not exist.
1. I will have to copy all the dependencies using the following commmand:
mvn dependency:copy-dependencies
2. Following commad will create JAR file:
mvn install
Now what should I do to run the program from a different computer?
--
View this message in context: http://camel.465427.n5.nabble.com/Spring-DSL-route-tp5503528p5503528.html
Sent from the Camel - Users mailing list archive at Nabble.com.
Re: Spring DSL route
Posted by Reuben Garrett <re...@gmail.com>.
newbiee,
I'm not sure I completely understand your situation, but it sounds more
like a dependency/deployment problem than something related to camel
itself.
If you're having trouble packaging your application's dependencies, then
maybe the Maven Shade plugin would help?
http://maven.apache.org/plugins/maven-shade-plugin/
~ RNPG
On Tue, Feb 21, 2012 at 16:15, newbiee <m_...@hotmail.com> wrote:
> If I define my route using JAVA DSL and then if I want to run my program
> from
> a different computer where maven does not exist, I can do the following:
>
>
> java -cp dependency/*;chapter1-file-copy-1.0.jar
> camelinaction.FileCopierWithCamel
>
> Here my route is in "FileCopierWithCamel"
>
> My question is: If my route is defined using Spring DSL i.e.
> "camel-context.xml" then how can I execute the route from a different
> computer where maven does not exist.
>
> 1. I will have to copy all the dependencies using the following commmand:
>
> mvn dependency:copy-dependencies
>
> 2. Following commad will create JAR file:
>
> mvn install
>
> Now what should I do to run the program from a different computer?
>
>
>
> --
> View this message in context:
> http://camel.465427.n5.nabble.com/Spring-DSL-route-tp5503528p5503528.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>
Re: Spring DSL route
Posted by Bilgin Ibryam <bi...@gmail.com>.
add this to pom
<addClasspath>true</addClasspath>
this line--> <classpathPrefix>dependency/</classpathPrefix>
<mainClass>org.apache.camel.spring.Main</mainClass>
and then do only: java -jar myDSLRoute-1.0-SNAPSHOT.jar
Bilgin
On 22 February 2012 01:39, newbiee <m_...@hotmail.com> wrote:
> Thanks Bilgin.
>
> I added the followig in my POM file:
>
> <plugin>
> <groupId>org.apache.maven.plugins</groupId>
> <artifactId>maven-jar-plugin</artifactId>
> <version>2.4</version>
> <configuration>
> <archive>
> <manifest>
> <addClasspath>true</addClasspath>
>
> <mainClass>org.apache.camel.spring.Main</mainClass>
> </manifest>
> </archive>
> </configuration>
> </plugin>
>
> When I apply the following command to run the program:
>
> java -cp dependency/*; -jar myDSLRoute-1.0-SNAPSHOT.jar
>
> I am getting the following error:
>
> "Exception in thread "main" java.lang.NoClassDefFoundError:
> org/apache/camel/spring/Main"
>
> Not sure why Main class is missing even though I have updated the POM file.
>
> Please let me what is missing.
>
>
>
>
> --
> View this message in context:
> http://camel.465427.n5.nabble.com/Spring-DSL-route-tp5503528p5503885.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>
Re: Spring DSL route
Posted by newbiee <m_...@hotmail.com>.
Thanks Bilgin.
I added the followig in my POM file:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>2.4</version>
<configuration>
<archive>
<manifest>
<addClasspath>true</addClasspath>
<mainClass>org.apache.camel.spring.Main</mainClass>
</manifest>
</archive>
</configuration>
</plugin>
When I apply the following command to run the program:
java -cp dependency/*; -jar myDSLRoute-1.0-SNAPSHOT.jar
I am getting the following error:
"Exception in thread "main" java.lang.NoClassDefFoundError:
org/apache/camel/spring/Main"
Not sure why Main class is missing even though I have updated the POM file.
Please let me what is missing.
--
View this message in context: http://camel.465427.n5.nabble.com/Spring-DSL-route-tp5503528p5503885.html
Sent from the Camel - Users mailing list archive at Nabble.com.
Re: Spring DSL route
Posted by Bilgin Ibryam <bi...@gmail.com>.
Camel has org.apache.camel.spring.Main class that will load the spring
context and start Camel routes. In order to use it, you have to add it to
the jar manifest:
- If you are copying the dependencies manually as in your example then you
only have to add this in your pom:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>2.4</version>
<configuration>
<archive>
<manifest>
<addClasspath>true</addClasspath>
<mainClass>org.apache.camel.spring.Main</mainClass>
</manifest>
</archive>
</configuration>
</plugin>
- if you prefer maven to include all the dependencies in the jar file then
you can add this to your pom:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<version>2.3</version>
<configuration>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
<archive>
<manifest>
<addClasspath>true</addClasspath>
<mainClass>org.apache.camel.spring.Main</mainClass>
</manifest>
</archive>
</configuration>
</plugin>
After that you should be able to run the jar file
HTH
Bilgin
On 21 February 2012 22:15, newbiee <m_...@hotmail.com> wrote:
> If I define my route using JAVA DSL and then if I want to run my program
> from
> a different computer where maven does not exist, I can do the following:
>
>
> java -cp dependency/*;chapter1-file-copy-1.0.jar
> camelinaction.FileCopierWithCamel
>
> Here my route is in "FileCopierWithCamel"
>
> My question is: If my route is defined using Spring DSL i.e.
> "camel-context.xml" then how can I execute the route from a different
> computer where maven does not exist.
>
> 1. I will have to copy all the dependencies using the following commmand:
>
> mvn dependency:copy-dependencies
>
> 2. Following commad will create JAR file:
>
> mvn install
>
> Now what should I do to run the program from a different computer?
>
>
>
> --
> View this message in context:
> http://camel.465427.n5.nabble.com/Spring-DSL-route-tp5503528p5503528.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>