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, 4 months
Drools Planner: Vehicle routing problems
by davidglassborow
Hi,
as discussed the other day with Ge0ffrey on IRC, I've been trying to
get some vehicle routing done using the new TSP / chaining functionality in
drools planner.
I've written an example, but am having problems with the chaining of jobs
together. After pulling my hair out, I've put together an example into my
fork of planner, showing a simplified example of how I am approaching it,
and the problem that can be replicated.
https://github.com/davidglassborow/drools-planner/tree/vehicle_routing
It is a very simple console app along the same lines as the hello world
example for NQueens.
On running it will print out the chains, and you will see the some Jobs
appear more than once in the same list.
On the planning variable it seems to be get assigned in front of itself,
I've put some notes in the source, and checked that the same doesn't occur
in your TSP example.
I'm not sure if its a bug in the way I've setup things, or whether its an
issue in the chain move code.
Greatly appreciated if anybody in the know gets a chance to have a look.
Thanks,
David
--
View this message in context: http://drools.46999.n3.nabble.com/Drools-Planner-Vehicle-routing-problems...
Sent from the Drools: User forum mailing list archive at Nabble.com.
10 years, 6 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, 8 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, 9 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
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