Re: [rules-users] execution using "java -jar x.jar ..." fails
by Greg Barton
See http://java.sun.com/j2se/1.4.2/docs/tooldocs/windows/java.html
Key line' referring to the -jar option:
"When you use this option, the JAR file is the source of all user classes, and other user class path settings are ignored."
You can specify the path to external jars in the manifest of the standalone jar.
GreG
On Jun 23, 2010, at 9:44 AM, Wolfgang Laun <wolfgang.laun(a)gmail.com> wrote:
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
_______________________________________________
rules-users mailing list
rules-users(a)lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users
15 years, 10 months
Drools 5 setGlobal
by Samuli Saarinen
Hello,
I'm new to drools and have problems with globals or with the different
behaviour of drools depending on how the globals are specified.
I have the following simple rule:
global String test
rule "Global"
when
then
System.out.println(test);
end
If i run the rule with:
KnowledgeBase kb = getKnowledgeBase("global.drl");
StatelessKnowledgeSession ses = kb.newStatelessKnowledgeSession();
ses.setGlobal("test2", "foo");
ses.execute("");
I get the expected result of null printed
but if I use commands:
KnowledgeBase kb = getKnowledgeBase("global.drl");
StatelessKnowledgeSession ses = kb.newStatelessKnowledgeSession();
List<Command<?>> cmds = new ArrayList<Command<?>>();
cmds.add(CommandFactory.newSetGlobal("test2", "bar"));
cmds.add(CommandFactory.newInsert(""));
ses.execute(CommandFactory.newBatchExecution(cmds));
I get java.lang.RuntimeException: Unexpected global [test2]
Why is the behaviour different and which one is correct?
Regards,
Samuli
--
Remion Oy Etävalvontajärjestelmät liiketoiminnan
Samuli Saarinen tehostamiseen
gsm +358 (0)50 3560075
fax +358 (0)3 2125064 www.remion.com
15 years, 10 months
execution using "java -jar x.jar ..." fails
by Wolfgang Laun
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
15 years, 10 months
How to manage roles and generate web-forms using Drools Flow?
by Aman Aggarwal
Hi all
I am creating a workflow(integrated into a Java web application) for a leave
application approval. The workflow is as follows:
Leave request is raised for an employee.
Case 1: If employee's role is not team lead.
The request is sent to employee's team lead.
If team lead rejects, workflow ends.
If team lead approves, request is forwarded to manager.
Case 2: If employee's role is team lead.
The request is directly sent to Manager.
Workflow ends when manager approves/rejects the application. At the time of
approval/rejection the user needs to enter a comment.
I need to generate web-form for user input. The options can be dynamic and
should be defined in workflow itself. How can I achieve this? What is the
right way to manage different directions of a workflow based on different
roles?
Any thoughts/suggestions are welcome. It will be helpful if someone can
direct me to example/sample code to achieve this.
--
Regards
Aman
http://www.IntelliGrape.com
15 years, 10 months
Couple of questions about Timers
by nanic23
Hi all,
I'm working with timers and I have a couple of questions.
1) If I have more than one timer in a ruleflow definition, will
ksession.fireUntilHalt()/ksession.fireAllRules() take care of
starting/initializing all timers? Is one thread enough for multiple timers
or I need to handle timers individually?
2) If my flow terminates (normally or abnormally) do I need to clean/restart
the timers?
Any help is appreciated.
Thanks,
Nick.
--
View this message in context: http://drools-java-rules-engine.46999.n3.nabble.com/Couple-of-questions-a...
Sent from the Drools - User mailing list archive at Nabble.com.
15 years, 10 months
Timer Date definition for Timer nodes
by nanic23
Hi Drools community :)
As per the BPMN standard: "In Normal Flow the Timer Intermediate Event acts
as a delay mechanism based on a specific time-date or a specific cycle
(e.g., every Monday at 9am) can be set that will trigger the Event."
So, my question is: Does Drools supports something like this? Can we set,
for example, a timer to run once every Monday at 9am? I am familiar with
Timer Delay and Timer Period but I am not looking for this behavior. I am
rather looking to schedule a specific date and time (e.g. Monday's at 9am).
Is this possible? If so, How is it configured?
Thanks,
Nick.
--
View this message in context: http://drools-java-rules-engine.46999.n3.nabble.com/Timer-Date-definition...
Sent from the Drools - User mailing list archive at Nabble.com.
15 years, 10 months
drools-compiler 5.1.0.SNAPSHOT: transitive deps not set up right?
by ljnelson
I have a Maven project that depends on drools-compiler 5.1.0.SNAPSHOT.
When I run mvn dependency:tree on it, I notice that the compile scope
dependencies used by drools-compiler are not listed in the output (actually,
same for drools-core):
[INFO] mystuff:myproject:jar:1.0-SNAPSHOT
[INFO] +- org.drools:drools-api:jar:5.1.0.20100619.203626-283:compile
[INFO] +- org.drools:drools-core:jar:5.1.0.20100619.203626-282:compile
[INFO] +- org.drools:drools-compiler:jar:5.1.0.20100619.203626-282:compile
[INFO] +- org.glassfish:javax.resource:jar:3.1-b04:provided
[INFO] | \- org.glassfish:javax.transaction:jar:3.1-b04:provided
[INFO] \- junit:junit:jar:4.8.1:test
They are listed in the output if I use version 5.0.1.M2:
[INFO] mystuff:myproject:jar:1.0-SNAPSHOT
[INFO] +- org.drools:drools-api:jar:5.1.0.M2:compile
[INFO] +- org.drools:drools-core:jar:5.1.0.M2:compile
[INFO] | +- org.mvel:mvel2:jar:2.0.18:compile (version managed from 2.0.16)
[INFO] | +- com.sun.xml.bind:jaxb-impl:jar:2.0.3:compile
[INFO] | | +- javax.xml.bind:jaxb-api:jar:2.0:compile
[INFO] | | +- javax.xml.bind:jsr173_api:jar:1.0:compile
[INFO] | | \- javax.activation:activation:jar:1.1:compile
[INFO] | \- com.sun.xml.bind:jaxb-xjc:jar:2.0.3:runtime
[INFO] +- org.drools:drools-compiler:jar:5.1.0.M2:compile
[INFO] | +- org.antlr:antlr-runtime:jar:3.1.3:compile
[INFO] | +- org.antlr:gunit:jar:3.1.3:compile
[INFO] | | \- org.antlr:stringtemplate:jar:3.2:compile
[INFO] | | \- antlr:antlr:jar:2.7.7:compile
[INFO] | +-
org.apache.jasper.springsource:com.springsource.org.apache.jasper.org.eclipse.jdt.springsource:jar:6.0.20.S2-r5956:compile
[INFO] | \- janino:janino:jar:2.5.15:compile
[INFO] +- org.glassfish:javax.resource:jar:3.1-b04:provided
[INFO] | \- org.glassfish:javax.transaction:jar:3.1-b04:provided
[INFO] \- junit:junit:jar:4.8.1:test
One of my log messages seems to indicate that drools-compiler does not have
a POM:
[INFO] Unable to find resource
'org.drools:drools-compiler:pom:5.1.0.20100619.203626-282' in repository
jboss (https://repository.jboss.org/nexus/content/groups/public)
The Maven guys suspect a bad deployment. Is this something you folks need
to fix, or something that I've somehow messed up?
Thanks,
Laird
--
View this message in context: http://drools-java-rules-engine.46999.n3.nabble.com/drools-compiler-5-1-0...
Sent from the Drools - User mailing list archive at Nabble.com.
15 years, 10 months