<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Problems trying to get simple tRules implementation working in Talend Studio</title>
    <link>https://community.qlik.com/t5/Talend-Studio/Problems-trying-to-get-simple-tRules-implementation-working/m-p/2304864#M76590</link>
    <description>Hi 
&lt;BR /&gt;I am looking at what is involved in using the tRules component and I am getting run time errors. 
&lt;BR /&gt;I created the rule in Guvnor (not the one integrated into TAC) and added it to the meta data section of Talend under the Embeded Rules following the steps in the User Guide. The rule looks like this. 
&lt;BR /&gt; 
&lt;PRE&gt;package Account&lt;BR /&gt;import dave.test.Account&lt;BR /&gt;rule "loan_OK"&lt;BR /&gt;	dialect "mvel"&lt;BR /&gt;	when&lt;BR /&gt;		Account( age &amp;gt; "18" )&lt;BR /&gt;	then&lt;BR /&gt;		Account fact0 = new Account();&lt;BR /&gt;		fact0.setCurrent_Ballance( 1000 );&lt;BR /&gt;		insert(fact0 );&lt;BR /&gt;end&lt;/PRE&gt; 
&lt;BR /&gt;The error I get is 
&lt;BR /&gt; 
&lt;FONT color="#FF0000"&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt; ^&lt;BR /&gt;&lt;BR /&gt; at org.mvel2.compiler.AbstractParser.procTypedNode(AbstractParser.java:1278)&lt;BR /&gt; at org.mvel2.compiler.AbstractParser.nextToken(AbstractParser.java:712)&lt;BR /&gt; at org.mvel2.compiler.ExpressionCompiler._compile(ExpressionCompiler.java:106)&lt;BR /&gt; at org.mvel2.compiler.ExpressionCompiler.compile(ExpressionCompiler.java:55)&lt;BR /&gt; at org.drools.rule.builder.dialect.mvel.MVELExprAnalyzer.analyzeExpression(MVELExprAnalyzer.java:86)&lt;BR /&gt; at org.drools.rule.builder.dialect.mvel.MVELDialect.analyzeBlock(MVELDialect.java:492)&lt;BR /&gt; at org.drools.rule.builder.dialect.mvel.MVELConsequenceBuilder.build(MVELConsequenceBuilder.java:84)&lt;BR /&gt; at org.drools.rule.builder.RuleBuilder.build(RuleBuilder.java:86)&lt;BR /&gt; at org.drools.compiler.PackageBuilder.addRule(PackageBuilder.java:1159)&lt;BR /&gt; at org.drools.compiler.PackageBuilder.addPackage(PackageBuilder.java:649)&lt;BR /&gt; at org.drools.compiler.PackageBuilder.addPackageFromDrl(PackageBuilder.java:290)&lt;BR /&gt; at org.drools.compiler.PackageBuilder.addKnowledgeResource(PackageBuilder.java:488)&lt;BR /&gt; at org.drools.builder.impl.KnowledgeBuilderImpl.add(KnowledgeBuilderImpl.java:25)&lt;BR /&gt; at dev.rules_0_1.Rules$1KnowledgeBase_tRules_2.readKnowledgeBaseDRL(Rules.java:991)&lt;BR /&gt; at dev.rules_0_1.Rules$1KnowledgeBase_tRules_2.readKnowledgeBase(Rules.java:980)&lt;BR /&gt; at dev.rules_0_1.Rules.tRowGenerator_1Process(Rules.java:1044)&lt;BR /&gt; at dev.rules_0_1.Rules.runJobInTOS(Rules.java:3919)&lt;BR /&gt; at dev.rules_0_1.Rules.main(Rules.java:3726)&lt;BR /&gt;Unable to resolve ObjectType 'Account' : &lt;/FONT&gt; 
&lt;BR /&gt; 
&lt;FONT color="#FF0000"&gt;Unable to build expression for 'consequence': unknown class or illegal statement: Account 'Account fact0 = new Account();&lt;BR /&gt;fact0.setCurrent_Ballance( 1000 );&lt;BR /&gt;insert(fact0 );&lt;BR /&gt;' : &lt;/FONT&gt; 
&lt;BR /&gt; 
&lt;FONT color="#FF0000"&gt;Error importing : 'dave.test.Account'&lt;BR /&gt;Exception in component tRules_2&lt;BR /&gt;java.lang.IllegalArgumentException: Could not parse knowledge.&lt;BR /&gt; at dev.rules_0_1.Rules$1KnowledgeBase_tRules_2.readKnowledgeBaseDRL(Rules.java:1000)&lt;BR /&gt; at dev.rules_0_1.Rules$1KnowledgeBase_tRules_2.readKnowledgeBase(Rules.java:980)&lt;BR /&gt; at dev.rules_0_1.Rules.tRowGenerator_1Process(Rules.java:1044)&lt;BR /&gt; at dev.rules_0_1.Rules.runJobInTOS(Rules.java:3919)&lt;BR /&gt; at dev.rules_0_1.Rules.main(Rules.java:3726)&lt;BR /&gt;&lt;/FONT&gt; 
&lt;BR /&gt;I simplified the rule by hand in Talend to 
&lt;BR /&gt; 
&lt;PRE&gt;package Account&lt;BR /&gt;import dave.test.Account&lt;BR /&gt;rule "loan_OK"&lt;BR /&gt;	dialect "mvel"&lt;BR /&gt;	when&lt;BR /&gt;		Account( age &amp;gt; "18" )&lt;BR /&gt;	then&lt;BR /&gt;		System.out.println("Customer is full age");&lt;BR /&gt;end&lt;/PRE&gt; 
&lt;BR /&gt;I then get the error 
&lt;BR /&gt; 
&lt;BR /&gt; 
&lt;FONT color="#FF0000"&gt;Unable to resolve ObjectType 'Account' : &lt;/FONT&gt; 
&lt;BR /&gt; 
&lt;FONT color="#FF0000"&gt;Error importing : 'dave.test.Account'&lt;BR /&gt;Exception in component tRules_2&lt;BR /&gt;java.lang.IllegalArgumentException: Could not parse knowledge.&lt;BR /&gt; at dev.rules_0_1.Rules$1KnowledgeBase_tRules_2.readKnowledgeBaseDRL(Rules.java:1000)&lt;BR /&gt; at dev.rules_0_1.Rules$1KnowledgeBase_tRules_2.readKnowledgeBase(Rules.java:980)&lt;BR /&gt; at dev.rules_0_1.Rules.tRowGenerator_1Process(Rules.java:1044)&lt;BR /&gt; at dev.rules_0_1.Rules.runJobInTOS(Rules.java:3919)&lt;BR /&gt; at dev.rules_0_1.Rules.main(Rules.java:3726)&lt;BR /&gt;&lt;/FONT&gt; 
&lt;BR /&gt;It looks like it can not find the imported class Account, Have I missed somthing when setting up the rule? 
&lt;BR /&gt;Many thanks in advance Dave</description>
    <pubDate>Sat, 16 Nov 2024 12:45:06 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2024-11-16T12:45:06Z</dc:date>
    <item>
      <title>Problems trying to get simple tRules implementation working</title>
      <link>https://community.qlik.com/t5/Talend-Studio/Problems-trying-to-get-simple-tRules-implementation-working/m-p/2304864#M76590</link>
      <description>Hi 
