How to read XML using XMLPackageReader-Drools-compiler.5.2.1.final?
by Praveen
Hi,
I am using Drools-compiler.5.2.1.final.
I am trying to convert an drl to xml and vice versa using DrlParser,
DrlDumper, XMLPackageReader and XML Dumper.
Drl to XML conversion works fine but XML to Drl throws NPE.
I have placed the XML file under a folder called sample.
NPE is thrown at line 5..
Also attached is the exception.
Please suggest.
TIA.
Reader source = new InputStreamReader(
DroolsConversionHelper.class.getResourceAsStream(xmlFileName));
PackageBuilderConfiguration conf = new PackageBuilderConfiguration();
XmlPackageReader reader = new
XmlPackageReader(conf.getSemanticModules());
DrlDumper dumper = new DrlDumper();
//line 5 reader.read(source);
PackageDescr descr = reader.getPackageDescr();
String test = dumper.dump(descr);
System.out.println(test);
java.lang.NullPointerException
at
org.drools.xml.ExtensibleXmlParser.resolveSchema(ExtensibleXmlParser.java:696)
at
org.drools.xml.ExtensibleXmlParser.resolveEntity(ExtensibleXmlParser.java:622)
at
com.sun.org.apache.xerces.internal.util.EntityResolverWrapper.resolveEntity(Unknown
Source)
at
com.sun.org.apache.xerces.internal.impl.XMLEntityManager.resolveEntity(Unknown
Source)
at
com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaLoader.resolveDocument(Unknown
Source)
at
com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator.findSchemaGrammar(Unknown
Source)
at
com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator.handleStartElement(Unknown
Source)
Regards,
Praveen.
--
View this message in context: http://drools.46999.n3.nabble.com/How-to-read-XML-using-XMLPackageReader-...
Sent from the Drools: User forum mailing list archive at Nabble.com.
10 years, 5 months
Spring, KnowledgeAgent, and Guvnor
by paulB
I'm having a problem connecting my KnowledgeAgent to a package in Guvnor.
I'm using Spring to instantiate the KnowledgeAgent. The agent initializes
perfectly well when I point to a local change-set that in-turn points to a
local rule. However, even though I have the same rule in a package in
Guvnor, the KnowledgeAgent fails with the following exception when I point
to the package's change-set in Guvnor:
The code at KnowledgeBaseImpl.java:148 is (using 5.3.0.Final):
Here is the simple rule in the Guvnor as returned by the URL for the package
source URL:
Here is the local change-set definition. The line that is commented is the
failing resource, whereas the local file resource works fine:
Guvnor is residing on a Tomcat server.
I could not find anything related to this on the forum. Thank you for any
hints.
-Paul
--
View this message in context: http://drools.46999.n3.nabble.com/Spring-KnowledgeAgent-and-Guvnor-tp3500...
Sent from the Drools: User forum mailing list archive at Nabble.com.
10 years, 7 months
named query TasksAssignedAsPotentialOwner doesn't work with MySql db
by Frank Knoll
Hi,
When I add a task (having two potential owners) by calling the method
addTask followed by calling the method getTasksAssignedAsPotentialOwner of
org.jbpm.task.service.TaskClient I expect to receive a list of TaskSummaries
containing at least the previously added task. But I actually get an empty
list!
Here is my setup and possible solution:
I am using the trunk version of
./jbpm-human-task/src/main/resources/META-INF/orm.xml and a MYSQL database.
When calling addTask the Task table will be populated with a NULL
actualOwner_id.
The named query TasksAssignedAsPotentialOwner
"select new org.jbpm.task.query.TaskSummary(...t.taskData.actualOwner...)
from ... left join t.taskData.actualOwner ..." of orm.xml generates SQL
consisting of an inner join "inner join OrganizationalEntity user7_ on
task0_.actualOwner_id=user7_.id" which doesn't take the NULL actualOwner_id
correctly into account.
When I replace the named query TasksAssignedAsPotentialOwner with
"select new org.jbpm.task.query.TaskSummary(...actualOwner...) from ...left
join t.taskData.actualOwner as actualOwner ...", then the generated SQL
consists of an "left outer join OrganizationalEntity user2_ on
task0_.actualOwner_id=user2_.id" which takes the NULL actualOwner_id
correctly into account. So I get a List of TaskSummaries containing the
added task.
Is this a correct fix?
Cheers, Frank
--
View this message in context: http://drools.46999.n3.nabble.com/named-query-TasksAssignedAsPotentialOwn...
Sent from the Drools: User forum mailing list archive at Nabble.com.
10 years, 9 months
Error Inserting events into drools fusion stream
by Ayush
Hi All,
I'm trying to implement drools fusion into my app. The scenario of my app is
as follows:
- Facts will be received continuosly.
- On receving fact I'm generating a new event and adding it into a new
working memory entry point stream. Also I'm adding facts into session coz
I'll be updating them.
- I need to apply rules on continuous stream of events.
- I've not used any camel + spring or pipeline. Are these mandatory to use?
For 1st fact everything works fine but when I receive 2nd fact I'm getting
Now when I'm trying to get entry point on receive of 2nd alarm I'm getting
org.drools.RuntimeDroolsException: Unexpected exception executing action
org.drools.reteoo.PropagationQueuingNode$PropagateAction@9ff411 Caused by:
java.util.concurrent.RejectedExecutionException.
On debug I found that the above exception is coming when I'm calling
session.getWorkingMemoryEntryPoint("MyStream"); Can anyone please help me
that how should I insert facts and events into working memory?
I'd invested ample amount of time searching for this but I'm empty handed.
Guys please help this is very urgent for me. Thanks in anticipation
--
View this message in context: http://drools-java-rules-engine.46999.n3.nabble.com/Error-Inserting-event...
Sent from the Drools - User mailing list archive at Nabble.com.
10 years, 10 months
Date equal comparison fails - don't understand why
by Saloojee, Karim
Hi
I am comparing SimpleAccount( dateAccountOpened == "5-Feb-2011")
where dateAccountOpened is "Sat Feb 05 00:00:00 GMT+02:00 2011" (if you
call toString()). The equal comparator fails (==) but the greater than
comparator passes (>) which I don't understand.
I feel I am missing something obvious here, but I have no idea what it
is.
rule "Test date equality"
when
$acc : SimpleAccount( dateAccountOpened == "5-Feb-2011")
then
System.out.println("Expected and found an account opened
on 5-Feb-2011: " + $acc);
end
rule "Some dates are more equal than others"
when
$acc : SimpleAccount( dateAccountOpened > "5-Feb-2011")
then
System.out.println("Unexpected match: " +
$acc.getDateAccountOpened());
end
Regards,
Karim
To read FirstRand Bank's Disclaimer for this email click on the following address or copy into your Internet browser:
https://www.fnb.co.za/disclaimer.html
If you are unable to access the Disclaimer, send a blank e-mail to
firstrandbankdisclaimer(a)fnb.co.za and we will send you a copy of the Disclaimer.
11 years, 1 month
Drools server and knowledge agent functionality
by Manuel Ortiz
Hello everybody:
I am taking a look at Drools Integration documentation to understand how
Drools server works and how can be used, and have a doubt concerning, let's
say... 'KnowledgeAgent capabilities'. Does Drools server support on the fly
rule updating as when using KnowledgeAgent to create KnowledgeBase objects?
If it does, where can be configured 'KnowledgeAgent related' properties such
as newInstance or resource scanner interval?
Thank you in advance for your time.
Kind regards,
Manuel Ortiz.
11 years, 1 month
Question about custom accumulation functions
by Bruno Freudensprung
Hi,
While testing my custom accumulation function I noticed an unexpected
behavior (th'ats of course a personal point of view).
It seems that Drools 5.1 calls accumulate(...) and getResult(...) as
many times as the number of accumulated facts (accumulate, getResult,
accumulate, getResult, etc...).
Is it supposed to work like this?
Best regards,
Bruno.
11 years, 2 months
Dependency enumeration
by agarwalk
Hi
I have created following enumeration and java class file.
*Enumeration:*
'OrderData.propertyState':(new com.asps.rules.OrderData()).loadStates()
'OrderData.fulfillmentReviewerName[propertyState]':'(new
com.asps.rules.OrderData()).loadReviewers("@{propertyState}")'
*Java class:*
public class OrderData implements Serializable {
private String propertyState;
private String fulfillmentReviewerName;
// getters and setters
public List<String> loadStates() {
List<String> states = new ArrayList<String>();
states.add("CA");
states.add("NY");
states.add("FL");
return states;
}
public List<String> loadReviewers(final String propertyState) {
List<String> reviewers = new ArrayList<String>();
System.out.println("### in load reviewers ### : " + propertyState);
if ("CA".equalsIgnoreCase(propertyState)) {
reviewers.add("A");
reviewers.add("B");
System.out.println("Reviewers : A & B");
} else if ("NY".equalsIgnoreCase(propertyState)) {
reviewers.add("C");
reviewers.add("D");
System.out.println("Reviewers : C& D");
} else if ("FL".equalsIgnoreCase(propertyState)) {
reviewers.add("E");
reviewers.add("F");
System.out.println("Reviewers : E& F");
} else {
reviewers.add("G");
reviewers.add("H");
System.out.println("Reviewers : G& H");
}
return reviewers;
}
}
I created a rule as follows
WHEN
There is an OrderData with:
propertyState[propertyState]* FL* --- This is a drop down which
is being displayed correctly
fulfillmentReviewerName [fulfillmentReviewerName] -- This should
have been the drop down. Values are dependent on the state selected.
When i try to create above rule the enumeration is loaded correctly for
propertyState but the enumeration is not loaded for fulfillmentReviewerName
field. When I saw the logs the correct method and condition is being
invoked (as per Sys out)but drop down does not contain anything.
ANy suggestions?
--
View this message in context: http://drools.46999.n3.nabble.com/Dependency-enumeration-tp3245703p324570...
Sent from the Drools: User forum mailing list archive at Nabble.com.
11 years, 3 months