Guvnor integration GLOBAL/Remote HTTP resource caching error !!!
by abhinay_agarwal
hello..i am using the following changeset :
<change-set xmlns="http://drools.org/drools-5.0/change-set"
xmlns:xs="http://www.w3.org/2001/XMLSchema-instance"
xs:schemaLocation="http://drools.org/drools-5.0/change-set.xsd
http://anonsvn.jboss.org/repos/labs/labs/jbossrules/trunk/drools-api/src/...">
<add>
<resource
source="http://localhost:8080/drools-guvnor/org.drools.guvnor.Guvnor/package/Indi..."
type="PKG" basicAuthentication="enabled" username="admin"
password=""/>
</add>
</change-set>
and my knowledge base was created using the following code :
KnowledgeAgentConfiguration kaconf =
KnowledgeAgentFactory.newKnowledgeAgentConfiguration();
kaconf.setProperty( "drools.agent.scanDirectories", "false" );
KnowledgeAgent kagent = KnowledgeAgentFactory.newKnowledgeAgent( "test
agent", kaconf );
System.setProperty("drools.resource.urlcache", "D:\\drools
runtime\\Cache");
ResourceFactory.getResourceChangeNotifierService().start();
ResourceFactory.getResourceChangeScannerService().start();
kagent.applyChangeSet(ResourceFactory.newClassPathResource("changeset.xml"));
kbase=kagent.getKnowledgeBase();
}catch(Exception exp){
throw new Exception(exp);
}
return kbase;
and i tried creating a "Remote HTTP resource caching" , since i was having
the following error beacuse of the GLOBAL ArrayList that i had used :
*java.lang.RuntimeException: Unexpected global [list]
at
org.drools.common.AbstractWorkingMemory.setGlobal(AbstractWorkingMemory.java:613)
at
org.drools.impl.StatefulKnowledgeSessionImpl.setGlobal(StatefulKnowledgeSessionImpl.java:332)
at com.sample.DroolsTest.main(DroolsTest.java:71)*i read smewhere that
creating a local copy will help irradicate the error...
but while creating a local copy i get a new error ...
*(null: 8, 174): cvc-elt.1: Cannot find the declaration of element
'change-set'.
java.io.IOException: Server returned HTTP response code: 401 for URL:
http://localhost:8080/drools-guvnor/org.drools.guvnor.Guvnor/package/Indi...
at sun.net.www.protocol.http.HttpURLConnection.getInputStream(Unknown
Source)
at org.drools.io.impl.UrlResource.grabStream(UrlResource.java:210)
at org.drools.io.impl.UrlResource.cacheStream(UrlResource.java:181)
at org.drools.io.impl.UrlResource.getInputStream(UrlResource.java:142)
at
org.drools.agent.impl.KnowledgeAgentImpl.createPackageFromResource(KnowledgeAgentImpl.java:720)
at
org.drools.agent.impl.KnowledgeAgentImpl.createPackageFromResource(KnowledgeAgentImpl.java:679)
at
org.drools.agent.impl.KnowledgeAgentImpl.addResourcesToKnowledgeBase(KnowledgeAgentImpl.java:979)
at
org.drools.agent.impl.KnowledgeAgentImpl.rebuildResources(KnowledgeAgentImpl.java:774)
at
org.drools.agent.impl.KnowledgeAgentImpl.buildKnowledgeBase(KnowledgeAgentImpl.java:646)
at
org.drools.agent.impl.KnowledgeAgentImpl.applyChangeSet(KnowledgeAgentImpl.java:192)
at
org.drools.agent.impl.KnowledgeAgentImpl.applyChangeSet(KnowledgeAgentImpl.java:174)
at com.sample.DroolsTest.readKnowledgeBase(DroolsTest.java:126)
at com.sample.DroolsTest.main(DroolsTest.java:49)*
>(null: 8, 174): cvc-elt.1: Cannot find the declaration of element
'change-set'.
i ve neglected this error !!!
Regards,
Abhinay
--
View this message in context: http://drools.46999.n3.nabble.com/Guvnor-integration-GLOBAL-Remote-HTTP-r...
Sent from the Drools: User forum mailing list archive at Nabble.com.
12 years, 7 months
DSL translatio problem for !ucfirst under 5.1.1
by drdaveg
I have solved this problem before, and think it is a JAR issue, but can't
seem to remember which JAR solves my problem. The DSL sentence
[consequence][]Set {field} of {object} to
{value}={object}.set{field!ucfirst}({value});
is not working since !ucfirst is being ignored. I am using 5.1.1 because of
a reoccurring bug with the in-place DSL editor of more recent versions of
DROOLS (there are JIRA's opened, closed, reopened and commented on the bug.)
What JAR would I have wrong or be missing that causes !ucfirst to not be
processed, ie converting {field} to its setter? Thanks!
--
View this message in context: http://drools.46999.n3.nabble.com/DSL-translatio-problem-for-ucfirst-unde...
Sent from the Drools: User forum mailing list archive at Nabble.com.
12 years, 7 months
Error on Build Package Click
by paco
I got the following error when I tryed to build the default sample repository
after starting guvnor the first time.
I then tried to build my own package, and got the same error:
400 Sorry, a technical error occurred. Please contact a system
administrator.
Service method 'public abstract org.drools.guvnor.client.rpc.BuilderResult
org.drools.guvnor.client.rpc.PackageService.buildPackage
(java.lang.String,boolean,java.lang.String,java.lang.String,java.lang.String,boolean,java.lang.String,
java.lang.String,boolean,java.lang.String)
throws com.google.gwt.user.client.rpc.SerializationException' threw an
unexpected exception: [Error: illegal escape sequence: .] [Near : {...
".aaaa.bbbb.\.[1-4]" ....}] ^ [Line: 1, Column: 22] [Error: illegal escape
sequence: .] [Near : {... ".oooo.ppp\.[1-4]" ....}] ^ [Line: 1, Column: 22]
Please
Suggest
Thanks
--
View this message in context: http://drools.46999.n3.nabble.com/Error-on-Build-Package-Click-tp4018712....
Sent from the Drools: User forum mailing list archive at Nabble.com.
12 years, 7 months
Drools Planner changing problem fact
by Ralph Schwitalla
Hi all,
i am new to drools planner and try to model a 2dimensional rectangle packing
problem.
I have some problems modelling the problem facts because one of them (the
list of free spaces) is constantly
changing.
For example I have a list of rectangles I try to pack on a fixed size layer.
This list is fixed.
But the list of free space is dynamic (first you have the whole layer as
free space,
then you cut out the space occupied by the first rectangle which gives you 3
remaining free spaces, and so on)
All the examples in the drools-planner-examples seem to have a fixed list of
problem facts (rooms, teachers, timeslots) which only should be combined
optimally.
How can a dynamic number of problem facts be modelled?
Greetings Ralph
--
View this message in context: http://drools.46999.n3.nabble.com/Drools-Planner-changing-problem-fact-tp...
Sent from the Drools: User forum mailing list archive at Nabble.com.
12 years, 7 months
How handle exception thrown while looping in DRL file
by ashwindrool
Hi,
I ran enhanced for loop in .DRL file .Its looping perfectly but after
completion of loop its throwing error mentioned as follows:
*org.drools.runtime.rule.ConsequenceException: rule: Test
Maadiiiiiiiiiiiiiiiii
at
org.drools.runtime.rule.impl.DefaultConsequenceExceptionHandler.handleException(DefaultConsequenceExceptionHandler.java:39)
at org.drools.common.DefaultAgenda.fireActivation(DefaultAgenda.java:1101)
at org.drools.common.DefaultAgenda.fireNextItem(DefaultAgenda.java:1029)
at org.drools.common.DefaultAgenda.fireAllRules(DefaultAgenda.java:1251)
at
org.drools.common.AbstractWorkingMemory.fireAllRules(AbstractWorkingMemory.java:737)
at
org.drools.common.AbstractWorkingMemory.fireAllRules(AbstractWorkingMemory.java:701)
at
org.drools.impl.StatefulKnowledgeSessionImpl.fireAllRules(StatefulKnowledgeSessionImpl.java:218)
at com.sample.DroolsTest.main(DroolsTest.java:156)
Caused by: java.lang.NullPointerException
at
com.sample.Rule_Test_Maadiiiiiiiiiiiiiiiii_0.defaultConsequence(Rule_Test_Maadiiiiiiiiiiiiiiiii_0.java:7)
at
com.sample.Rule_Test_Maadiiiiiiiiiiiiiiiii_0DefaultConsequenceInvoker.evaluate(Rule_Test_Maadiiiiiiiiiiiiiiiii_0DefaultConsequenceInvoker.java:27)
at org.drools.common.DefaultAgenda.fireActivation(DefaultAgenda.java:1091)
... 6 more
*
--
View this message in context: http://drools.46999.n3.nabble.com/How-handle-exception-thrown-while-loopi...
Sent from the Drools: User forum mailing list archive at Nabble.com.
12 years, 7 months
Drools Guvnor-Decison Tables - Rule is not being fired!!! Please help
by Ravikiran
Hi,
I'm using default Guvnor package "mortgages" decision table as example for
my POC. Below is the rules from the decision table. No rule is being fired
from my JAVA client out of 3 rules given below.
//from row number: 1
rule "Row 3 Pricing loans"
dialect "mvel"
when
application : LoanApplication( amount > "131000" , amount <=
"200000" , lengthYears == "30" , deposit < "20000" )
income : IncomeSource( type == "Asset" )
then
application.setApproved( true );
application.setInsuranceCost( 0 );
application.setApprovedRate( 2 );
end
//from row number: 2
rule "Row 1 Pricing loans"
dialect "mvel"
when
application : LoanApplication( amount > "10000" , amount <= "100000" ,
lengthYears == "20" , deposit < "2000" )
income : IncomeSource( type == "Job" )
then
application.setApproved( true );
application.setInsuranceCost( 0 );
application.setApprovedRate( 4 );
end
//from row number: 3
rule "Row 2 Pricing loans"
dialect "mvel"
when
application : LoanApplication( amount > "100001" , amount <= "130000" ,
lengthYears == "20" , deposit < "3000" )
income : IncomeSource( type == "Job" )
then
application.setApproved( true );
application.setInsuranceCost( 10 );
application.setApprovedRate( 6 );
end
==> My Java client follows
KnowledgeBase knowledgeBase = createKnowledgeBase(); //Successfully creates
knowledgebase
StatefulKnowledgeSession session =
knowledgeBase.newStatefulKnowledgeSession();
FactType appType = knowledgeBase.getFactType( "mortgages",
"LoanApplication" );
FactType incomeType = knowledgeBase.getFactType( "mortgages",
"IncomeSource" );
Object application = appType.newInstance();
Object income = incomeType.newInstance();
appType.set(application, "amount", 100000);
appType.set(application, "deposit", 1500);
appType.set(application, "lengthYears", 20);
incomeType.set(income, "type", "Job");
incomeType.set(income, "amount", 65000);
session.insert(appType);
session.insert(incomeType);
assertTrue(session.getFactCount() == 2);
session.fireAllRules();
assertTrue(session.getFactCount() == 3);
Question: I hope the way i pass the input satisfies "Row 2 Pricing loans"
above. But My assertion is getting failed after calling
fireAllRules()...because the factcount was still 2. Please help what could
be the wrong in above scenario.
thanks a lot.
--
View this message in context: http://drools.46999.n3.nabble.com/Drools-Guvnor-Decison-Tables-Rule-is-no...
Sent from the Drools: User forum mailing list archive at Nabble.com.
12 years, 7 months
Drools Guvnor 5.4.0 - Rules integration with database (Oracle)
by Ravikiran
Hi,
I working on creating a POC by creating set of web based rules within a
package using drools Guvnor and accessing them from my Java client.
Currently, my drools uses Jackrabbit repository (2 foldersrepository and
scripts and 1 file repository.xml) which is created within "bin" folder of
my JBoss AS.
I have gone through the steps given in user guide for database integration,
I am using Oracle as my database and i generated oracle based repository.xml
using the administration in Drools Guvnor and placed it under my bin folder.
I have stopped the server and deleted exsting 2 folders and one xml file. I
have restarted my server with the deployment of drools-guvnor.war. When i
start the guvnor web, it has asked me whether to load the sample packages
for the fisrt time, i said yes.
Now when i go and see in bin directory, i could still see one respository
folder. Also, i could see there were 6-7 tables have been created in oracle
database which were belongs to jboss drools only.
I would need some experts suggestion here,
is it the right way to do the rule integration with the database?
What is right way to promote the same changes to SIT or UAT?
Thanks in advance...
--
View this message in context: http://drools.46999.n3.nabble.com/Drools-Guvnor-5-4-0-Rules-integration-w...
Sent from the Drools: User forum mailing list archive at Nabble.com.
12 years, 7 months
Drools Chance
by Nick
Hi Team,
I was just wondering what is the status of the
development behind Drools Chance? I forked the repository on GitHub and
am quite impressed with the entire module, however I cannot tell how
stable it is.
So, I was wondering if there are any plans for a stable release, or if the module is still being developed.
Thank you,
Nick
12 years, 7 months
Why does it seem like salience is being ignored?
by Ladd
I'm using drools-camel 5.4.0.Final. ksession is stateful, I'm in STREAM
mode, and rules are fired with fireUntilHalt().
My test route is:
from( "direct:test-message" ).to(
"drools://node/ksession1?action=insertMessage" );
I'm sending my objects into the engine like so:
template.sendBody( "direct:test-message", new Person( "Bob" ) );
template.sendBody( "direct:test-message", new Person( "Jim" ) );
I have two rules that I'd like to fire in a specific order (1a followed by
1b).
If I define rule1a first in my drl it fires first as I would expect (with or
without a salience specified). But if I define rule1b first, that fires
first even though rule1a has a higher salience.
Here are my two rules / test cases and the results:
*Scenario 1 (rule1a first first as I want it to):*
rule += "rule rule1a salience 100 \n";
rule += " when \n";
rule += " $m : Message( body.class == Person.class, $body : body ) \n";
rule += " $p : Person() from $body \n";
rule += " then \n";
rule += " System.err.println( \"rule1a: Just found person \" +
$p.getName() ); \n";
rule += "end\n";
rule += "rule rule1b\n";
rule += " when \n";
rule += " $m : Message() \n";
rule += " then \n";
rule += " System.err.println( \"rule1b: Just found message \" +
$m.getBody().toString() ); \n";
rule += "end\n";
*Output:*
rule1a: Just found person Bob
rule1b: Just found message
org.apache.camel.component.bean.pojomessage.Person@b49448
rule1a: Just found person Jim
rule1b: Just found message
org.apache.camel.component.bean.pojomessage.Person@f4e9d3
*Scenario 2 (rule1b fires first even through rule1a has a higher salience):*
rule += "rule rule1b\n";
rule += " when \n";
rule += " $m : Message() \n";
rule += " then \n";
rule += " System.err.println( \"rule1b: Just found message \" +
$m.getBody().toString() ); \n";
rule += "end\n";
rule += "rule rule1a salience 100 \n";
rule += " when \n";
rule += " $m : Message( body.class == Person.class, $body : body ) \n";
rule += " $p : Person() from $body \n";
rule += " then \n";
rule += " System.err.println( \"rule1a: Just found person \" +
$p.getName() ); \n";
rule += "end\n";
*Output:*
rule1b: Just found message
org.apache.camel.component.bean.pojomessage.Person@1133fd6
rule1a: Just found person Bob
rule1b: Just found message
org.apache.camel.component.bean.pojomessage.Person@ca425c
rule1a: Just found person Jim
Something simple I'm sure. Any pointers to get my salience working?
Thanks for taking the time to help me out!!
- Ladd
--
View this message in context: http://drools.46999.n3.nabble.com/Why-does-it-seem-like-salience-is-being...
Sent from the Drools: User forum mailing list archive at Nabble.com.
12 years, 7 months