Once again, you should ask talend guys about how to configure the rule
environment to work with it.
It looks like you are using a model and the component in charge of
compiling the rules is not being able to locate the Sales class.
Cheers
On Wed, Dec 21, 2011 at 6:18 AM, Lavanya <aouklavanyareddy(a)gmail.com> wrote:
Hi All,
I am new user of Drools tool. I have done a sample business Rule in
Drools and tested. It is working fine in Drools. So I validated the package
and imported .drl file into talend studio under Meta data (Embedded Rules).
The code generated for the business rule is as follows:
package modelonsales
import salesmodel.Sales
import java.util.ArrayList
import java.util.HashMap
import java.lang.Integer
global ArrayList list
global HashMap globalMap
rule "SalesBR"
dialect "mvel"
when
exists Sales( sales >= "100" )
then
Sales fact0 = new Sales();
fact0.setName( "Discount" );
fact0.setSales( -10 );
insert(fact0 );
end
When I executing the job it is giving errors as follows:
*Starting job DroolsJob at 14:14 21/11/2011.
[statistics] connecting to socket on port 3678
[statistics] connected
[Error: unknown class or illegal statement: Sales]
[Near : {... es fact0 = new Sales();
fact0. ....}]
^
[Line: 1, Column: 13]
at
org.mvel2.compiler.AbstractParser.procTypedNode(AbstractParser.java:1278)
at org.mvel2.compiler.AbstractParser.nextToken(AbstractParser.java:712)
at
org.mvel2.compiler.ExpressionCompiler._compile(ExpressionCompiler.java:106)
at
org.mvel2.compiler.ExpressionCompiler.compile(ExpressionCompiler.java:55)
at
org.drools.rule.builder.dialect.mvel.MVELExprAnalyzer.analyzeExpression(MVELExprAnalyzer.java:86)
at
org.drools.rule.builder.dialect.mvel.MVELDialect.analyzeBlock(MVELDialect.java:492)
at
org.drools.rule.builder.dialect.mvel.MVELConsequenceBuilder.build(MVELConsequenceBuilder.java:84)
at org.drools.rule.builder.RuleBuilder.build(RuleBuilder.java:86)
at org.drools.compiler.PackageBuilder.addRule(PackageBuilder.java:1159)
at
org.drools.compiler.PackageBuilder.addPackage(PackageBuilder.java:649)
at
org.drools.compiler.PackageBuilder.addPackageFromDrl(PackageBuilder.java:290)
at
org.drools.compiler.PackageBuilder.addKnowledgeResource(PackageBuilder.java:488)
at
org.drools.builder.impl.KnowledgeBuilderImpl.add(KnowledgeBuilderImpl.java:25)
at
project1.droolsjob_0_1.DroolsJob$1KnowledgeBase_tRules_2.readKnowledgeBaseDRL(DroolsJob.java:595)
at
project1.droolsjob_0_1.DroolsJob$1KnowledgeBase_tRules_2.readKnowledgeBase(DroolsJob.java:584)
at
project1.droolsjob_0_1.DroolsJob.tFileInputExcel_2Process(DroolsJob.java:648)
at project1.droolsjob_0_1.DroolsJob.runJobInTOS(DroolsJob.java:1247)
at project1.droolsjob_0_1.DroolsJob.main(DroolsJob.java:1121)
Unable to resolve ObjectType 'Sales' : [Rule name='SalesBR']
Unable to build expression for 'consequence': unknown class or illegal
statement: Sales 'Sales fact0 = new Sales();
fact0.setName( "Discount" );
fact0.setSales( -10 );
insert(fact0 );
' : [Rule name='SalesBR']
Error importing : 'salesmodel.Sales'
Exception in component tRules_2
java.lang.IllegalArgumentException: Could not parse knowledge.
at
project1.droolsjob_0_1.DroolsJob$1KnowledgeBase_tRules_2.readKnowledgeBaseDRL(DroolsJob.java:604)
at
project1.droolsjob_0_1.DroolsJob$1KnowledgeBase_tRules_2.readKnowledgeBase(DroolsJob.java:584)
at
project1.droolsjob_0_1.DroolsJob.tFileInputExcel_2Process(DroolsJob.java:648)
at project1.droolsjob_0_1.DroolsJob.runJobInTOS(DroolsJob.java:1247)
at project1.droolsjob_0_1.DroolsJob.main(DroolsJob.java:1121)
[statistics] disconnected
Job DroolsJob ended at 14:14 21/11/2011. [exit code=1]
*
I have attached the screen shots as follows:
http://drools.46999.n3.nabble.com/file/n3603531/sales.jpg
http://drools.46999.n3.nabble.com/file/n3603531/sales_error.jpg
Please help me out on this issue.
Thanks and Regards,
Lavanya.
--
View this message in context:
http://drools.46999.n3.nabble.com/Regarding-implementation-of-bussiness-R...
Sent from the Drools: User forum mailing list archive at
Nabble.com.
_______________________________________________
rules-users mailing list
rules-users(a)lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users
--
- CTO @
http://www.plugtree.com
- MyJourney @
http://salaboy.wordpress.com
- Co-Founder @
http://www.jugargentina.org
- Co-Founder @
http://www.jbug.com.ar
- Salatino "Salaboy" Mauricio -