Upgrade from drools 5.4 to 6.0.0-Beta3 - Legacy API Adapter JAR
by MaverickDrools
Hi,
There is not enough documentation on drools v6.0.0-Beta3, but this is what
I'm trying to do.
Our system was designed with 5.3 but then we encountered the issue with
synchronization (https://issues.jboss.org/browse/JBRULES-3283), so we
upgraded to v 5.4.
Things worked fine until we multithreaded the client code due to which we
faced another issue (https://issues.jboss.org/browse/JBRULES-3675)
So finally now, I'm trying to upgrade to 6.0.0-Beta3 since both those issues
should've been fixed with 6.0.0-Alpha1. The problem I'm facing is, I do not
have enough documentation to look at to see how to convert those things. I
went through the slides etc that were posted on the mailing list for the
conferences, but I'm still unable to figure it out correctly..
So, can someone point me to a JUnit or something that I can look at to
figure this thing out?
static {
KieServices ks = KieServices.Factory.get();
KieRepository kr = ks.getRepository();
Resource res = ks.getResources().newFileSystemResource(
"src/main/resources/rules/abc.drl");
KieModule kModule = kr.addKieModule(res);
kc = ks.newKieContainer(kModule.getReleaseId());
}
throws an exception on kr.addKieModule(res) which says Error in opening zip
file.. I assume we are now expecting a jar instead of a plain drl file. Is
there a way to convert this drl into a jar that the 6.0 code can understand
(for compatibility purposes with the existing system)?
Another thought was to make use of the Legacy API Adapter JAR, but I
couldn't find any examples of the same. Can you point me to a code
sample/JUnit that could explain how this works?
Thanks
--
View this message in context: http://drools.46999.n3.nabble.com/Upgrade-from-drools-5-4-to-6-0-0-Beta3-...
Sent from the Drools: User forum mailing list archive at Nabble.com.
12 years
java.lang.NullPointerException when using a custom operator
by Hezi Stern
Hi all,
I have been working with Drools 5.2.0 on windows xp and I have a stable
project.
I upgraded to windows 8, drools 5.5.0 and upgraded to eclipse Juno (from
Helios).
I have now encountered a strange problem with my existing drools project. I
have a accustom operator called supersetof which now results in the
following error reported in the IDE in any file where the supersetOf is used
(LHS):
Error: java.lang.NullPointerException
After receving this error the drools parser does not work, hence this is the
only error I have.
I have tried to use the Drools 5.2.0 again (on the new windows 8 machine)
but I get the same problem so I guess it has to do with some IDE\eclispe
configuration or compatibility issue.
Obviously not the drools project code as I have not made any changes to the
working project.
I did make sure the custom operator is configured similar to the way it was
on my previous computer.
Any ideas? Is there a different configuration for Juno?
Thanks,
Hezi
12 years
5.6.0.CR1 gives a NullPointerException in after evaluator
by abr
Hi everyone,
I tried to switch from 5.5.0.Final to 5.6.0.CR1 and got a null pointer
exception in the evaluation of the after evaluator.
(Exact method is:
/org.drools.base.evaluators.AfterEvaluatorDefinition.AfterEvaluator.evaluate(InternalWorkingMemory,
InternalReadAccessor, InternalFactHandle, InternalReadAccessor,
InternalFactHandle)/ )
When debugging, the exception occurs at the very first line of the method,
in:
/ if ( extractor1.isNullValue( workingMemory, handle1.getObject() ) ||
extractor2.isNullValue( workingMemory, handle2.getObject() ) ) {
return false;
}
/
The cause of the exception is that handle1 is null.
The rule where the exception occurs looks like:
/ MyFact(
fromdate before[ 0d ] $min,
( todate == null || todate after[ 0d ] $max ) )
/
When the exception occurs, /MyFact.fromdate/ is not null, /$min/ is not
null, /MyFact.todate/ is null, /$max/ is not null.
In AfterEvaluator.evaluate : /extractor1/ refers to /MyFact.todate/,
/extractor2/ refers to /$max/, /handle1/ is null, /handle2/ refers to the
fact including the attribute to which /$max/ variable is bound to.
Of course, this worked fine in 5.5.0.Final.
I couldn't test this out in Drools 6.0.0.CR5 because I have dependencies to
drools-spring JAR that does not exist anymore in 6.0.0.CR5.
Is it simple to fix this problem?
Thanks in advance.
Best,
Alexis
--
View this message in context: http://drools.46999.n3.nabble.com/5-6-0-CR1-gives-a-NullPointerException-...
Sent from the Drools: User forum mailing list archive at Nabble.com.
12 years, 1 month
Guvnor enumerations
by Stephen Masters
Hi folks,
I don't suppose anything notable changed between 5.3 and 5.5 in the way Guvnor loads data enumerations?
I have a number of enumerations similar to the following:
'MyFact.currencies' : (new com.myapp.guvnor.enums.CurrencyEnum()).isoCodes()
But I see the exception in Guvnor:
Unable to load enumeration data.
[Error: unable to invoke method: isoCodes] [Near :{... 'MyFact.': ….}] ^ [Line: 1, Column: 1]
Error type: org.mvel2.PropertyAccessException
The jar is in the lib directory, there is a method called "isoCodes()", and when I run the main class inside it then the various enumerations are returned. And yes, it did (does) work absolutely fine in 5.3 with this same configuration.
Steve
12 years, 1 month
Planner with a list of planning variables
by Justin Case
Hello all,
can I use as planning variable a list of values?
Here's a test use case: planning a food recipe, where the recipe can have say maximally 5 ingredients (taken from the solution property, I guess). So far I could find in the examples and documentation, it's all about ONE planning variable in the solution, but here I'd need a LIST of such... is it actually doable this way?
I cannot do it the other way around, as an ingredient may be found in more recipes...
Many thanks,
JC
12 years, 2 months
permgen leak
by brachi
i'm using drools 5.5.0, after the rules deployment, (associate DRL's with the
KnowladBase and compile them)
my permgen grows to 500m, and also if i undeploy, the permgen doesn't
cleaned up. (only if i restart the server)
It won't help me to increase the permgen size, because the client does a lot
of heavy deployment, and can be in the maximum size by 3-4 deployments.
I tried this tomcat flags, and it does nothing:
-XX:+UseConcMarkSweepGC -XX:+CMSPermGenSweepingEnabled
-XX:+CMSClassUnloadingEnabled -XX:+UseParNewGC
I tried set the flag : PermGenThreshold=0, like other people suggested in
your forums and it doesn't help.
any help? it's production issue...
--
View this message in context: http://drools.46999.n3.nabble.com/permgen-leak-tp4027038.html
Sent from the Drools: User forum mailing list archive at Nabble.com.
12 years, 2 months
[Optaplanner] Filter values
by Mats Norén
Hi,
I've got a domain with the following entities:
- Person (planning entity)
- Desk (planning variable)
- DeskAssignment (solution)
All persons should be assigned to a desk according to some rules.
What I would like to do is to make certain Persons and their Desk
immovable, ie, they are assigned a desk in the initial solution and should
be fixed there. They are only there for the score calculation.
I looked at 14.3.1 Immovable planning entities but couldn't really see how
I would apply it to my use case.
Why is the filter applied at the planning entity level? Since it's the
planning variable that changes I thought that I should somehow filter the
allowed values for the Desk.
Regards,
Mats
12 years, 2 months
Drool 6.0.0.Final, 2 question re kie-maven-plugin, please?
by Matteo Mortari
Ciao, with premise I'm not a Maven expert...
I'm following now the new recommended version for 6.0 KIE project/module
development as documented in [1] by generating a new maven archetype
"quickstart" but if compared to the documentation I found, at least in my
case, I had at a minimum to apply also the following in the pom.xml:
A. the packaging must be changed to "kjar"
B. if the project and the rules depend on an external library/maven
artifact, say for instance the object model or domain model objects the
rules will be based on, it is NOT enough to declare them in the
pom.xml <dependencies>, but the exact same dependencies MUST ALSO be also
declared within the kie-maven-plugin <plugin> <dependencies> as well.
Failing to do so, would imply that, respectively:
A. when you run Maven with the default "mvn package" or "mvn deploy" etc,
the kie-maven-plugin would not trigger
B. kie-maven-plugin will fail the build because unable to resolve the
"external" classes referenced in the .drl, with a message similar to
[ERROR] Message [id=3, level=ERROR, path=package.drl, line=3, column=0
text=Unable to find class 'classname']
Questions are:
1. Is this correct, or I'm just complicating my life without noticing, and
it is existing a simpler way, please?
2. Especially point #B, is this really the intended behavior, having to
replicate the dependencies in the two parts of the pom.xml ?
Thanks if somebody can feedback on this,
Ciao
MM
I'm making reference to:
[1]
http://docs.jboss.org/drools/release/6.0.0.Final/drools-docs/html_single/...
For reference, here is an example pom.xml I'm using:
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="
http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="
http://maven.apache.org/POM/4.0.0
http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.acme</groupId>
<artifactId>my-rules</artifactId>
<version>0.0.1</version>
<!-- point #A, must set to kjar -->
<packaging>kjar</packaging>
<!-- ... -->
<dependencies>
<!-- maven artifact containing the object model or domain model objects
the rules will be based on -->
<dependency>
<groupId>com.acme</groupId>
<artifactId>object-model</artifactId>
<version>0.0.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.11</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<finalName>my-rules</finalName>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.7</source>
<target>1.7</target>
</configuration>
</plugin>
<plugin>
<groupId>org.kie</groupId>
<artifactId>kie-maven-plugin</artifactId>
<version>6.0.0.Final</version>
<extensions>true</extensions>
<dependencies>
<!-- point #B, the dependency must be repeated in here as well -->
<dependency>
<groupId>com.acme</groupId>
<artifactId>object-model</artifactId>
<version>0.0.1-SNAPSHOT</version>
</dependency>
</dependencies>
</plugin>
</plugins>
<!-- The following is added to avoid Eclipse ERROR at the pom.xml line
defining the kie-maven-plugin, by explicitly telling Eclipse to avoid run
the plugin on Eclipse-build, leaving it trigger only when running Maven, eg
"mvn package" or "mvn deploy", etc etc , see
http://wiki.eclipse.org/M2E_plugin_execution_not_covered -->
<pluginManagement>
<plugins>
<plugin>
<groupId>org.eclipse.m2e</groupId>
<artifactId>lifecycle-mapping</artifactId>
<version>1.0.0</version>
<configuration>
<lifecycleMappingMetadata>
<pluginExecutions>
<pluginExecution>
<pluginExecutionFilter>
<groupId>org.kie</groupId>
<artifactId>kie-maven-plugin</artifactId>
<versionRange>[6.0.0,)</versionRange>
<goals>
<goal>build</goal>
</goals>
</pluginExecutionFilter>
<action>
<ignore />
</action>
</pluginExecution>
</pluginExecutions>
</lifecycleMappingMetadata>
</configuration>
</plugin>
</plugins>
</pluginManagement>
</build>
<!-- ... -->
</project>
12 years, 2 months
Drools KB Object hierarchy Serilisation and Deserialisation thread safety issue
by adarsh.chaini@hsbcib.com
Hi,
We have found that some of the drools classes are not thread safe and
hence causing the whole KB serialisation and deserialisation issues in
a highly concurrent distributed cluster.
The below is an example of one of the instances we have come across where
the usage of a non thread safe collection as instance variables has
caused the issue.
Could someone look into this and advise:
1) If this has been reported /identified and logged somewhere as an issue
already
2)If there has been any fix to problems like this in later versions of
5.3.0.Final ?.
3)If not fixed already what is the process to initiate a fix.
Caused by: java.io.InvalidObjectException: Illegal mappings count: -1
at java.util.HashMap.readObject(HashMap.java:1130)
at sun.reflect.GeneratedMethodAccessor4.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(
DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:601)
at java.io.ObjectStreamClass.invokeReadObject(
ObjectStreamClass.java:1004)
at java.io.ObjectInputStream.readSerialData(
ObjectInputStream.java:1891)
at java.io.ObjectInputStream.readOrdinaryObject(
ObjectInputStream.java:1796)
at java.io.ObjectInputStream.readObject0(
ObjectInputStream.java:1348)
at java.io.ObjectInputStream.readObject(ObjectInputStream.java:370
)
at org.jbpm.workflow.core.DroolsAction.readExternal(
DroolsAction.java:61)
at
org.jbpm.workflow.core.impl.DroolsConsequenceAction.readExternal(
DroolsConsequenceAction.java:49)
at java.io.ObjectInputStream.readExternalData(
ObjectInputStream.java:1835)
at java.io.ObjectInputStream.readOrdinaryObject(
ObjectInputStream.java:1794)
at java.io.ObjectInputStream.readObject0(
ObjectInputStream.java:1348)
at java.io.ObjectInputStream.readObject(ObjectInputStream.java:370
)
at org.drools.rule.JavaDialectRuntimeData.readExternal(
JavaDialectRuntimeData.java:182)
at java.io.ObjectInputStream.readExternalData(
ObjectInputStream.java:1835)
at java.io.ObjectInputStream.readOrdinaryObject(
ObjectInputStream.java:1794)
at java.io.ObjectInputStream.readObject0(
ObjectInputStream.java:1348)
at java.io.ObjectInputStream.readObject(ObjectInputStream.java:370
)
at java.util.HashMap.readObject(HashMap.java:1155)
at sun.reflect.GeneratedMethodAccessor4.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(
DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:601)
at java.io.ObjectStreamClass.invokeReadObject(
ObjectStreamClass.java:1004)
at java.io.ObjectInputStream.readSerialData(
ObjectInputStream.java:1891)
at java.io.ObjectInputStream.readOrdinaryObject(
ObjectInputStream.java:1796)
at java.io.ObjectInputStream.readObject0(
ObjectInputStream.java:1348)
at java.io.ObjectInputStream.readObject(ObjectInputStream.java:370
)
at org.drools.rule.DialectRuntimeRegistry.readExternal(
DialectRuntimeRegistry.java:59)
at java.io.ObjectInputStream.readExternalData(
ObjectInputStream.java:1835)
at java.io.ObjectInputStream.readOrdinaryObject(
ObjectInputStream.java:1794)
at java.io.ObjectInputStream.readObject0(
ObjectInputStream.java:1348)
at java.io.ObjectInputStream.readObject(ObjectInputStream.java:370
)
at org.drools.rule.Package.readExternal(Package.java:197)
at java.io.ObjectInputStream.readExternalData(
ObjectInputStream.java:1835)
at java.io.ObjectInputStream.readOrdinaryObject(
ObjectInputStream.java:1794)
at java.io.ObjectInputStream.readObject0(
ObjectInputStream.java:1348)
at java.io.ObjectInputStream.readObject(ObjectInputStream.java:370
)
at java.util.HashMap.readObject(HashMap.java:1155)
at sun.reflect.GeneratedMethodAccessor4.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(
DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:601)
at java.io.ObjectStreamClass.invokeReadObject(
ObjectStreamClass.java:1004)
at java.io.ObjectInputStream.readSerialData(
ObjectInputStream.java:1891)
at java.io.ObjectInputStream.readOrdinaryObject(
ObjectInputStream.java:1796)
at java.io.ObjectInputStream.readObject0(
ObjectInputStream.java:1348)
at java.io.ObjectInputStream.readObject(ObjectInputStream.java:370
)
at org.drools.common.AbstractRuleBase.readExternal(
AbstractRuleBase.java:270)
at org.drools.reteoo.ReteooRuleBase.readExternal(
ReteooRuleBase.java:223)
at org.drools.impl.KnowledgeBaseImpl.readExternal(
KnowledgeBaseImpl.java:116)
at java.io.ObjectInputStream.readExternalData(
ObjectInputStream.java:1835)
at java.io.ObjectInputStream.readOrdinaryObject(
ObjectInputStream.java:1794)
at java.io.ObjectInputStream.readObject0(
ObjectInputStream.java:1348)
at java.io.ObjectInputStream.readObject(ObjectInputStream.java:370
)
at com.hsbc.gbm.dsl.domain.DSLRuleSet$Serializer.createInstance(
DSLRuleSet.java:328)
at com.hsbc.gbm.dsl.domain.DSLRuleSet$Serializer.createInstance(
DSLRuleSet.java:1)
at com.hsbc.gbm.dsl.domain.AbstractSerializer.deserialize(
AbstractSerializer.java:144)
Thanks and regards,
Adarsh CHAINI
SENIOR LEAD DEVELOPMENT SPECIALIST | HSBC Bank Plc
8 Canada Square, London E14 5HQ, UK
_______________________________________________
Phone
Int: (0)79914720 Ext: +44 (0)20 79914720
Mobile
+44(0)7595530105
Email
adarsh.chaini(a)hsbcib.com
_______________________________________________
Protect our environment - please only print this if you have to!
************************************************************
HSBC Bank plc may be solicited in the course of its placement efforts for
a new issue, by investment clients of the firm for whom the Bank as a firm
already provides other services. It may equally decide to allocate to its
own proprietary book or with an associate of HSBC Group. This represents a
potential conflict of interest. HSBC Bank plc has internal arrangements
designed to ensure that the firm would give unbiased and full advice to
the corporate finance client about the valuation and pricing of the
offering as well as internal systems, controls and procedures to identify
and manage conflicts of interest.
HSBC Bank plc
Registered Office: 8 Canada Square, London E14 5HQ, United Kingdom
Registered in England - Number 14259
Authorised by the Prudential Regulation Authority and regulated by the
Financial Conduct Authority and the Prudential Regulation Authority
************************************************************
-----------------------------------------
SAVE PAPER - THINK BEFORE YOU PRINT!
This transmission has been issued by a member of the HSBC Group
"HSBC" for the information of the addressee only and should not be
reproduced and/or distributed to any other person. Each page
attached hereto must be read in conjunction with any disclaimer
which forms part of it. Unless otherwise stated, this transmission
is neither an offer nor the solicitation of an offer to sell or
purchase any investment. Its contents are based on information
obtained from sources believed to be reliable but HSBC makes no
representation and accepts no responsibility or liability as to its
completeness or accuracy.
12 years, 2 months
DRL file not getting picked
by dwipin
Hi,
I am using kie-spring.6.0.0.Final artefact to build my project.
This is my app ctx data -
<kie:kmodule id="module-1">
<kie:kbase name="kbase" packages="validation_rules">
<kie:ksession name="ksession">
<kie:consoleLogger />
</kie:ksession>
</kie:kbase>
</kie:kmodule>
<bean id="kiePostProcessor"
class="org.kie.spring.KModuleBeanFactoryPostProcessor" />
<bean id="ruleService" class="com.poc.RuleService">
<property name="ksession" ref="ksession" />
</bean>
My Rule Service ->
ksession.fireAllRules();
log.debug("...finished running .");
My DRL File input ->
package validation_rules
rule "Test Rule"
when
then
System.out.println("Testing...");
end
I wanted to test with a sample rule without any conditions. However this
never gets executed. This DRL file is present under
src/main/resources/validation_rules. The KieSession gets injected properly
though.
Thanks and Regards,
Dwipin Chandran.
--
View this message in context: http://drools.46999.n3.nabble.com/DRL-file-not-getting-picked-tp4027476.html
Sent from the Drools: User forum mailing list archive at Nabble.com.
12 years, 2 months