Insert an object containing a HashMap
by hbunny
Hello,
I have searched the forum for information on this case, but I haven't find,
at least yet.
I am trying to insert an object containing a HashMap, but when I call
ksession.insert( fact ) method I get this error:
java.lang.ClassCastException: java.util.HashMap cannot be cast to
java.lang.Comparable
I have searched the net for this kind of error, but it's not clear why I'm
getting it, especially that I am inserting with success a global HashMap.
Can you help me please, it is rather urgent. Thank you in advance.
--
View this message in context: http://drools.46999.n3.nabble.com/Insert-an-object-containing-a-HashMap-t...
Sent from the Drools: User forum mailing list archive at Nabble.com.
15 years
help! the field *** is not visible
by 赵慧
hello,everyone!I wrote a rule with Drools,but the error told me that the field Server.Message is not visible, I can't find how it happens. Please help me, I am almost exhausted with it. thank you.
the rules are as follows:
package com.sample
import com.sample.Server;
rule "system will execute 'tc' command"
when
eval(Server.Message>8388608)
then
System.out.println("The network is so crowd that it needs repairing.");
Runtime.getRuntime().exec("tc");#execute the "tc" command
end
rule "caution"
when
eval(Server.Message==8388608)
then
System.out.println("caution!The network maybe will get blocked very soon.");
end
rule "fluent network"
when
eval(Server.Message<8388608)#conditions
then
System.out.println("the current network is very good");#actions
end
15 years
Getting a Drools Fusion - CEP Example to work
by s.Daniel
Hello
I have built my first few test rules and now I'm working on moving on to
more complex questions. Since I need to monitor data over time I would like
to lern from the example provided here:
http://javabeans.asia/articles/drools_5_case_study_2_complex_event_proces...
Unfortunately I can't get the tutorial to work properly. In eclipse I have
the error marker
----------------------
Description Resource Path Location Type
Error: java.lang.NullPointerException account.drl /SlidingWindowCEP/etc
Unknown Drools Error
----------------------
and upon build and get following error:
----------------------
[81,20]: [ERR 101] Line 81:20 no viable alternative at input '90d' in rule
"NinetyDaysPeriod"
java.lang.IllegalArgumentException: Could not parse knowledge.
at
net.javabeansdotasia.casestudy.test.Tester.prepareKnowledgeBase(Tester.java:85)
at net.javabeansdotasia.casestudy.test.Tester.setUp(Tester.java:54)
at net.javabeansdotasia.casestudy.test.Tester.main(Tester.java:118)
java.lang.NullPointerException
at
net.javabeansdotasia.casestudy.test.Tester.prepareAccountInfo(Tester.java:98)
at net.javabeansdotasia.casestudy.test.Tester.setUp(Tester.java:55)
at net.javabeansdotasia.casestudy.test.Tester.main(Tester.java:118)
Exception in thread "main" java.lang.NullPointerException
at
net.javabeansdotasia.casestudy.test.Tester.prepareStatefulKnowledgeSession(Tester.java:70)
at net.javabeansdotasia.casestudy.test.Tester.setUp(Tester.java:56)
at net.javabeansdotasia.casestudy.test.Tester.main(Tester.java:118)
----------------------
Now if I change 90d to 90m the Nullpointer Error goes away but then two new
markers appear at rule "NinetyDaysPeriod" and rule "FiveLastClaims":
----------------------
Description Resource Path Location Type
BuildError: Unable to build expression for 'consequence': [Error: Failed to
compile: 1 compilation error(s):
- (4,31) unable to resolve method using strict-mode:
java.lang.Object.setEligibleForBonusClaims(java.lang.Boolean)]
[Near : {... Unknown ....}]
^
[Line: 1, Column: 0] ' modify($accountInfo) {
setAveOfLastClaims($aveOfLastClaims);
setEligibleForBonusClaims(true);
};
' account.drl /SlidingWindowCEP/etc line 21 Drools Error
----------------------
Description Resource Path Location Type
BuildError: Unable to build expression for 'consequence': [Error: Failed to
compile: 1 compilation error(s):
- (4,33) unable to resolve method using strict-mode:
java.lang.Object.setEligibleForPeriodicBonus(java.lang.Boolean)]
[Near : {... Unknown ....}]
^
[Line: 1, Column: 0] ' modify($accountInfo) {
setAveForPeriod($aveForPeriod);
setEligibleForPeriodicBonus(true);
};
' account.drl /SlidingWindowCEP/etc line 65 Drools Error
----------------------
I'm using Drools 5.1 and JDK 1.6 the tutorial is based upon 5.0 and JDK 1.5
could that be the root of my problem? I'm stuck here and still in the
process of learning Java so any hint is appreciated.
--
View this message in context: http://drools.46999.n3.nabble.com/Getting-a-Drools-Fusion-CEP-Example-to-...
Sent from the Drools: User forum mailing list archive at Nabble.com.
15 years
Resolution to JBRULES-2837 possible?
by davesomebody
Hi,
I am hesitating on making a recommendation to use the jBPM 5.0 based on
Drools due to the bug https://issues.jboss.org/browse/JBRULES-2837
https://issues.jboss.org/browse/JBRULES-2837 JBRULES-2837 not being
resolved since November.
I have seen one workaround posted to the forums regarding creating a
stateful session per process invocation. I have a concern that this would
wreak havoc with persistence.
The other solution I have seen is to use a stateful session per thread. I
know that is not viable due to the fact that a thread may exit the session
due to use of an asynchronous domain specific language work item.
I see progress has been made on JBRULES-2837 though it has not been closed.
I have considered using a pool of stateful sessions as a stop-gap. Could be
viable? Would still be a pain persistence wise, but maybe doable?
Is there at least a plan in place for resolution? I want this to work.
Thanks!
--
View this message in context: http://drools.46999.n3.nabble.com/Resolution-to-JBRULES-2837-possible-tp2...
Sent from the Drools: User forum mailing list archive at Nabble.com.
15 years
Strange java.lang.NoClassDefFoundError
by Benson Fung
Hi,
I have a GWT RPC method as follows :
public String validate(ApplicationData ad) {
Object dataObj = null;
KnowledgeAgent kagent =
(KnowledgeAgent)getServletContext().getAttribute("KNOWLEDGE_AGENT");
KnowledgeBase kbase = kagent.getKnowledgeBase();
StatefulKnowledgeSession sf = kbase.newStatefulKnowledgeSession();
FactType ft = kbase.getFactType("axaPMTPOCPackage", "ApplicationData");
try {
dataObj = ft.newInstance();
ft.set(dataObj, "name", ad.getName());
ft.set(dataObj, "sex", ad.getSex());
ft.set(dataObj, "minIssrdAge", ad.getMinIssrdAge());
ft.set(dataObj, "age", ad.getAge());
ft.set(dataObj, "boxname", ad.getBoxname());
sf.insert(dataObj);
RuleNameStartsWithAgendaFilter filter = new
RuleNameStartsWithAgendaFilter(ad.getRuleName());
sf.fireAllRules(filter);
sf.dispose();
} catch(Exception e) {
e.printStackTrace();
}
String returnMsg = (String)ft.get(dataObj, "returnMsg");
return returnMsg;
}
At the client side, I made 2000 times of the above ajax call to
validate 2000 fields.
However, I got the following java exception after making certain
number of calls.
2011-04-11 15:45:17,438 ERROR
[org.apache.catalina.core.ContainerBase.[jboss.web].[localhost].[/axa_pmt_poc]]
(http-127.0.0.1-8080-8) Exception while dispatching incoming RPC call
com.google.gwt.user.server.rpc.UnexpectedException: Service method
'public abstract java.lang.String
com.axa.pmt.poc.client.ExecuteRuleService.validate(com.axa.pmt.poc.data.ApplicationData)'
threw an unexpected exception: java.lang.NoClassDefFoundError:
axaPMTPOCPackage/ApplicationData
at com.google.gwt.user.server.rpc.RPC.encodeResponseForFailure(RPC.java:378)
at com.google.gwt.user.server.rpc.RPC.invokeAndEncodeResponse(RPC.java:581)
at com.google.gwt.user.server.rpc.RemoteServiceServlet.processCall(RemoteServiceServlet.java:207)
at com.google.gwt.user.server.rpc.RemoteServiceServlet.processPost(RemoteServiceServlet.java:243)
at com.google.gwt.user.server.rpc.AbstractRemoteServiceServlet.doPost(AbstractRemoteServiceServlet.java:62)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:637)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:235)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:190)
at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:92)
at org.jboss.web.tomcat.security.SecurityContextEstablishmentValve.process(SecurityContextEstablishmentValve.java:126)
at org.jboss.web.tomcat.security.SecurityContextEstablishmentValve.invoke(SecurityContextEstablishmentValve.java:70)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:158)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:330)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:829)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:598)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
at java.lang.Thread.run(Thread.java:662)
Caused by: java.lang.NoClassDefFoundError: axaPMTPOCPackage/ApplicationData
at ASMAccessorImpl_19303314141302536715970.getValue(Unknown Source)
at org.mvel2.optimizers.dynamic.DynamicGetAccessor.getValue(DynamicGetAccessor.java:66)
at org.mvel2.ast.ASTNode.getReducedValueAccelerated(ASTNode.java:96)
at org.mvel2.MVELRuntime.execute(MVELRuntime.java:85)
at org.mvel2.compiler.CompiledExpression.getValue(CompiledExpression.java:104)
at org.mvel2.MVEL.executeExpression(MVEL.java:1001)
at org.drools.base.mvel.MVELConsequence.evaluate(MVELConsequence.java:103)
at org.drools.common.DefaultAgenda.fireActivation(DefaultAgenda.java:917)
at org.drools.common.DefaultAgenda.fireNextItem(DefaultAgenda.java:856)
at org.drools.common.DefaultAgenda.fireAllRules(DefaultAgenda.java:1071)
at org.drools.common.AbstractWorkingMemory.fireAllRules(AbstractWorkingMemory.java:785)
at org.drools.common.AbstractWorkingMemory.fireAllRules(AbstractWorkingMemory.java:761)
at org.drools.impl.StatefulKnowledgeSessionImpl.fireAllRules(StatefulKnowledgeSessionImpl.java:226)
at com.axa.pmt.poc.server.ExecuteRuleServiceImpl.validate(ExecuteRuleServiceImpl.java:51)
at sun.reflect.GeneratedMethodAccessor275.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at com.google.gwt.user.server.rpc.RPC.invokeAndEncodeResponse(RPC.java:562)
... 25 more
Please help give me ideas what is going on.
Thanks
Benson
15 years
real life implementations
by nch
Hello,
We're trying to implement a drools based app. As the number of rules increase
we're realising that the probability of having an infinite loop also increases,
and we find ourselves defining ever more complex control state.
How did you solve this sort of problem?
Kind regards.
15 years
Puzzling behavior for null pointer verification in LHS
by Hezi Stern
I am puzzled with the following behavior regarding null pointer validation.
I have the flowing rule:
rule "Test"
when
$ee: ExecutableEvent($taskId: taskid, Type.SOAR == type)
$tt: TaskTicket($id: id == $taskId)
then
logger.info("Rule:test !!!"+$tt.toString());
if($tt.getScheduledTime() != null)
logger.info("Rule:test schedule is not null");
end
what I get when I execute the system are the two printouts indicated in the
rule, hence the scheduleTime is not null.
Now I wish to move the null verification to the LHS by modifying the rule to
(modification is marked in yellow):
rule "Test"
when
$ee: ExecutableEvent($taskId: taskid, Type.SOAR == type)
$tt: TaskTicket($id: id == $taskId, scheduledTime != null)
then
logger.info("Rule:test !!!"+$tt.toString());
if($tt.getScheduledTime() != null)
logger.info("Rule:test schedule is not null");
end
at this point running the system results in no printouts, hence the rule is
not true.
Any suggestion why this occurs and how to resolve this?
The origin of all of this is to add null pointer verification on fields that
I wish to use us in the LHS (not shown in the above example)
Thanks
Hezi
15 years
difference between jBPM and drools?
by Stephan.Koops@We4IT.com
Hi,
I don't find much about the difference between jBPM and drools flow, only
that jBPM is the official one (
http://www.jboss.org/drools/drools-flow#Drools_Flow_and_jBPM, first
paragraph of the section) and rethinked. I'm interested for the practical
site.
Can anybody tell me about the advantages or disadvantages? What are the
main points to decide which one to use?
Maybe I missed a blog entry or something like that, but I don't find more.
A pointer or something else would be nice.
Thanks in advance.
Mit freundlichen Grüssen/Best regards
i. A.
Stephan Koops
Software Engineer
We4IT GmbH
***************************************************
Sie wollen aktuelle Informationen zu Lotus-Produkten? Dann besuchen Sie unseren Blog:
http://www.lotus-notes-domino-blog.de
***************************************************
We4IT GmbH
Technologiepark 11
33100 Paderborn
Tel: +49 5251 / 70993 - 24
Fax: +49 5251 / 70993 - 01
Mobil:
E-Mail: stephan.koops(a)we4it.com
Internet: http://www.we4it.com
HRB 20740, Amtsgericht Bremen
Geschäftsführer: Stefan Sucker, Vicente Diaz Fernandez
USt.-ID.-Nr. DE 220 859 831
Diese Nachricht ist vertraulich und ausschließlich für die adressierte Person und/oder Organisation bestimmt. Vertrauliche und/oder spezifische Informationen können hierin enthalten sein. Falls Sie ein nicht beabsichtigter Empfänger dieser Nachricht sind, sind das Kopieren, Verteilen und/oder das Aufnehmen aus dem Inhalt resultierender Handlungen untersagt. Haben Sie diese Nachricht fehlerhaft und/oder unvollständig erhalten, benachrichtigen Sie uns bitte umgehend unter unseren oben genannten Kontaktmöglichkeiten.
This message is confidential and intended solely for the person or organization to which it is addressed. It may contain privileged and confidential information. If you are not the intended recipient, you should not copy, distribute or take any action on reliance on it. If you have received this transmission in error, please notify us immediately by e-mail at the above address.
15 years
Can Drools Flow Persistence Work without JTA
by Rui Tang
Hi list,
According to the documents and some test cases, I found that Drools Flow
persistence examples have to work with JTA to enable transaction management.
Is there some way to not use JTA as my transaction manager?
--
唐睿
15 years
Hibernate session and 'from'
by Gareth Evans
Hello,
I am using Hibernate lazy loading in the facts I am inserting and am
noticing some odd behaviour when I use 'from'.
Here is a simplified example of my problem. In the first rule I just
want to populate the working memory with the Child objects, it uses
Hibernate lazy loading fine and inserts the facts, however in the
second rule I get an exception when accessing the GrandGrandChild
saying that the object does not have a session. If I add some debug
code to the first rule to access the GrandGrandChild I get the same
error.
This is using session-per-request and the Parent object was inserted
in the current session.
rule "get children - broken"
when
$parent : Parent( )
$child : Child( ) from $parent.children
then
insert($child);
end
rule "do stuff"
when
$child : Child( )
then
GrandChild grandChild = $child.getGrandChild();
# it blows up on the next line
GrandGrandChild grandGrandChild =
grandChild.getGrandGrandChild();
end
If I replace the first rule with the following everything works as
expected and I can match on Child objects and access whatever I wish,
so I know there should be a session available in the "do stuff" rule.
rule "get children - working"
when
$parent : Parent( )
then
for(Child child : $parent.getChildren()) {
insert(child);
}
end
I am able to use the "working" version in my code however the "broken"
version seems like the more correct way to do this in Drools. I'd like
to understand what is going on in case it is my fault or an issue I
need to be aware of. Could it be something to do with the from keyword
or the "cast" to Child( )? Is there some "magic" done in Drools which
could remove/invalidate the Hibernate proxy?
Thanks,
Gareth
15 years