[jBPM] - Drools XML error when passing process variables to work item
by David Harris
David Harris [https://community.jboss.org/people/dmwpepper] created the discussion
"Drools XML error when passing process variables to work item"
To view the discussion, visit: https://community.jboss.org/message/811284#811284
--------------------------------------------------------------
I've been reading through "Section 7.2.3, Using your new work item in your processes" to see how to pass process variables to a work item. Even though the values of each process variable are getting passed each work item, I'm getting the following XML error in the Eclipse console:
| 1 | 02/05 11:43:16,406[main] ERROR drools.xml.ExtensibleXmlParser.error - (null: 40, 62): cvc-id.2: There are multiple occurrences of ID value '_4_Source_IPInput'. |
| 4 | 02/05 11:43:16,409[main] ERROR drools.xml.ExtensibleXmlParser.error - (null: 40, 62): cvc-attribute.3: The value '_4_Source_IPInput' of attribute 'id' on element 'dataInput' is not valid with respect to its type, 'ID'. |
| 5 | 02/05 11:43:16,410[main] ERROR drools.xml.ExtensibleXmlParser.error - (null: 41, 64): cvc-id.2: There are multiple occurrences of ID value '_4_Start_DateInput'. |
| 5 | 02/05 11:43:16,410[main] ERROR drools.xml.ExtensibleXmlParser.error - (null: 41, 64): cvc-attribute.3: The value '_4_Start_DateInput' of attribute 'id' on element 'dataInput' is not valid with respect to its type, 'ID'. |
| 6 | 02/05 11:43:16,411[main] ERROR drools.xml.ExtensibleXmlParser.error - (null: 42, 60): cvc-id.2: There are multiple occurrences of ID value '_4_End_DateInput'. |
| 6 | 02/05 11:43:16,411[main] ERROR drools.xml.ExtensibleXmlParser.error - (null: 42, 60): cvc-attribute.3: The value '_4_End_DateInput' of attribute 'id' on element 'dataInput' is not valid with respect to its type, 'ID'. |
*parameters passed into work item: 111.111.111.111, 2013 05 02 09:00:00, 2013 04 02 09:00:00*
Note the last line in red shows the values are being passed. Does anyone see anything in the folllowing that would cause the Drools XML error?
**********
public class ProcessMain {
public static final void main(String[] args) throws Exception {
// load up the knowledge base
KnowledgeBase kbase = readKnowledgeBase();
StatefulKnowledgeSession ksession = kbase.newStatefulKnowledgeSession();
// start a new process instance
Map<String,Object> params = new HashMap<String,Object>();
params.put("processIP", "111.111.111.111");
params.put("processStartDate", "2013 05 02 09:00:00");
params.put("processEndDate", "2013 04 02 09:00:00");
ksession.getWorkItemManager().registerWorkItemHandler("IP Conversations", new IPConversationsWorkItemHandler());
ksession.startProcess("com.sample.bpmn.hello",params);
}
private static KnowledgeBase readKnowledgeBase() throws Exception {
KnowledgeBuilder kbuilder = KnowledgeBuilderFactory.newKnowledgeBuilder();
kbuilder.add(ResourceFactory.newClassPathResource("sample.bpmn"), ResourceType.BPMN2);
return kbuilder.newKnowledgeBase();
}
}
***********
The Work Item Handler is:
**********
package com.sample;
import org.drools.runtime.process.WorkItem;
import org.drools.runtime.process.WorkItemHandler;
import org.drools.runtime.process.WorkItemManager;
import java.sql.*;
import java.util.*;
public class IPConversationsWorkItemHandler implements WorkItemHandler {
public void executeWorkItem (WorkItem workItem, WorkItemManager manager) {
// extract parameters
String sourceIP = (String) workItem.getParameter("Source_IP");
String startDate = (String) workItem.getParameter("Start_Date");
String endDate = (String) workItem.getParameter("End_Date");
System.out.println("parameters passed into work item: " + sourceIP + "," + startDate + "," + endDate);
// notify manager that work item has been completed
manager.completeWorkItem(workItem.getId(),null);
}
public void abortWorkItem (WorkItem workItem, WorkItemManager manager) {
// do nothing, not planning to abort operation at this time
}
}
*********
*********
The work item definition file has the following entry:
import org.drools.process.core.datatype.impl.type.StringDataType;
[
[
"name" : "IP Conversations",
"parameters" : [
"Source_IP" : new StringDataType(),
"Start_Date" : new StringDataType(),
"End_Date" : new StringDataType()
],
"results" : [
"Source_IPs" : new StringDataType(),
"Source_Ports" : new StringDataType(),
"Dest_IPs" : new StringDataType(),
"Dest_Ports" : new StringDataType(),
"Recv_Time" : new StringDataType()
],
"displayName" : "IP Conversations"
],
]
********
--------------------------------------------------------------
Reply to this message by going to Community
[https://community.jboss.org/message/811284#811284]
Start a new discussion in jBPM at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&con...]
12 years, 6 months
[jBPM] - executor-service
by rachi
rachi [https://community.jboss.org/people/rachi] created the discussion
"executor-service"
To view the discussion, visit: https://community.jboss.org/message/811171#811171
--------------------------------------------------------------
bjr, je suis debutante dans la modelisation des processus avec bpm,je suis le tuto jbpm5-developper-guide,
je suis bloqué au nivo du chapitre 6 à l'execution du module jbpm-executor-service,j'ai les erreurs suivantes:
Starting Executor Service ...
SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/G:/maven_repos/org/jboss/weld/se/weld-se/2.0.0.CR2/weld-se-2.0.0.CR2.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/G:/maven_repos/org/jboss/weld/servlet/weld-servlet/2.0.0.Beta4/weld-servlet-2.0.0.Beta4.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
SLF4J: Actual binding is of type [org.slf4j.impl.SimpleLoggerFactory]
[main] INFO org.jboss.weld.Version - WELD-000900 2.0.0 (CR2)
[main] INFO org.jboss.weld.Bootstrap - WELD-000101 Transactional services not available. Injection of @Inject UserTransaction not available. Transactional observers will be invoked synchronously.
[main] WARN org.jboss.weld.Bootstrap - Legacy deployment metadata provided by the integrator. Certain functionality will not be available.
avr. 30, 2013 2:55:23 PM org.jboss.solder.logging.Logger info
INFO: Solder Config XML provider starting...
avr. 30, 2013 2:55:23 PM org.jboss.solder.logging.Logger info
INFO: Loading XmlDocumentProvider: org.jboss.solder.config.xml.bootstrap.ResourceLoaderXmlDocumentProvider
avr. 30, 2013 2:55:23 PM org.jboss.solder.logging.Logger info
INFO: Reading XML file: jar:file:/G:/maven_repos/org/jboss/seam/persistence/seam-persistence/3.1.0.Final/seam-persistence-3.1.0.Final.jar!/META-INF/beans.xml
avr. 30, 2013 2:55:23 PM org.jboss.solder.logging.Logger info
INFO: Reading XML file: jar:file:/G:/maven_repos/org/jboss/seam/transaction/seam-transaction/3.1.0.Final/seam-transaction-3.1.0.Final.jar!/META-INF/beans.xml
avr. 30, 2013 2:55:24 PM org.jboss.solder.logging.Logger info
INFO: Solder 3.2.0.Final (build id: 3.2.0.Final)
[weld-worker-1] INFO org.jboss.weld.ClassLoading - WELD-000119 Not generating any bean definitions from org.jboss.seam.persistence.util.EJBContextUtils because of underlying class loading error: Type javax.ejb.EJBContext not found. If this is unexpected, enable DEBUG logging to see the full error.
[weld-worker-3] INFO org.jboss.weld.ClassLoading - WELD-000119 Not generating any bean definitions from org.jboss.seam.transaction.CMTTransaction because of underlying class loading error: Type javax.ejb.EJBContext not found. If this is unexpected, enable DEBUG logging to see the full error.
[weld-worker-1] INFO org.jboss.weld.ClassLoading - WELD-000119 Not generating any bean definitions from org.jboss.seam.transaction.DefaultSeamTransaction because of underlying class loading error: Type javax.ejb.EJBContext not found. If this is unexpected, enable DEBUG logging to see the full error.
avr. 30, 2013 2:55:24 PM org.jboss.solder.logging.Logger info
INFO: Preventing class org.jboss.seam.persistence.hibernate.HibernateManagedSessionExtensionImpl from being installed as bean due to @Veto annotation
avr. 30, 2013 2:55:24 PM org.jboss.solder.logging.Logger info
INFO: Preventing class org.jboss.seam.transaction.EntityTransaction from being installed as bean due to @Veto annotation
avr. 30, 2013 2:55:24 PM org.jboss.solder.logging.Logger info
INFO: Preventing class org.jboss.seam.persistence.HibernatePersistenceProvider from being installed as bean due to @Veto annotation
avr. 30, 2013 2:55:24 PM org.jboss.solder.logging.Logger info
INFO: Preventing class org.jboss.seam.transaction.HibernateTransaction from being installed as bean due to @Veto annotation
avr. 30, 2013 2:55:24 PM org.jboss.solder.logging.Logger info
INFO: Preventing class org.jboss.seam.transaction.UTTransaction from being installed as bean due to @Veto annotation
avr. 30, 2013 2:55:24 PM org.jboss.solder.logging.Logger info
INFO: Preventing class org.jboss.seam.transaction.SeSynchronizations from being installed as bean due to @Veto annotation
avr. 30, 2013 2:55:24 PM org.jboss.solder.logging.Logger info
INFO: Preventing class org.jboss.seam.transaction.NoTransaction from being installed as bean due to @Veto annotation
[weld-worker-1] WARN org.jboss.weld.interceptor.util.InterceptionTypeRegistry - Class 'javax.ejb.PostActivate' not found, interception based on it is not enabled
[weld-worker-1] WARN org.jboss.weld.interceptor.util.InterceptionTypeRegistry - Class 'javax.ejb.PrePassivate' not found, interception based on it is not enabled
avr. 30, 2013 2:55:25 PM org.jboss.solder.exception.control.extension.CatchExtension registerHandlerMethod
INFO: Adding handler Qualifiers: [@javax.enterprise.inject.Any()] TraversalMode: BREADTH_FIRST Handles Type: class java.lang.Throwable Precedence: -100 [BackedAnnotatedMethod] public org.jboss.seam.transaction.SimpleTransactionExceptionHandler.markTransactionRollback(@Handles CaughtException<Throwable>) to known handlers
Exception in thread "main" org.jboss.weld.exceptions.DefinitionException: Exception List with 1 exceptions:
Exception 0 :
org.jboss.weld.exceptions.IllegalStateException: WELD-001332 BeanManager method getBeans() is not available during application initialization
at org.jboss.weld.bean.builtin.BeanManagerProxy.checkContainerValidated(BeanManagerProxy.java:142)
at org.jboss.weld.bean.builtin.BeanManagerProxy.getBeans(BeanManagerProxy.java:80)
at org.jboss.solder.core.CoreExtension.failIfWeldExtensionsDetected(CoreExtension.java:215)
at org.jboss.solder.core.CoreExtension.afterBeanDiscovery(CoreExtension.java:208)
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.weld.injection.MethodInjectionPoint.invokeOnInstanceWithSpecialValue(MethodInjectionPoint.java:93)
at org.jboss.weld.event.ObserverMethodImpl.sendEvent(ObserverMethodImpl.java:274)
at org.jboss.weld.event.ExtensionObserverMethodImpl.sendEvent(ExtensionObserverMethodImpl.java:121)
at org.jboss.weld.event.ObserverMethodImpl.sendEvent(ObserverMethodImpl.java:261)
at org.jboss.weld.event.ObserverMethodImpl.notify(ObserverMethodImpl.java:240)
at org.jboss.weld.event.ObserverNotifier.notifyObserver(ObserverNotifier.java:170)
at org.jboss.weld.event.ObserverNotifier.notifyObservers(ObserverNotifier.java:129)
at org.jboss.weld.event.ObserverNotifier.fireEvent(ObserverNotifier.java:103)
at org.jboss.weld.bootstrap.events.AbstractContainerEvent.fire(AbstractContainerEvent.java:63)
at org.jboss.weld.bootstrap.events.AbstractDefinitionContainerEvent.fire(AbstractDefinitionContainerEvent.java:35)
at org.jboss.weld.bootstrap.events.AfterBeanDiscoveryImpl.fire(AfterBeanDiscoveryImpl.java:53)
at org.jboss.weld.bootstrap.WeldBootstrap.deployBeans(WeldBootstrap.java:515)
at org.jboss.weld.bootstrap.api.helpers.ForwardingBootstrap.deployBeans(ForwardingBootstrap.java:63)
at org.jboss.weld.environment.se.Weld.initialize(Weld.java:137)
at org.jbpm.executor.ExecutorModule.<init>(ExecutorModule.java:31)
at org.jbpm.executor.ExecutorModule.getInstance(ExecutorModule.java:24)
at org.jbpm.executor.ExecutorMain.main(ExecutorMain.java:15)
at org.jboss.weld.bootstrap.events.AbstractDefinitionContainerEvent.fire(AbstractDefinitionContainerEvent.java:37)
at org.jboss.weld.bootstrap.events.AfterBeanDiscoveryImpl.fire(AfterBeanDiscoveryImpl.java:53)
at org.jboss.weld.bootstrap.WeldBootstrap.deployBeans(WeldBootstrap.java:515)
at org.jboss.weld.bootstrap.api.helpers.ForwardingBootstrap.deployBeans(ForwardingBootstrap.java:63)
at org.jboss.weld.environment.se.Weld.initialize(Weld.java:137)
at org.jbpm.executor.ExecutorModule.<init>(ExecutorModule.java:31)
at org.jbpm.executor.ExecutorModule.getInstance(ExecutorModule.java:24)
at org.jbpm.executor.ExecutorMain.main(ExecutorMain.java:15)
j'ai joins mon fichier pom.xml,svp si quelqu'un peut m'aider ca me permettra d'avancer.
merci
--------------------------------------------------------------
Reply to this message by going to Community
[https://community.jboss.org/message/811171#811171]
Start a new discussion in jBPM at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&con...]
12 years, 6 months
[jBPM] - Re: Session and thread safety
by Sebastian Calbaza
Sebastian Calbaza [https://community.jboss.org/people/calbazasebastian] created the discussion
"Re: Session and thread safety"
To view the discussion, visit: https://community.jboss.org/message/760010#760010
--------------------------------------------------------------
Here is my thread safe ProcessPersistenceContextManager if someone needs it.
It needs to be set on the Environment param (env.set(EnvironmentName.PERSISTENCE_CONTEXT_MANAGER, persistenceContextManager);) before you pass it to JPAKnowledgeService.newStatefulKnowledgeSession(kbase,null, env)
-----------------------------------------
public class MyJpaProcessPersistenceContextManager implements
ProcessPersistenceContextManager, PersistenceContextManager {
private EntityManagerFactory emf;
private ThreadLocal<EntityManager> appScopedEntityManager=new ThreadLocal<EntityManager>();
protected ThreadLocal<EntityManager> cmdScopedEntityManager=new ThreadLocal<EntityManager>();
public ProcessPersistenceContext getProcessPersistenceContext() {
return new JpaProcessPersistenceContext(cmdScopedEntityManager.get());
}
public MyJpaProcessPersistenceContextManager(Environment env) {
this.emf = (EntityManagerFactory) env.get(EnvironmentName.ENTITY_MANAGER_FACTORY);
}
public PersistenceContext getApplicationScopedPersistenceContext() {
if (this.appScopedEntityManager.get() == null) {
this.appScopedEntityManager.set(this.emf.createEntityManager());
}
return new JpaPersistenceContext(appScopedEntityManager.get());
}
public PersistenceContext getCommandScopedPersistenceContext() {
return new JpaPersistenceContext(this.cmdScopedEntityManager.get());
}
public void beginCommandScopedEntityManager() {
if (cmdScopedEntityManager.get() == null ||
(this.cmdScopedEntityManager.get() != null && !this.cmdScopedEntityManager.get().isOpen())) {
this.cmdScopedEntityManager.set( this.emf.createEntityManager());
}
cmdScopedEntityManager.get().joinTransaction();
appScopedEntityManager.get().joinTransaction();
}
public void endCommandScopedEntityManager() {
if (this.cmdScopedEntityManager.get()!=null){
this.cmdScopedEntityManager.get().flush();
this.cmdScopedEntityManager.get().close();
}
}
public ThreadLocal<EntityManager> getCmdScopedEntityManager() {
return cmdScopedEntityManager;
}
public ThreadLocal<EntityManager> getAppScopedEntityManager() {
return appScopedEntityManager;
}
public void dispose() {
if (this.appScopedEntityManager.get() != null && this.appScopedEntityManager.get().isOpen()) {
this.appScopedEntityManager.get().flush();
this.appScopedEntityManager.get().close();
}
this.appScopedEntityManager.set(null);
if (this.cmdScopedEntityManager.get() != null && this.cmdScopedEntityManager.get().isOpen()) {
this.cmdScopedEntityManager.get().flush();
this.cmdScopedEntityManager.get().close();
}
this.cmdScopedEntityManager.set(null);
}
}
--------------------------------------------------------------
Reply to this message by going to Community
[https://community.jboss.org/message/760010#760010]
Start a new discussion in jBPM at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&con...]
12 years, 6 months