[rules-users] Calling drools into the Web Application.

srinivasasanda srinivasasanda at gmail.com
Mon Dec 5 08:13:05 EST 2011


this piece of application is working using drools project, but its not
working in (webapplication)

i had a text box age and income that values i am trying passing this data to
rule and run the rules.
i created one jsp , jsp call servlet, In servelt i called the below piece of
code in servlet but not executing

I am trying to include it this piece of code into webapplication (in servlet
or jsp) it is showing error.

public static final void runMain() {
        try {
        	RuleAgent agent = RuleAgent.newRuleAgent("/guvnor.properties");
            RuleBase ruleBase = agent.getRuleBase();
            WorkingMemory workingMemory = ruleBase.newStatefulSession();
            FactType ft= ruleBase.getFactType("sample.person");  //created
declarative model in guvnor
            Object obj=ft.newInstance();
            ft.set(obj,"age", 67);                                            
//setting data into into person
            ft.set(obj, "income", 1000);
            workingMemory.insert(obj);                                  
            workingMemory.fireAllRules();
            System.out.print(ft.get(obj, "age"));
            System.out.print(ft.get(obj, "income"));
              } catch (Throwable t) {
            t.printStackTrace();
        }
    }


12:46:44,409 ERROR [STDERR] RuleAgent(default) INFO (Mon Dec 05 12:46:44 GMT
2011): Configuring with
 newInstance=false, secondsToRefresh=-1
12:46:44,419 ERROR [STDERR] RuleAgent(default) INFO (Mon Dec 05 12:46:44 GMT
2011): Configuring pack
age provider : URLScanner monitoring URLs: 
http://localhost:8082/guvnor-5.2.0.Final-jboss-as-5.1/or
g.drools.guvnor.Guvnor/package/sample/LATEST
12:46:44,669 INFO  [STDOUT] INFO  05-12 12:46:44,669
(NilAuthenticator.java:authenticate:35)     All
 users are guests.


12:46:44,359 ERROR [STDERR] java.lang.IllegalArgumentException: Could not
parse knowledge.
12:46:44,359 ERROR [STDERR]     at
com.sample.DroolsTest.readKnowledgeBase(DroolsTest.java:115)
12:46:44,359 ERROR [STDERR]     at
com.sample.DroolsTest.FireRools(DroolsTest.java:62)
12:46:44,359 ERROR [STDERR]     at p1.Login.doGet(Login.java:37)
12:46:44,359 ERROR [STDERR]     at
javax.servlet.http.HttpServlet.service(HttpServlet.java:617)
12:46:44,359 ERROR [STDERR]     at
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)


12:46:44,699 ERROR [STDERR] RuleAgent(default) EXCEPTION (Mon Dec 05
12:46:44 GMT 2011): org.drools.
rule.Package; local class incompatible: stream classdesc serialVersionUID =
510, local class serialV
ersionUID = 400. Stack trace should follow.
12:46:44,699 ERROR [STDERR] java.io.InvalidClassException:
org.drools.rule.Package; local class inco
mpatible: stream classdesc serialVersionUID = 510, local class
serialVersionUID = 400
12:46:44,699 ERROR [STDERR]     at
java.io.ObjectStreamClass.initNonProxy(ObjectStreamClass.java:562
)

--
View this message in context: http://drools.46999.n3.nabble.com/Calling-drools-into-the-Web-Application-tp3561362p3561362.html
Sent from the Drools: User forum mailing list archive at Nabble.com.



More information about the rules-users mailing list