[rules-users] Groovy in drools flow

Todd Pagni todd.pagni at datacert.com
Thu Dec 31 12:15:58 EST 2009


Is there any way to get Drools flow to use the GroovyClassLoader to load
Groovy classes?  I am trying the following unsuccessfully. 

 

Setting the GroovyClassLoader

GroovyClassLoader gcl = new GroovyClassLoader();

gcl.addClasspath("c:\\temp\\");  //the
com.datacert.apps.sampleapplication.models.Person  Groovy class is in
c:\temp

KnowledgeBuilderConfiguration conf =
KnowledgeBuilderFactory.newKnowledgeBuilderConfiguration(null, gcl);

 

KnowledgeBuilder kbuilder =
KnowledgeBuilderFactory.newKnowledgeBuilder(conf);

 

 

Flow Definition

RuleFlowProcessFactory factory =
RuleFlowProcessFactory.createProcess(_processName);

int nodeCount = 1;

factory.name("Migration Approval
Flow").version("1.0").packageName("com.datacert").variable("entity",

                new
ObjectDataType("com.datacert.apps.sampleapplication.models.Person")).var
iable("entityId",

                new
ObjectDataType(String.class.getCanonicalName())).variable("currentApprov
erName",

                

                

Runtime error in JBoss           

10:55:17,982 ERROR [[WorkflowServer]] Servlet.service() for servlet
WorkflowServer threw exception

com.datacert.core.common.exception.BaseApplicationException:
org.drools.RuntimeDroolsException: Unable to resolve class
'com.datacert.apps.sampleapplication.models.Person' for identifier
'entity

                at
com.datacert.core.operations.service.impl.OperationService.invokeOperati
on(OperationService.java:57)

                at
com.datacert.core.presentation.presenter.impl.ScreenPresenter.performOpe
ration(ScreenPresenter.java:521)

                at
com.datacert.core.presentation.presenter.impl.ScreenPresenter.performOpe
ration(ScreenPresenter.java:483)

                at
com.datacert.core.presentation.controller.springmvc.impl.ItemScreenRende
rController.performOperation(ItemScreenRenderController.java:426)

                at
com.datacert.core.presentation.controller.springmvc.impl.ItemScreenRende
rController.performItemScreenOperation(ItemScreenRenderController.java:1
12)

                at
com.datacert.core.presentation.controller.springmvc.impl.ItemScreenRende
rController.performOperation(ItemScreenRenderController.java:205)

                at sun.reflect.NativeMethodAccessorImpl.invoke0(Native
Method)

                at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.jav
a:39)

 

 

Thanks,
Todd

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20091231/57680eec/attachment.html 


More information about the rules-users mailing list