&lt;BR /&gt;I am looking at what is involved in using the tRules component and I am getting run time errors. 
&lt;BR /&gt;I created the rule in Guvnor (not the one integrated into TAC) and added it to the meta data section of Talend under the Embeded Rules following the steps in the User Guide. The rule looks like this. 
&lt;BR /&gt; 
&lt;PRE&gt;package Account&lt;BR /&gt;import dave.test.Account&lt;BR /&gt;rule "loan_OK"&lt;BR /&gt;	dialect "mvel"&lt;BR /&gt;	when&lt;BR /&gt;		Account( age &amp;gt; "18" )&lt;BR /&gt;	then&lt;BR /&gt;		Account fact0 = new Account();&lt;BR /&gt;		fact0.setCurrent_Ballance( 1000 );&lt;BR /&gt;		insert(fact0 );&lt;BR /&gt;end&lt;/PRE&gt; 
&lt;BR /&gt;The error I get is 
&lt;BR /&gt; 
&lt;FONT color="#FF0000"&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt; ^&lt;BR /&gt;&lt;BR /&gt; at org.mvel2.compiler.AbstractParser.procTypedNode(AbstractParser.java:1278)&lt;BR /&gt; at org.mvel2.compiler.AbstractParser.nextToken(AbstractParser.java:712)&lt;BR /&gt; at org.mvel2.compiler.ExpressionCompiler._compile(ExpressionCompiler.java:106)&lt;BR /&gt; at org.mvel2.compiler.ExpressionCompiler.compile(ExpressionCompiler.java:55)&lt;BR /&gt; at org.drools.rule.builder.dialect.mvel.MVELExprAnalyzer.analyzeExpression(MVELExprAnalyzer.java:86)&lt;BR /&gt; at org.drools.rule.builder.dialect.mvel.MVELDialect.analyzeBlock(MVELDialect.java:492)&lt;BR /&gt; at org.drools.rule.builder.dialect.mvel.MVELConsequenceBuilder.build(MVELConsequenceBuilder.java:84)&lt;BR /&gt; at org.drools.rule.builder.RuleBuilder.build(RuleBuilder.java:86)&lt;BR /&gt; at org.drools.compiler.PackageBuilder.addRule(PackageBuilder.java:1159)&lt;BR /&gt; at org.drools.compiler.PackageBuilder.addPackage(PackageBuilder.java:649)&lt;BR /&gt; at org.drools.compiler.PackageBuilder.addPackageFromDrl(PackageBuilder.java:290)&lt;BR /&gt; at org.drools.compiler.PackageBuilder.addKnowledgeResource(PackageBuilder.java:488)&lt;BR /&gt; at org.drools.builder.impl.KnowledgeBuilderImpl.add(KnowledgeBuilderImpl.java:25)&lt;BR /&gt; at dev.rules_0_1.Rules$1KnowledgeBase_tRules_2.readKnowledgeBaseDRL(Rules.java:991)&lt;BR /&gt; at dev.rules_0_1.Rules$1KnowledgeBase_tRules_2.readKnowledgeBase(Rules.java:980)&lt;BR /&gt; at dev.rules_0_1.Rules.tRowGenerator_1Process(Rules.java:1044)&lt;BR /&gt; at dev.rules_0_1.Rules.runJobInTOS(Rules.java:3919)&lt;BR /&gt; at dev.rules_0_1.Rules.main(Rules.java:3726)&lt;BR /&gt;Unable to resolve ObjectType 'Account' : &lt;/FONT&gt; 
&lt;BR /&gt; 
&lt;FONT color="#FF0000"&gt;Unable to build expression for 'consequence': unknown class or illegal statement: Account 'Account fact0 = new Account();&lt;BR /&gt;fact0.setCurrent_Ballance( 1000 );&lt;BR /&gt;insert(fact0 );&lt;BR /&gt;' : &lt;/FONT&gt; 
&lt;BR /&gt; 
&lt;FONT color="#FF0000"&gt;Error importing : 'dave.test.Account'&lt;BR /&gt;Exception in component tRules_2&lt;BR /&gt;java.lang.IllegalArgumentException: Could not parse knowledge.&lt;BR /&gt; at dev.rules_0_1.Rules$1KnowledgeBase_tRules_2.readKnowledgeBaseDRL(Rules.java:1000)&lt;BR /&gt; at dev.rules_0_1.Rules$1KnowledgeBase_tRules_2.readKnowledgeBase(Rules.java:980)&lt;BR /&gt; at dev.rules_0_1.Rules.tRowGenerator_1Process(Rules.java:1044)&lt;BR /&gt; at dev.rules_0_1.Rules.runJobInTOS(Rules.java:3919)&lt;BR /&gt; at dev.rules_0_1.Rules.main(Rules.java:3726)&lt;BR /&gt;&lt;/FONT&gt; 
&lt;BR /&gt;I simplified the rule by hand in Talend to 
&lt;BR /&gt; 
&lt;PRE&gt;package Account&lt;BR /&gt;import dave.test.Account&lt;BR /&gt;rule "loan_OK"&lt;BR /&gt;	dialect "mvel"&lt;BR /&gt;	when&lt;BR /&gt;		Account( age &amp;gt; "18" )&lt;BR /&gt;	then&lt;BR /&gt;		System.out.println("Customer is full age");&lt;BR /&gt;end&lt;/PRE&gt; 
&lt;BR /&gt;I then get the error 
&lt;BR /&gt; 
&lt;BR /&gt; 
&lt;FONT color="#FF0000"&gt;Unable to resolve ObjectType 'Account' : &lt;/FONT&gt; 
&lt;BR /&gt; 
&lt;FONT color="#FF0000"&gt;Error importing : 'dave.test.Account'&lt;BR /&gt;Exception in component tRules_2&lt;BR /&gt;java.lang.IllegalArgumentException: Could not parse knowledge.&lt;BR /&gt; at dev.rules_0_1.Rules$1KnowledgeBase_tRules_2.readKnowledgeBaseDRL(Rules.java:1000)&lt;BR /&gt; at dev.rules_0_1.Rules$1KnowledgeBase_tRules_2.readKnowledgeBase(Rules.java:980)&lt;BR /&gt; at dev.rules_0_1.Rules.tRowGenerator_1Process(Rules.java:1044)&lt;BR /&gt; at dev.rules_0_1.Rules.runJobInTOS(Rules.java:3919)&lt;BR /&gt; at dev.rules_0_1.Rules.main(Rules.java:3726)&lt;BR /&gt;&lt;/FONT&gt; 
&lt;BR /&gt;It looks like it can not find the imported class Account, Have I missed somthing when setting up the rule? 
&lt;BR /&gt;Many thanks in advance Dave</description>
      <pubDate>Sat, 16 Nov 2024 12:45:06 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/Problems-trying-to-get-simple-tRules-implementation-working/m-p/2304864#M76590</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2024-11-16T12:45:06Z</dc:date>
    </item>
    <item>
      <title>Re: Problems trying to get simple tRules implementation working</title>
      <link>https://community.qlik.com/t5/Talend-Studio/Problems-trying-to-get-simple-tRules-implementation-working/m-p/2304865#M76591</link>
      <description>Hi
