[rules-users] Problem Setting globals in drools session
Swindells, Thomas
TSwindells at nds.com
Tue Jul 6 12:02:11 EDT 2010
Having the same JAR containing the same class in the classpath within the same classloader shouldn't make a difference.
However having different jars (or other sources) containing potentially different versions of the same class can cause significant problems. Furthermore drools doesn't necessarily use a single (or the default) class loader to load all resources - particularly when compiling rules, so it is quite probable that two different (sibling) class loaders are loading the class and so causing this issue.
Thomas
> -----Original Message-----
> From: rules-users-bounces at lists.jboss.org [mailto:rules-users-
> bounces at lists.jboss.org] On Behalf Of Greg Barton
> Sent: 06 July 2010 16:56
> To: Rules Users List
> Subject: Re: [rules-users] Problem Setting globals in drools session
>
> Having it twice in the classpath would make no diffence (at least with the
> default java classloader) as only the first one in the path is used. Having
> multiple copies of a class in the classpath is generally not a good idea
> because it leads to confusion, but it would not cause this behavior. (multiple
> classloaders would, though)
>
> GreG
>
> On Jul 6, 2010, at 2:33 AM, "PAYET, Manuel" <manuel.payet at capgemini.com>
> wrote:
>
> Looks like you have twice in your classpath the class
> ulb.mfe.srabre.ra.BREINTERFACE :)
> If I were you, I'd check that...
>
> -----Message d'origine-----
> De : rules-users-bounces at lists.jboss.org [mailto:rules-users-
> bounces at lists.jboss.org] De la part de djerir smail
> Envoyé : lundi 5 juillet 2010 21:39
> À : Rules Users List
> Objet : [rules-users] Problem Setting globals in drools session
>
> Hello everybody,
>
> When I try to sett my globals I get this error
>
> 2010-07-05 21:26:04,531 ERROR [STDERR] java.lang.RuntimeException:
> Illegal class for global. Expected [ulb.mfe.srabre.ra.BREINTERFACE], found
> [ulb.mfe.srabre.ra.BREINTERFACE].
>
> Can anyone explain to me what does this error mean please .
>
> MY DRL FILE
>
> package ulb.mfe.srabre.rule
>
> import ulb.mfe.srabre.ra.BREINTERFACE;
> import ulb.mfe.srabre.ra.DROOLSSLEEAgent;
>
> global ulb.mfe.srabre.ra.BREINTERFACE BRERAInterface; global
> ulb.mfe.srabre.ra.DROOLSSLEEAgent DROOLSSLEEAgent;
>
> rule "MaxBtsAlarmrule"
> dialect "mvel"
>
> when
>
> $B : BREINTERFACE()
> then
> System.out.println(" HELLO ");
> end
>
>
>
>
> my code
>
>
> public void Insert(Object fact) {
> try{
> KnowledgeSessionConfiguration sessConfig =
> KnowledgeBaseFactory.newKnowledgeSessionConfiguration();
> sessConfig.setOption(ClockTypeOption.get("pseudo"));
> StatefulKnowledgeSession session =
> knowledgeBase.newStatefulKnowledgeSession();
> session.setGlobal("BRERAInterface", this.breinter);
> session.setGlobal("DROOLSSLEEAgent", this.droolssleeAgent);
> session.insert(this.breinter);
> System.out.println("Fact is now inserted");
> session.fireAllRules();
> } catch (Throwable t) {
> logger.info("sml couldn't set up a session");
> t.printStackTrace();
> }
> }
> _______________________________________________
> rules-users mailing list
> rules-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>
>
>
>
>
>
> This message contains information that may be privileged or confidential and
> is the property of the Capgemini Group. It is
> intended only for the person to whom it is addressed. If you are not the
> intended recipient, you are not authorized to
> read, print, retain, copy, disseminate, distribute, or use this message or any
> part thereof. If you receive this message
> in error, please notify the sender immediately and delete all copies of this
> message.
>
>
> _______________________________________________
> rules-users mailing list
> rules-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>
>
>
>
>
> _______________________________________________
> rules-users mailing list
> rules-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
**************************************************************************************
This message is confidential and intended only for the addressee. If you have received this message in error, please immediately notify the postmaster at nds.com and delete it from your system as well as any copies. The content of e-mails as well as traffic data may be monitored by NDS for employment and security purposes. To protect the environment please do not print this e-mail unless necessary.
NDS Limited. Registered Office: One London Road, Staines, Middlesex, TW18 4EX, United Kingdom. A company registered in England and Wales. Registered no. 3080780. VAT no. GB 603 8808 40-00
**************************************************************************************
More information about the rules-users
mailing list