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
KieContainer#updateToVersion fails when both versions of a drl file contain an event type declaration for an existing class
by mikedev9000
I am using the latest drools 6.1.0-SNAPSHOT. I have two jars containing
different versions of a KieModule, and they each contain a drl file with an
event type declaration for an existing class. If I try to update the
container from one version to the other, the call to
KieContainer#updateToVersion returns a Results instance that contains errors
related to the @timestamp attribute on that event declaration. Here is an
example of the error message: "[Message [id=1, level=ERROR, path=r0.drl,
line=3, column=0
text=Error creating field accessors for timestamp field 'mytime' for type
'FooEvent']]".
The following .patch file can be used to add a unit test to the
IncrementalCompilationTest.java file that demonstrates this problem.
test_container_update_problem.patch
<http://drools.46999.n3.nabble.com/file/n4030100/test_container_update_pro...>
After applying the patch, and running this unit test, I see the following
test failure:
java.lang.AssertionError: Errors detected on updateToVersion: [Message
[id=1, level=ERROR, path=r0.drl, line=3, column=0
text=Error creating field accessors for timestamp field 'mytime' for type
'FooEvent']]
at org.junit.Assert.fail(Assert.java:88)
at org.junit.Assert.assertTrue(Assert.java:41)
at org.junit.Assert.assertFalse(Assert.java:64)
at
org.drools.compiler.integrationtests.IncrementalCompilationTest.testUpdateWithDeclarationPresent(IncrementalCompilationTest.java:95)
This error makes it nearly impossible for me to rely on and use
KieContainer#updateToVersion, because I need to allow frequent changes to be
made to drl files at run time, and I would prefer not to recreate the
KieContainer, and all of its KieBases and KieSessions on every update.
Is this a known issue? If so, are there plans to fix it before the
6.1.0.Final release?
--
View this message in context: http://drools.46999.n3.nabble.com/KieContainer-updateToVersion-fails-when...
Sent from the Drools: User forum mailing list archive at Nabble.com.
10 years, 4 months
kie-drools-wb-6.0.1 : view "artifact repository" is empty
by jps
Hello,
The artifact repository view in drools-wb is suddenly empty :( after having
uploaded a new jar. Before this operation, I had 3 artifacts that were
listed ..
I try to redeploy the app, restart jboss, delete JBOSS_HOME/bin/repository
and start again ... but still the list of artifact in the repository is
empty, although i can see it's not empty on the disk in
JBOSS_HOME/bin/repository/kie/...
Something has been corrupted somewhere. But I'm stuck. Any idea or
suggestions ?
What can prevent drools-wb from getting the repo data ?
Thanks
jps
--
View this message in context: http://drools.46999.n3.nabble.com/kie-drools-wb-6-0-1-view-artifact-repos...
Sent from the Drools: User forum mailing list archive at Nabble.com.
10 years, 4 months
Equality semantics of logical assertions and stated assertions
by mikerod
I understand that logical insertions in Drools does not insert two facts that
are equal according to their #equals implementation (and associated
#hashCode logic).
I'm basing this off of my own investigation plus the (well written)
documentation @
http://docs.jboss.org/drools/release/5.2.0.Final/drools-expert-docs/html/....
However, normal/stated fact assertions only use identity-based equality
checks - by default.
It looks like this can be changed to value-based equality via
RuleBaseConfiguration.
I have found some related, old Jiras:
https://issues.jboss.org/browse/JBRULES-266
https://issues.jboss.org/browse/JBRULES-233
In both cases, Mark Proctor had a final remark, but I wasn't able to
understand what was really decided and why.
One specific comment @ https://issues.jboss.org/browse/JBRULES-266 is,
"logical assertions are always equality based. Stated facts can now use
identity and equality - using your configuration settings.
I have added another configuration setting to dictate how logical over-ride
works. Does it discard the original fact, or turn it into two stated fact
handles."
What is the reasoning behind only using the value-based equality for logical
assertions?
Why is it not configurable as stated fact assertions are?
Also, why is the default behavior of stated fact assertion to be
identity-based equality?
- I find the inconsistency between the default for normal assertions and the
(only option) for logical assertion to be a bit confusing/inconsistent.
I'm just looking for an understanding the motivation behind these design
decisions.
I have had a lot of performance issues using, primarily, logical assertions
due to the "no duplicate" checking being done.
Even the stated assertions do still come with a cost of creating the initial
FactHandle.
With deeply nested/complex domain objects, the #equals and #hashCode
implementations may be quite expensive when executed many times throughout
rule execution.
This is especially prominent in accumulators that may later accumulate these
objects into collections that then are also subject to this equals/hashCode
"penalty".
I have a related post a while back @
http://drools.46999.n3.nabble.com/Object-size-impact-on-session-insertion....
I do not believe it is typical to use complex domain model objects as the
keys to something like a HashMap.
One reason (there are more; especially for mutable objects) would be due to
the performance around having them be hashed and equality checked regularly
when the
map is accessed, modified, etc.
The creation of many FactHandle's has shown up in some of my profiling
performance problems due to this the constructor immediately hashing my
domain model objects.
I think the reason the fact handles use this information is for value-based
equality comparisons - such as the only method used by the Truth Maintenance
System logical assertions.
I would really appreciate more insight into the motivation for not allowing
#equals facts to be logically asserted separately into working memory -
especially since there is a price to pay for the behavior in my case.
--
View this message in context: http://drools.46999.n3.nabble.com/Equality-semantics-of-logical-assertion...
Sent from the Drools: User forum mailing list archive at Nabble.com.
10 years, 4 months
Rules not picked when packaged inside the JAR
by ash316
I am working on DROOLS 6.0.1 application. I have my rule files (*.drl)
packaged inside a separate project which is included as a jar file as a
maven dependency. When I deploy my project, KIEModule is not able to find
the rules files (which are packaged inside the jar above). I am not getting
an error though but rules are not getting fired.If I manually place the
rules files under classpath say WEB-INF/rules/*.drl they are detected and
rules are executed.I was under impression that KIEmodules are auto
discovered from anywhere in classpath.Any pointers are appreciated. This is
general question hence I have not included the comprehensive code files.
Everything start working once I place the *.drl files in the classpath (take
them outside of jar).I have opened the JIRA issue @ Link
<https://issues.jboss.org/browse/DROOLS-466> Thanks
--
View this message in context: http://drools.46999.n3.nabble.com/Rules-not-picked-when-packaged-inside-t...
Sent from the Drools: User forum mailing list archive at Nabble.com.
10 years, 4 months
kbase using kie
by Chris B
I am using 6.0.1 and having difficulties in kmodule.xml.
My goal is to have a directory where I can keep putting new rules which
should be automatically picked up.
But looks like drools is looking in the jar file for new rules.
What should be my entries.
My current kmodule.xml
###################
<?xml version="1.0" encoding="UTF-8"?>
<kmodule xmlns="http://jboss.org/kie/6.0.0/kmodule">
<kbase name="rules" packages="DRL" eventProcessingMode="stream">
<ksession name="ksession-rules"/>
</kbase>
</kmodule>
My pom.properties
####################
#Generated by Maven
#Wed Jun 25 17:53:00 PDT 2014
version=0.0.1
groupId=com.myc
artifactId=MyProject
The output which I am getting
#####################
2014-06-29 16:45:08 o.d.c.k.b.i.ClasspathKieProject [INFO] Found kmodule:
jar:file:/home/chrism/apache-storm-0.9.1-incubating/lib/MyProject-0.0.1.jar!/META-INF/kmodule.xml
2014-06-29 16:45:08 o.d.c.k.b.i.ClasspathKieProject [DEBUG] KieModule URL
type=jar
url=/home/chrism/apache-storm-0.9.1-incubating/lib/MyProject-0.0.1.jar
2014-06-29 16:45:08 o.d.c.k.b.i.ClasspathKieProject [DEBUG] Found and used
pom.properties META-INF/maven/com.myc/MyProject/pom.properties
2014-06-29 16:45:08 o.d.c.k.b.i.ClasspathKieProject [DEBUG] Discovered
classpath module com.myc:MyProject:0.0.1
2014-06-29 16:45:09 o.d.c.k.b.i.KieRepositoryImpl [INFO] KieModule was
added:ZipKieModule[
ReleaseId=com.myc:MyProject:0.0.1file=/home/chrism/apache-storm-0.9.1-incubating/lib/MyProject-0.0.1.jar]
2014-06-29 16:45:09 o.d.c.k.b.i.ClasspathKieProject [INFO] Found kmodule:
jar:file:/home/chrism/apache-storm-0.9.1-incubating/lib/MyProject-0.0.1.jar!/META-INF/kmodule.xml
2014-06-29 16:45:09 o.d.c.k.b.i.ClasspathKieProject [DEBUG] KieModule URL
type=jar
url=/home/chrism/apache-storm-0.9.1-incubating/lib/MyProject-0.0.1.jar
2014-06-29 16:45:09 o.d.c.k.b.i.ClasspathKieProject [DEBUG] Found and used
pom.properties META-INF/maven/com.myc/MyProject/pom.properties
2014-06-29 16:45:09 o.d.c.k.b.i.ClasspathKieProject [DEBUG] Discovered
classpath module com.myc:MyProject:0.0.1
2014-06-29 16:45:09 o.d.c.k.b.i.KieRepositoryImpl [INFO] KieModule was
added:ZipKieModule[
ReleaseId=com.myc:MyProject:0.0.1file=/home/chrism/apache-storm-0.9.1-incubating/lib/MyProject-0.0.1.jar]
2014-06-29 16:45:09 o.d.c.k.b.i.AbstractKieModule [WARN] No files found for
KieBase rules
----------------------------
As above it is not able to read the rules as the rules are located in the
filesystem somewhere else like in /a/b/c directory and it is in the
classpath, but not being read as it seems to be only looking in jar file
Any help greatly appreciated.
--
View this message in context: http://drools.46999.n3.nabble.com/kbase-using-kie-tp4030187.html
Sent from the Drools: User forum mailing list archive at Nabble.com.
10 years, 5 months
Delay between rule firing using Drools 5.6
by Arul Prashanth
We have a series of decision tables and for a particular set of decision
table we see that for the first time when the rule is fired, there is a
delay between the After Activation of Rule 1 and Before Activation of Rule
2. This happens only when the Rules are fired for the first time. Since
there are 200 decision table rows each execution seems to take longer.
The condition for the rules to fire is
$if : facts()
$fact : Fact(factType == "XYZ") from $if.Fact
$if.Fact is an array list which has 200 Fact objects. Does this iteration
takes time?
We use Drools 5.6
Any help would be great.
-----
- Prashanth
--
View this message in context: http://drools.46999.n3.nabble.com/Delay-between-rule-firing-using-Drools-...
Sent from the Drools: User forum mailing list archive at Nabble.com.
10 years, 5 months
BRMS Build & Deploy
by Shrinath Managuli
Hi Drools,
Is it possible to automate the Build & Deploy processes in BRMS?
[cid:image001.png@01CF90A3.E6E26760]
Thanks,
Shrinath
[Aspire Systems]
This e-mail message and any attachments are for the sole use of the intended recipient(s) and may contain proprietary, confidential, trade secret or privileged information. Any unauthorized review, use, disclosure or distribution is prohibited and may be a violation of law. If you are not the intended recipient, please contact the sender by reply e-mail and destroy all copies of the original message.
[Aspire Systems]
This e-mail message and any attachments are for the sole use of the intended recipient(s) and may contain proprietary, confidential, trade secret or privileged information. Any unauthorized review, use, disclosure or distribution is prohibited and may be a violation of law. If you are not the intended recipient, please contact the sender by reply e-mail and destroy all copies of the original message.
10 years, 5 months