&lt;BR /&gt;I added a tLibraryLoad component to load the jar with the class in it and it stopped the error "importing dave.test.Account" error. But I now get the following error.
&lt;BR /&gt;
&lt;FONT color="#FF0000"&gt;&lt;BR /&gt;Exception in component tRules_1&lt;BR /&gt;java.lang.RuntimeException: Unexpected global 
 &lt;UL&gt;
   at org.drools.common.AbstractWorkingMemory.setGlobal(AbstractWorkingMemory.java:550)
  &lt;BR /&gt; at org.drools.impl.StatefulKnowledgeSessionImpl.setGlobal(StatefulKnowledgeSessionImpl.java:284)
  &lt;BR /&gt; at drools.trule_0_1.tRule.tRowGenerator_1Process(tRule.java:917)
  &lt;BR /&gt; at drools.trule_0_1.tRule.tLibraryLoad_1Process(tRule.java:316)
  &lt;BR /&gt; at drools.trule_0_1.tRule.runJobInTOS(tRule.java:1221)
  &lt;BR /&gt; at drools.trule_0_1.tRule.main(tRule.java:1095)
  &lt;BR /&gt;
 &lt;/UL&gt;&lt;/FONT&gt;
&lt;BR /&gt;Any ideas where to look next?
&lt;BR /&gt;Many thanks Dave</description>
      <pubDate>Tue, 09 Aug 2011 21:00:58 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/Problems-trying-to-get-simple-tRules-implementation-working/m-p/2304865#M76591</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2011-08-09T21:00:58Z</dc:date>
    </item>
  </channel>
</rss>

