Please check the java code and the process that I am uploading:
1- Java code:
package com.fp;
import javax.persistence.EntityManagerFactory;
import javax.persistence.Persistence;
import org.drools.KnowledgeBase;
import org.drools.KnowledgeBaseFactory;
import org.drools.builder.KnowledgeBuilder;
import org.drools.builder.KnowledgeBuilderError;
import org.drools.builder.KnowledgeBuilderErrors;
import org.drools.builder.KnowledgeBuilderFactory;
import org.drools.builder.ResourceType;
import org.drools.io.ResourceFactory;
import org.drools.logger.KnowledgeRuntimeLogger;
import org.drools.logger.KnowledgeRuntimeLoggerFactory;
import org.drools.persistence.jpa.JPAKnowledgeService;
import org.drools.process.instance.impl.demo.SystemOutWorkItemHandler;
import org.drools.process.workitem.wsht.WSHumanTaskHandler;
import org.drools.runtime.Environment;
import org.drools.runtime.EnvironmentName;
import org.drools.runtime.StatefulKnowledgeSession;
public class TestDrools
{
public static final void main(String[] args)
{
try
{
System.out.println("\n\n\n ======== i am here ");
KnowledgeBase kbase = readKnowledgeBase();
// create the entity manager factory and register it in the environment
EntityManagerFactory emf =
Persistence.createEntityManagerFactory( "org.drools.persistence.jpa"
);
Environment env = KnowledgeBaseFactory.newEnvironment();
env.set( EnvironmentName.ENTITY_MANAGER_FACTORY, emf );
// create a new knowledge session that uses JPA to store the runtime
state
StatefulKnowledgeSession ksession =
JPAKnowledgeService.newStatefulKnowledgeSession( kbase, null, env );
int sessionId = ksession.getId();
KnowledgeRuntimeLogger logger =
KnowledgeRuntimeLoggerFactory.newFileLogger(ksession, "test");
ksession.getWorkItemManager().registerWorkItemHandler("Human Task", new
WSHumanTaskHandler());
ksession.getWorkItemManager().registerWorkItemHandler("Log", new
SystemOutWorkItemHandler());
// start a new process instance
ksession.startProcess("testDroolsFlow");
ksession.dispose();
logger.close();
} catch (Throwable t)
{
t.printStackTrace();
}
}
private static KnowledgeBase readKnowledgeBase() throws Exception
{
KnowledgeBuilder kbuilder = KnowledgeBuilderFactory.newKnowledgeBuilder();
kbuilder.add(ResourceFactory.newClassPathResource("testDroolsFlow.rf"),
ResourceType.DRF);
KnowledgeBuilderErrors errors = kbuilder.getErrors();
if (errors.size() > 0)
{
for (KnowledgeBuilderError error: errors)
{
System.err.println(error);
}
throw new IllegalArgumentException("Could not parse knowledge.");
}
KnowledgeBase kbase = KnowledgeBaseFactory.newKnowledgeBase();
kbase.addKnowledgePackages(kbuilder.getKnowledgePackages());
return kbase;
}
}
2- The process that I am using is a user task followed by a log process:
<?xml version="1.0" encoding="UTF-8"?>
<process
xmlns="http://drools.org/drools-5.0/process"
xmlns:xs="http://www.w3.org/2001/XMLSchema-instance"
xs:schemaLocation="http://drools.org/drools-5.0/process
drools-processes-5.0.xsd"
type="RuleFlow" name="testDroolsFlow"
id="testDroolsFlow"
package-name="default" >
<header>
</header>
<nodes>
<start id="1" name="Start" x="16" y="181"
width="80" height="40" />
<end id="3" name="End" x="468" y="183"
width="80" height="40" />
<humanTask id="4" name="Task1" x="126"
y="180" width="100" height="48" >
<work name="Human Task" >
<parameter name="ActorId" >
<type
name="org.drools.process.core.datatype.impl.type.StringDataType" />
<value>admin</value>
</parameter>
<parameter name="Comment" >
<type
name="org.drools.process.core.datatype.impl.type.StringDataType" />
<value>Check the ToDo in order to view Log</value>
</parameter>
<parameter name="Content" >
<type
name="org.drools.process.core.datatype.impl.type.StringDataType" />
<value>Check the ToDo in order to view Log</value>
</parameter>
<parameter name="Priority" >
<type
name="org.drools.process.core.datatype.impl.type.StringDataType" />
<value>1</value>
</parameter>
<parameter name="Skippable" >
<type
name="org.drools.process.core.datatype.impl.type.StringDataType" />
<value>false</value>
</parameter>
<parameter name="TaskName" >
<type
name="org.drools.process.core.datatype.impl.type.StringDataType" />
<value>Perform TODO</value>
</parameter>
</work>
</humanTask>
<workItem id="5" name="Log" x="298" y="180"
width="100" height="48" >
<work name="Log" >
<parameter name="Message" >
<type
name="org.drools.process.core.datatype.impl.type.StringDataType" />
<value>Test</value>
</parameter>
</work>
</workItem>
</nodes>
<connections>
<connection from="5" to="3" />
<connection from="1" to="4" />
<connection from="4" to="5" />
</connections>
</process>
3- I created a jar from the java file above and uploaded it into Guvnor and
also uploaded the rule flow process .rf file into Guvnor.
4- I built the package and restart the JBOSS server
5- The following exception appears I hope that the information provided are
enough:
09:35:28,312 ERROR [STDERR] java.lang.IllegalArgumentException: Unknown
entity: org.drools.persistence.processinstance.ProcessInstanceInfo
09:35:28,312 ERROR [STDERR] at
org.hibernate.ejb.AbstractEntityManagerImpl.persist(AbstractEntityManagerImpl.java:215)
09:35:28,312 ERROR [STDERR] at
org.drools.persistence.processinstance.JPAProcessInstanceManager.addProcessInstance(JPAProcessInstanceManager.java:33)
09:35:28,312 ERROR [STDERR] at
org.drools.process.instance.AbstractProcessInstanceFactory.createProcessInstance(AbstractProcessInstanceFactory.java:37)
09:35:28,312 ERROR [STDERR] at
org.drools.common.AbstractWorkingMemory.startProcess(AbstractWorkingMemory.java:1706)
09:35:28,312 ERROR [STDERR] at
org.drools.common.AbstractWorkingMemory.startProcess(AbstractWorkingMemory.java:1682)
09:35:28,312 ERROR [STDERR] at
org.drools.impl.StatefulKnowledgeSessionImpl.startProcess(StatefulKnowledgeSessionImpl.java:289)
09:35:28,312 ERROR [STDERR] at
org.drools.command.runtime.process.StartProcessCommand.execute(StartProcessCommand.java:52)
09:35:28,312 ERROR [STDERR] at
org.drools.command.runtime.process.StartProcessCommand.execute(StartProcessCommand.java:14)
09:35:28,312 ERROR [STDERR] at
org.drools.persistence.session.SingleSessionCommandService.execute(SingleSessionCommandService.java:254)
09:35:28,312 ERROR [STDERR] at
org.drools.command.impl.CommandBasedStatefulKnowledgeSession.startProcess(CommandBasedStatefulKnowledgeSession.java:163)
09:35:28,312 ERROR [STDERR] at
org.drools.integration.console.DroolsFlowCommandDelegate.startProcess(DroolsFlowCommandDelegate.java:125)
09:35:28,312 ERROR [STDERR] at
org.drools.integration.console.DroolsFlowProcessManagement.newInstance(DroolsFlowProcessManagement.java:64)
09:35:28,312 ERROR [STDERR] at
org.drools.integration.console.DroolsFlowProcessManagement.newInstance(DroolsFlowProcessManagement.java:60)
09:35:28,312 ERROR [STDERR] at
org.jboss.bpm.console.server.ProcessMgmtFacade.newInstance(ProcessMgmtFacade.java:189)
09:35:28,312 ERROR [STDERR] at
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
09:35:28,312 ERROR [STDERR] at
sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
09:35:28,312 ERROR [STDERR] at
sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
09:35:28,312 ERROR [STDERR] at java.lang.reflect.Method.invoke(Unknown
Source)
09:35:28,312 ERROR [STDERR] at
org.jboss.resteasy.core.MethodInjectorImpl.invoke(MethodInjectorImpl.java:117)
09:35:28,312 ERROR [STDERR] at
org.jboss.resteasy.core.ResourceMethod.invokeOnTarget(ResourceMethod.java:260)
09:35:28,312 ERROR [STDERR] at
org.jboss.resteasy.core.ResourceMethod.invoke(ResourceMethod.java:232)
09:35:28,312 ERROR [STDERR] at
org.jboss.resteasy.core.ResourceMethod.invoke(ResourceMethod.java:166)
09:35:28,312 ERROR [STDERR] at
org.jboss.resteasy.core.DispatcherUtilities.getJaxrsResponse(DispatcherUtilities.java:142)
09:35:28,312 ERROR [STDERR] at
org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:356)
09:35:28,312 ERROR [STDERR] at
org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:173)
09:35:28,312 ERROR [STDERR] at
org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:93)
09:35:28,312 ERROR [STDERR] at
org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:68)
09:35:28,312 ERROR [STDERR] at
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
09:35:28,312 ERROR [STDERR] at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
09:35:28,312 ERROR [STDERR] at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
09:35:28,312 ERROR [STDERR] at
org.jboss.bpm.console.server.util.GWTJsonFilter.doFilter(GWTJsonFilter.java:59)
09:35:28,312 ERROR [STDERR] at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
09:35:28,312 ERROR [STDERR] at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
09:35:28,312 ERROR [STDERR] at
org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
09:35:28,312 ERROR [STDERR] at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
09:35:28,312 ERROR [STDERR] at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
09:35:28,312 ERROR [STDERR] at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230)
09:35:28,312 ERROR [STDERR] at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
09:35:28,312 ERROR [STDERR] at
org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:182)
09:35:28,312 ERROR [STDERR] at
org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:524)
09:35:28,312 ERROR [STDERR] at
org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:84)
09:35:28,312 ERROR [STDERR] at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
09:35:28,312 ERROR [STDERR] at
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
09:35:28,312 ERROR [STDERR] at
org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:157)
09:35:28,312 ERROR [STDERR] at
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
09:35:28,312 ERROR [STDERR] at
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:262)
09:35:28,312 ERROR [STDERR] at
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
09:35:28,312 ERROR [STDERR] at
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
09:35:28,312 ERROR [STDERR] at
org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:446)
09:35:28,312 ERROR [STDERR] at java.lang.Thread.run(Unknown Source)
09:35:28,312 ERROR [STDERR] Nov 16, 2009 9:35:28 AM
org.jboss.resteasy.core.SynchronousDispatcher handleWebApplicationException
SEVERE: failed to execute
javax.ws.rs.WebApplicationException: java.lang.RuntimeException: Could not
rollback transaction
at
org.jboss.bpm.console.server.ProcessMgmtFacade.newInstance(ProcessMgmtFacade.java:194)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at
org.jboss.resteasy.core.MethodInjectorImpl.invoke(MethodInjectorImpl.java:117)
at
org.jboss.resteasy.core.ResourceMethod.invokeOnTarget(ResourceMethod.java:260)
at
org.jboss.resteasy.core.ResourceMethod.invoke(ResourceMethod.java:232)
at
org.jboss.resteasy.core.ResourceMethod.invoke(ResourceMethod.java:166)
at
org.jboss.resteasy.core.DispatcherUtilities.getJaxrsResponse(DispatcherUtilities.java:142)
at
org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:356)
at
org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:173)
at
org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:93)
at
org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:68)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at
org.jboss.bpm.console.server.util.GWTJsonFilter.doFilter(GWTJsonFilter.java:59)
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
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:230)
at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
at
org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:182)
at
org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:524)
at
org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:84)
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:157)
at
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:262)
at
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
at
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
at
org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:446)
at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.RuntimeException: Could not rollback transaction
at
org.drools.persistence.session.SingleSessionCommandService.execute(SingleSessionCommandService.java:283)
at
org.drools.command.impl.CommandBasedStatefulKnowledgeSession.startProcess(CommandBasedStatefulKnowledgeSession.java:163)
at
org.drools.integration.console.DroolsFlowCommandDelegate.startProcess(DroolsFlowCommandDelegate.java:125)
at
org.drools.integration.console.DroolsFlowProcessManagement.newInstance(DroolsFlowProcessManagement.java:64)
at
org.drools.integration.console.DroolsFlowProcessManagement.newInstance(DroolsFlowProcessManagement.java:60)
at
org.jboss.bpm.console.server.ProcessMgmtFacade.newInstance(ProcessMgmtFacade.java:189)
... 36 more
Caused by: java.lang.RuntimeException: Could not execute command
at
org.drools.persistence.session.SingleSessionCommandService.execute(SingleSessionCommandService.java:280)
... 41 more
Caused by: java.lang.IllegalArgumentException: Unknown entity:
org.drools.persistence.processinstance.ProcessInstanceInfo
at
org.hibernate.ejb.AbstractEntityManagerImpl.persist(AbstractEntityManagerImpl.java:215)
at
org.drools.persistence.processinstance.JPAProcessInstanceManager.addProcessInstance(JPAProcessInstanceManager.java:33)
at
org.drools.process.instance.AbstractProcessInstanceFactory.createProcessInstance(AbstractProcessInstanceFactory.java:37)
at
org.drools.common.AbstractWorkingMemory.startProcess(AbstractWorkingMemory.java:1706)
at
org.drools.common.AbstractWorkingMemory.startProcess(AbstractWorkingMemory.java:1682)
at
org.drools.impl.StatefulKnowledgeSessionImpl.startProcess(StatefulKnowledgeSessionImpl.java:289)
at
org.drools.command.runtime.process.StartProcessCommand.execute(StartProcessCommand.java:52)
at
org.drools.command.runtime.process.StartProcessCommand.execute(StartProcessCommand.java:14)
at
org.drools.persistence.session.SingleSessionCommandService.execute(SingleSessionCommandService.java:254)
... 41 more
--
View this message in context:
http://old.nabble.com/Drools-flow-web-console-%285.1.M1%29-deployment-in-...
Sent from the drools - user mailing list archive at
Nabble.com.