What's in your manifest in your jar file?
Also should it be CP="drools/*:drools/lib/*:." Rather than droos?
Thomas
From: rules-users-bounces(a)lists.jboss.org [mailto:rules-users-bounces@lists.jboss.org] On
Behalf Of Wolfgang Laun
Sent: 23 June 2010 15:45
To: rules-users(a)lists.jboss.org
Subject: [rules-users] execution using "java -jar x.jar ..." fails
The application works fine in Eclipse.
In Eclipse, I created a jar file x.jar from the .class and a few .drl files, and copied
x.jar to /tmp/x/
Now, in /tmp/x
CP="droos/*:drools/lib/*"
java -cp "$CP" -jar dpvt.jar par...
This fails on the first attempt to access any class from a drools jar file.
In /tmp/x, I unpack x.jar and call
CP="droos/*:drools/lib/*:."
java -cp "$CP" rss.aws.init.Main par...
AND THIS WORKS!
So, what is different when starting a Java program with java -jar as opposed
to java x.y.Main?
The stack dump is not very informative:
java.lang.NoClassDefFoundError: org/drools/KnowledgeBaseFactory
at rss.aws.engine.impl.DroolsEngine.setup(DroolsEngine.java:30)
at rss.aws.init.Core.init(Core.java:51)
at rss.aws.init.Core.getInstance(Core.java:16)
at rss.aws.init.Main.<init>(Main.java:35)
at rss.aws.init.Main.main(Main.java:191)
Caused by: java.lang.ClassNotFoundException: org.drools.KnowledgeBaseFactory
at java.net.URLClassLoader$1.run(URLClassLoader.java:217)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:205)
at java.lang.ClassLoader.loadClass(ClassLoader.java:319)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:294)
at java.lang.ClassLoader.loadClass(ClassLoader.java:264)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:332)
... 5 more
Any ideas?
-W
________________________________
**************************************************************************************
This message is confidential and intended only for the addressee. If you have received
this message in error, please immediately notify the postmaster(a)nds.com and delete it from
your system as well as any copies. The content of e-mails as well as traffic data may be
monitored by NDS for employment and security purposes. To protect the environment please
do not print this e-mail unless necessary.
NDS Limited. Registered Office: One London Road, Staines, Middlesex, TW18 4EX, United
Kingdom. A company registered in England and Wales. Registered no. 3080780. VAT no. GB 603
8808 40-00
**************************************************************************************