You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by Marco Westermann <Ma...@gmx.de> on 2013/01/14 13:55:43 UTC

Starting a camel project

Hi,

what is the correct way to run a camel project which was generated by 
the camel-java archtype in productive. In general I always deploy camel 
bundles to smx. But this time I want a standalone application without 
smx. Using java -jar xxx.jar I get an error that there is no main-class 
defined in the jar.

best regards, Marco

Re: Starting a camel project

Posted by Bilgin Ibryam <bi...@gmail.com>.
That's correct, and that's exactly the reason I mentioned shade plugin.
Thanks Willem

B.
On 14 January 2013 13:35, Willem jiang <wi...@gmail.com> wrote:
> If you just build a big jar, you need to merge the META-INF files yourself, otherwise you will hit some strange issue there.

Re: Starting a camel project

Posted by Willem jiang <wi...@gmail.com>.
Just a quick note, camel will lookup some files in the META-INF/ to pick the components, converters and data formats.
If you just build a big jar, you need to merge the META-INF files yourself, otherwise you will hit some strange issue there.


--  
Willem Jiang

Red Hat, Inc.
FuseSource is now part of Red Hat
Web: http://www.fusesource.com | http://www.redhat.com
Blog: http://willemjiang.blogspot.com (http://willemjiang.blogspot.com/) (English)
          http://jnn.iteye.com (http://jnn.javaeye.com/) (Chinese)
Twitter: willemjiang  
Weibo: 姜宁willem




On Monday, January 14, 2013 at 9:28 PM, Bilgin Ibryam wrote:

> Hi Marco,
>  
> To run your application as standalone, your application jar has to
> contain all the dependencies
>  
> Then you need a class with main method to run your application.
>  
> Also you need to specify this class in the manifest of the generated jar.
>  
> One way to do it is by using the maven-assembly-plugin. You can see an
> example bellow.
>  
> maven-assembly-plugin is not ideal, but it works for simple
> application. For more complex application you'd better you maven-shade
> plugin.
>  
> Cheers,
> Bilgin
>  
> <plugin>
> <groupId>org.apache.maven.plugins</groupId>
> <artifactId>maven-assembly-plugin</artifactId>
> <version>2.2</version>
> <configuration>
> <descriptorRefs>
> <descriptorRef>jar-with-dependencies</descriptorRef>
> </descriptorRefs>
> <archive>
> <manifest>
>  
> <mainClass>com.ofbizian.camelympic.MainApp</mainClass>
> </manifest>
> </archive>
> </configuration>
> <executions>
> <execution>
> <id>assembly</id>
> <phase>package</phase>
> <goals>
> <goal>single</goal>
> </goals>
> </execution>
> </executions>
> </plugin>
>  
>  
>  
>  
> On 14 January 2013 12:55, Marco Westermann <MarWestermann@gmx.de (mailto:MarWestermann@gmx.de)> wrote:
> > Hi,
> >  
> > what is the correct way to run a camel project which was generated by the
> > camel-java archtype in productive. In general I always deploy camel bundles
> > to smx. But this time I want a standalone application without smx. Using
> > java -jar xxx.jar I get an error that there is no main-class defined in the
> > jar.
> >  
> > best regards, Marco  



Re: Starting a camel project

Posted by Bilgin Ibryam <bi...@gmail.com>.
Hi Marco,

To run your application as standalone, your application  jar has to
contain all the dependencies

Then you need a class with main method to run your application.

Also you need to specify this class in the manifest of the generated jar.

One way to do it is by using the maven-assembly-plugin. You can see an
example bellow.

maven-assembly-plugin is not ideal, but it works for simple
application. For more complex application you'd better you maven-shade
plugin.

Cheers,
Bilgin

  <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-assembly-plugin</artifactId>
                <version>2.2</version>
                <configuration>
                    <descriptorRefs>
                        <descriptorRef>jar-with-dependencies</descriptorRef>
                    </descriptorRefs>
                    <archive>
                        <manifest>

<mainClass>com.ofbizian.camelympic.MainApp</mainClass>
                        </manifest>
                    </archive>
                </configuration>
                <executions>
                    <execution>
                        <id>assembly</id>
                        <phase>package</phase>
                        <goals>
                            <goal>single</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>




On 14 January 2013 12:55, Marco Westermann <Ma...@gmx.de> wrote:
> Hi,
>
> what is the correct way to run a camel project which was generated by the
> camel-java archtype in productive. In general I always deploy camel bundles
> to smx. But this time I want a standalone application without smx. Using
> java -jar xxx.jar I get an error that there is no main-class defined in the
> jar.
>
> best regards, Marco

Re: Starting a camel project

Posted by Claus Ibsen <cl...@gmail.com>.
Hi

See also this FAQ, and the links on that page
http://camel.apache.org/running-camel-standalone.html



On Mon, Jan 14, 2013 at 1:55 PM, Marco Westermann <Ma...@gmx.de> wrote:
> Hi,
>
> what is the correct way to run a camel project which was generated by the
> camel-java archtype in productive. In general I always deploy camel bundles
> to smx. But this time I want a standalone application without smx. Using
> java -jar xxx.jar I get an error that there is no main-class defined in the
> jar.
>
> best regards, Marco



-- 
Claus Ibsen
-----------------
Red Hat, Inc.
FuseSource is now part of Red Hat
Email: cibsen@redhat.com
Web: http://fusesource.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen