Hi everyone

I'm doing this but still not working from jar file.
 I have a main class like:
/public class CamelMain {
    public static void main(String[] args) throws Exception {
        String[] filename =
        { "spring/camel-context.xml" };
        AbstractXmlApplicationContext spring = new
ClassPathXmlApplicationContext(filename);
        spring.start();
        Thread.sleep(10000);
        spring.stop();
        spring.destroy();
    }
}/

I use maven jar plugin in my pom like this:
/<plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-jar-plugin</artifactId>
         <configuration>
                <archive>
                        <manifest>
                                  <addClasspath>true</addClasspath>
                                  
<mainClass>package.to.main.CamelMain</mainClass>
                         </manifest>
                </archive>
        </configuration>
</plugin>/

I can run with *mvn camel:run* I can run main class from Eclipse running as
java application with no problems.
When I do mvn package and try to run with java -jar I have this error:


/C:\Users\garcina\Downloads\workspaces\trunk\dbpost_conversion_ld\target>java
-ja
r myJar.jar
Exception in thread "main" java.lang.NoClassDefFoundError:
org/springframework/c
ontext/support/AbstractXmlApplicationContext
Caused by: java.lang.ClassNotFoundException:
org.springframework.context.support
.AbstractXmlApplicationContext
        at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
        at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
Could not find the main class: package.to.main.CamelMain. Program w
ill exit./

Is something I'm missing?

Thansk you all



--
View this message in context: 
http://camel.465427.n5.nabble.com/Package-camel-spring-into-jar-file-tp5753964p5753978.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Reply via email to