[jBPM] - jBPM 5.3 and database access
by jena74
jena74 [https://community.jboss.org/people/jena74] created the discussion
"jBPM 5.3 and database access"
To view the discussion, visit: https://community.jboss.org/message/739727#739727
--------------------------------------------------------------
Hello,
I have created a small process which has one script task. In this task, I call one method of a personal Java class. Then this method updates an existing line in an Oracle database and commit.
As my table is located in the same schema of the one owning the jBPM persistence tables, in my Java class I use the PoolingDataSource returned by JBPMHelper.setupDataSource().
But, when I run my process, I have an error saying:
+java.sql.SQLException: cannot commit a resource enlisted in a global transaction+
As I configured my jBPM engine to persist the data, I imagine that there is a transaction while my script task executes. That's why I can not to the commit.
So I am wondering how I should in fact design such a behaviour:
1) Should I first put my own tables into an Oracle schema different that the one used by jBPM to persist? I think yes.
2) According to what I read in the documentation, I should also use a Service task instead of a script task as a database access can be long, with timeouts...
3) Can I reuse in my own Java code the PoolingDataSource returned by JBPMHelper.setupDataSource()? I assume that I should not, and particularly if I put my tables in another schema.
4) If I write a service task to write in database, how should I design this task? I mean, should I reuse hibernate and the persistence.xml file for that? Can I do basic JDBC accesses? What are the best practices usually applied for such situation?
5) It is not clear at all in my mind when a transaction starts and stops in a jBPM process. What are the safe points? Could you basically explain?
Thanks a lot.
Jena
--------------------------------------------------------------
Reply to this message by going to Community
[https://community.jboss.org/message/739727#739727]
Start a new discussion in jBPM at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&con...]
12 years
[jBPM] - drools cannot be resolved
by Sueleyman Vurucu
Sueleyman Vurucu [https://community.jboss.org/people/suikast42] created the discussion
"drools cannot be resolved"
To view the discussion, visit: https://community.jboss.org/message/739684#739684
--------------------------------------------------------------
Hi,
I do an update of drools from 5.0 to 5.4.
For that I do the folowing steps:
1. download Drools and jBPM integration from http://www.jboss.org/drools/downloads http://www.jboss.org/drools/downloads.
2. Create a module with the content:
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<module xmlns="urn:jboss:module:1.1" name="drools">
<resources>
<resource-root path="activation-1.1.jar" />
<resource-root path="activeio-core-3.1.2.jar" />
<resource-root path="activemq-core-5.3.1.jar" />
<resource-root path="activemq-protobuf-1.0.jar" />
<resource-root path="antlr-2.7.7.jar" />
<resource-root path="antlr-3.3.jar" />
<resource-root path="antlr-runtime-3.3.jar" />
<resource-root path="aopalliance-1.0.jar" />
<resource-root path="asm-3.3.jar" />
<resource-root path="camel-blueprint-2.9.0.jar" />
<resource-root path="camel-core-2.9.0.jar" />
<resource-root path="camel-core-osgi-2.9.0.jar" />
<resource-root path="camel-core-xml-2.9.0.jar" />
<resource-root path="camel-cxf-2.9.0.jar" />
<resource-root path="camel-cxf-transport-2.9.0.jar" />
<resource-root path="camel-jaxb-2.9.0.jar" />
<resource-root path="camel-spring-2.9.0.jar" />
<resource-root path="camel-test-2.9.0.jar" />
<resource-root path="camel-xstream-2.9.0.jar" />
<resource-root path="commons-beanutils-1.7.0.jar" />
<resource-root path="commons-collections-3.2.1.jar" />
<resource-root path="commons-compress-1.0.jar" />
<resource-root path="commons-digester-1.8.jar" />
<resource-root path="commons-exec-1.0.1.jar" />
<resource-root path="commons-io-1.4.jar" />
<resource-root path="commons-jexl-1.1.jar" />
<resource-root path="commons-lang-2.4.jar" />
<resource-root path="commons-logging-1.1.1.jar" />
<resource-root path="commons-logging-api-1.1.jar" />
<resource-root path="commons-net-2.0.jar" />
<resource-root path="cxf-api-2.4.4.jar" />
<resource-root path="cxf-bundle-jaxrs-2.4.4.jar" />
<resource-root path="cxf-common-utilities-2.4.4.jar" />
<resource-root path="cxf-rt-bindings-soap-2.4.4.jar" />
<resource-root path="cxf-rt-bindings-xml-2.4.4.jar" />
<resource-root path="cxf-rt-core-2.4.4.jar" />
<resource-root path="cxf-rt-databinding-jaxb-2.4.4.jar" />
<resource-root path="cxf-rt-frontend-jaxrs-2.4.4.jar" />
<resource-root path="cxf-rt-frontend-jaxws-2.4.4.jar" />
<resource-root path="cxf-rt-frontend-simple-2.4.4.jar" />
<resource-root path="cxf-rt-transports-common-2.4.4.jar" />
<resource-root path="cxf-rt-transports-http-2.4.4.jar" />
<resource-root path="cxf-rt-ws-addr-2.4.4.jar" />
<resource-root path="cxf-tools-common-2.4.4.jar" />
<resource-root path="dom4j-1.6.1.jar" />
<resource-root path="drools-camel-5.4.0.Final.jar" />
<resource-root path="drools-camel-server-5.4.0.Final.war" />
<resource-root path="drools-compiler-5.4.0.Final.jar" />
<resource-root path="drools-core-5.4.0.Final.jar" />
<resource-root path="drools-decisiontables-5.4.0.Final.jar" />
<resource-root path="drools-grid-impl-5.4.0.Final.jar" />
<resource-root path="drools-persistence-jpa-5.4.0.Final.jar" />
<resource-root path="drools-pipeline-5.4.0.Final.jar" />
<resource-root path="drools-simulator-5.4.0.Final.jar" />
<resource-root path="drools-spring-5.4.0.Final.jar" />
<resource-root path="drools-templates-5.4.0.Final.jar" />
<resource-root path="ecj-3.5.1.jar" />
<resource-root path="ejb3-persistence-1.0.2.GA.jar" />
<resource-root path="freemarker-2.3.15.jar" />
<resource-root path="geronimo-activation_1.1_spec-1.1.jar" />
<resource-root path="geronimo-annotation_1.0_spec-1.1.1.jar" />
<resource-root path="geronimo-j2ee-management_1.0_spec-1.0.jar" />
<resource-root path="geronimo-j2ee-management_1.1_spec-1.0.1.jar" />
<resource-root path="geronimo-javamail_1.4_spec-1.7.1.jar" />
<resource-root path="geronimo-jms_1.1_spec-1.1.1.jar" />
<resource-root path="geronimo-stax-api_1.0_spec-1.0.1.jar" />
<resource-root path="h2-1.3.161.jar" />
<resource-root path="hamcrest-integration-1.2.1.jar" />
<resource-root path="hamcrest-library-1.2.1.jar" />
<resource-root path="hazelcast-1.8.5.jar" />
<resource-root path="hibernate-annotations-3.4.0.GA.jar" />
<resource-root path="hibernate-commons-annotations-3.1.0.GA.jar" />
<resource-root path="hibernate-core-3.3.2.GA.jar" />
<resource-root path="hibernate-entitymanager-3.4.0.GA.jar" />
<resource-root path="hibernate-jpa-2.0-api-1.0.1.Final.jar" />
<resource-root path="javassist-3.10.0.GA.jar" />
<resource-root path="javassist-3.14.0-GA.jar" />
<resource-root path="jaxb-api-2.2.5.jar" />
<resource-root path="jaxb-impl-2.2.5.jar" />
<resource-root path="jaxb-xjc-2.2.5.jar" />
<resource-root path="jbpm-bpmn2-5.3.0.Final.jar" />
<resource-root path="jbpm-flow-5.3.0.Final.jar" />
<resource-root path="jbpm-flow-builder-5.3.0.Final.jar" />
<resource-root path="jbpm-workitems-5.3.0.Final.jar" />
<resource-root path="jdom-1.0.jar" />
<resource-root path="jettison-1.2.jar" />
<resource-root path="jetty-continuation-7.4.5.v20110725.jar" />
<resource-root path="jetty-http-7.4.5.v20110725.jar" />
<resource-root path="jetty-io-7.4.5.v20110725.jar" />
<resource-root path="jetty-security-7.4.5.v20110725.jar" />
<resource-root path="jetty-server-7.4.5.v20110725.jar" />
<resource-root path="jetty-util-7.4.5.v20110725.jar" />
<resource-root path="joda-time-1.6.jar" />
<resource-root path="jsr311-api-1.1.1.jar" />
<resource-root path="jta-1.1.jar" />
<resource-root path="jxl-2.6.10.jar" />
<resource-root path="jxls-reader-0.9.6.jar" />
<resource-root path="kahadb-5.3.1.jar" />
<resource-root path="knowledge-api-5.4.0.Final.jar" />
<resource-root path="knowledge-internal-api-5.4.0.Final.jar" />
<resource-root path="log4j-1.2.16.jar" />
<resource-root path="mail-1.4.jar" />
<resource-root path="milyn-commons-1.2.jar" />
<resource-root path="milyn-smooks-core-1.2.jar" />
<resource-root path="milyn-smooks-javabean-1.2.jar" />
<resource-root path="mina-core-2.0.1.jar" />
<resource-root path="mvel2-2.1.0.drools16.jar" />
<resource-root path="neethi-3.0.1.jar" />
<resource-root path="org.apache.aries.blueprint-0.3.jar" />
<resource-root path="org.apache.aries.proxy.api-0.3.jar" />
<resource-root path="org.apache.aries.testsupport.unit-0.3.jar" />
<resource-root path="org.apache.aries.util-0.3.jar" />
<resource-root path="org.osgi.core-4.1.0.jar" />
<resource-root path="persistence-api-1.0.jar" />
<resource-root path="poi-3.0.2-FINAL.jar" />
<resource-root path="protobuf-java-2.4.1.jar" />
<resource-root path="rome-0.9.jar" />
<resource-root path="serializer-2.7.1.jar" />
<resource-root path="simple-jndi-0.11.4.jar" />
<resource-root path="slf4j-api-1.6.4.jar" />
<resource-root path="slf4j-log4j12-1.6.4.jar" />
<resource-root path="smack-3.0.4.jar" />
<resource-root path="snakeyaml-1.4.jar" />
<resource-root path="spring-aop-3.0.6.RELEASE.jar" />
<resource-root path="spring-asm-3.0.6.RELEASE.jar" />
<resource-root path="spring-beans-3.0.6.RELEASE.jar" />
<resource-root path="spring-context-3.0.6.RELEASE.jar" />
<resource-root path="spring-core-3.0.6.RELEASE.jar" />
<resource-root path="spring-expression-3.0.6.RELEASE.jar" />
<resource-root path="spring-osgi-core-1.2.1.jar" />
<resource-root path="spring-osgi-io-1.2.1.jar" />
<resource-root path="spring-tx-3.0.6.RELEASE.jar" />
<resource-root path="spring-web-3.0.6.RELEASE.jar" />
<resource-root path="stax-api-1.0-2.jar" />
<resource-root path="stax-api-1.0.1.jar" />
<resource-root path="stax2-api-3.1.1.jar" />
<resource-root path="stringtemplate-3.2.1.jar" />
<resource-root path="woodstox-core-asl-4.1.1.jar" />
<resource-root path="wsdl4j-1.6.2.jar" />
<resource-root path="xalan-2.7.1.jar" />
<resource-root path="xercesImpl-2.9.1.jar" />
<resource-root path="xml-apis-1.3.04.jar" />
<resource-root path="xml-resolver-1.2.jar" />
<resource-root path="xmlpull-1.1.3.1.jar" />
<resource-root path="xmlschema-core-2.0.1.jar" />
<resource-root path="xpp3_min-1.1.4c.jar" />
<resource-root path="xstream-1.4.1.jar" />
</resources>
<dependencies>
<module export="true" name="javax.api" slot="main" />
</dependencies>
</module>
3. activate that modulle via jboss-deployment-structure.xml:
<jboss-deployment-structure>
<!--
<ear-subdeployments-isolated>true</ear-subdeployments-isolated>
-->
<deployment>
<dependencies>
<module name="drools" slot="main" />
<module name="org.hibernate" slot="main" />
</dependencies>
</deployment>
</jboss-deployment-structure>
--------------------------------------------------------------
Reply to this message by going to Community
[https://community.jboss.org/message/739684#739684]
Start a new discussion in jBPM at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&con...]
12 years
[Javassist] - Javassist seems to be stripping off existing annotations - why?
by Paul Cugini
Paul Cugini [https://community.jboss.org/people/cuginip] created the discussion
"Javassist seems to be stripping off existing annotations - why?"
To view the discussion, visit: https://community.jboss.org/message/739662#739662
--------------------------------------------------------------
Hello. I'm trying to use Javassist in a jUnit test. My objective is to create a dynamic class based on an existing class, for the purposes of dynamically adding an annotation. In my test I'm also replacing the method body of one of the methods of the original class. This basically seems to work. However I've noticed something which is very annoying and which has hindered my progress. It seems as though when javassist is creating the new class based on the specified original, all of the existing annotations on the existing class are stripped off in the new dynamic class created by Javassist. This seems to be occurring even when my code doesn't include any modifications to the annotations on the original. The only way I've seen to get around this is to re-add all of the annotations that need to be there, but this is very cumbersome. The version of javassist I'm using is 3.12. I'm wondering if this is a known issue, or if perhaps I'm doing something wrong that is causing this to happen.
Here is a snippet of my code:
@Test
public testCase {
...
Class newClass = buildClassWithMethod(ExistingClass.class, "getRecordClass", "{return + dynamicBeanClass.getName() + ".class";}");
...
Method controlInitMethod = getInitMethod(ExistingClass.class);
ExistingAnnotation controlExistingAnnotation = controlInitMethod.getAnnotation(ExistingAnnotation.class);
Assert.assertNotNull(controlExistingAnnotation); // PASSES as expected.
Method initMethod = getInitMethod(newClass);
ExistingAnnotation existingAnnot = initMethod.getAnnotation(ExistingAnnotation.class);
Assert.assertNotNull(existingAnnot); // FAILS!
...
}
private Class buildClassWithMethod(Class originalClass,
String newMethodName,
Stirng newMethodText) throws Exception {
ClassPool pool = ClassPool.getDefault();
Loader loader = new Loader(pool);
pool.insertClassPath(new ClassClassPath(originalClass));
CtClass cc = pool.getCtClass(originalClass.getName());
CtMethod methodToReplace = cc.getDeclaredMethod(newMethodName);
methodToReplace.setBody(newMethodText);
ClassFile ccFile = cc.getClassFile();
ConstPool constpool = ccFile.getConstPool();
Class dynamicBeanClass = cc.toClass(loader, null);
return dynamicBeanClass;
}
--------------------------------------------------------------
Reply to this message by going to Community
[https://community.jboss.org/message/739662#739662]
Start a new discussion in Javassist at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&con...]
12 years
[jBPM] - jBPM persistence configuration
by Florent GUERIN
Florent GUERIN [https://community.jboss.org/people/fguerin] created the discussion
"jBPM persistence configuration"
To view the discussion, visit: https://community.jboss.org/message/739626#739626
--------------------------------------------------------------
Hi,
I have some problem to configure persistence of the data in my application.
I would like to use jBPM without jndi data source.
this is my persistence.xml file:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<persistence version="1.0"
xsi:schemaLocation="http://java.sun.com/xml/ns/persistence
http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd
http://java.sun.com/xml/ns/persistence/orm
http://java.sun.com/xml/ns/persistence/orm_1_0.xsd"
xmlns:orm="http://java.sun.com/xml/ns/persistence/orm" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://java.sun.com/xml/ns/persistence">
<persistence-unit name="org.jbpm.persistence"
transaction-type="RESOURCE_LOCAL">
<provider>org.hibernate.ejb.HibernatePersistence</provider>
<mapping-file>META-INF/JBPMorm.xml</mapping-file>
<mapping-file>META-INF/Taskorm.xml</mapping-file>
<mapping-file>META-INF/ProcessInstanceInfo.hbm.xml</mapping-file>
<class>org.jbpm.persistence.processinstance.ProcessInstanceInfo</class>
<class>org.drools.persistence.info.SessionInfo</class>
<class>org.drools.persistence.info.WorkItemInfo</class>
<class>org.jbpm.process.audit.ProcessInstanceLog</class>
<class>org.jbpm.process.audit.NodeInstanceLog</class>
<class>org.jbpm.process.audit.VariableInstanceLog</class>
<class>org.jbpm.task.Attachment</class>
<class>org.jbpm.task.Content</class>
<class>org.jbpm.task.BooleanExpression</class>
<class>org.jbpm.task.Comment</class>
<class>org.jbpm.task.Deadline</class>
<class>org.jbpm.task.Comment</class>
<class>org.jbpm.task.Deadline</class>
<class>org.jbpm.task.Delegation</class>
<class>org.jbpm.task.Escalation</class>
<class>org.jbpm.task.Group</class>
<class>org.jbpm.task.I18NText</class>
<class>org.jbpm.task.Notification</class>
<class>org.jbpm.task.EmailNotification</class>
<class>org.jbpm.task.EmailNotificationHeader</class>
<class>org.jbpm.task.PeopleAssignments</class>
<class>org.jbpm.task.Reassignment</class>
<class>org.jbpm.task.Status</class>
<class>org.jbpm.task.Task</class>
<class>org.jbpm.task.TaskData</class>
<class>org.jbpm.task.SubTasksStrategy</class>
<class>org.jbpm.task.OnParentAbortAllSubTasksEndStrategy</class>
<class>org.jbpm.task.OnAllSubTasksEndParentEndStrategy</class>
<class>org.jbpm.task.User</class>
<properties>
<!-- Logs SQL -->
<property name="hibernate.show_sql" value="true" />
<property name="hibernate.format_sql" value="true"/>
<property name="use_sql_comments" value="true"/>
<!-- connexion JDBC -->
<property name="hibernate.connection.driver" value="com.mysql.jdbc.Driver" />
<property name="hibernate.connection.username" value="****" />
<property name="hibernate.connection.password" value="****" />
<property name="hibernate.connection.url" value="jdbc:mysql://localhost:3306/****" />
<!-- creation automatique du schéma -->
<property name="hibernate.hbm2ddl.auto" value="create" />
<!-- Dialecte -->
<property name="hibernate.dialect" value="org.hibernate.dialect.MySQLDialect" />
</properties>
</persistence-unit>
Its seems that no data are stored in the database, maybe because i don't define transaction manager.
I would like to activate history log but i don't know how to do this, i try to activate it with JPAWorkingMemoryDbLogger but it doesn't work and produce exceptions.
If someone can help me on this.
Best regards,
--------------------------------------------------------------
Reply to this message by going to Community
[https://community.jboss.org/message/739626#739626]
Start a new discussion in jBPM at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&con...]
12 years
[jBPM] - Concurrent modification exception
by Pavel Sknar
Pavel Sknar [https://community.jboss.org/people/pavel.sknar] created the discussion
"Concurrent modification exception"
To view the discussion, visit: https://community.jboss.org/message/739593#739593
--------------------------------------------------------------
I have exception:
| Caused by: javax.persistence.RollbackException: Error while committing the transaction | |
| | at org.hibernate.ejb.TransactionImpl.commit(TransactionImpl.java:93) | |
| | at org.springframework.orm.jpa.ExtendedEntityManagerCreator$ExtendedEntityManagerSynchronization.afterCommit(ExtendedEntityManagerCreator.java:478) | |
| | ... 24 more | |
| Caused by: java.util.ConcurrentModificationException | |
| | at java.util.HashMap$HashIterator.nextEntry(HashMap.java:806) | |
| | at java.util.HashMap$KeyIterator.next(HashMap.java:841) | |
| | at org.drools.marshalling.impl.OutputMarshaller.writeWorkItem(OutputMarshaller.java:1078) | |
| | at org.drools.persistence.info.WorkItemInfo.update(WorkItemInfo.java:134) | |
| | at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) | |
| | at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) | |
| | at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) | |
| | at java.lang.reflect.Method.invoke(Method.java:601) | |
| | at org.hibernate.ejb.event.BeanCallback.invoke(BeanCallback.java:37) | |
| | at org.hibernate.ejb.event.EntityCallbackHandler.callback(EntityCallbackHandler.java:94) | |
| | at org.hibernate.ejb.event.EntityCallbackHandler.preUpdate(EntityCallbackHandler.java:79) | |
| | at org.hibernate.ejb.event.EJB3FlushEntityEventListener.invokeInterceptor(EJB3FlushEntityEventListener.java:61) | |
| | at org.hibernate.event.def.DefaultFlushEntityEventListener.handleInterception(DefaultFlushEntityEventListener.java:349) | |
| | at org.hibernate.event.def.DefaultFlushEntityEventListener.scheduleUpdate(DefaultFlushEntityEventListener.java:287) | |
| | at org.hibernate.event.def.DefaultFlushEntityEventListener.onFlushEntity(DefaultFlushEntityEventListener.java:155) | |
| | at org.hibernate.event.def.AbstractFlushingEventListener.flushEntities(AbstractFlushingEventListener.java:219) | |
| | at org.hibernate.event.def.AbstractFlushingEventListener.flushEverythingToExecutions(AbstractFlushingEventListener.java:99) | |
| | at org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:50) | |
| | at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:1216) | |
| | at org.hibernate.impl.SessionImpl.managedFlush(SessionImpl.java:383) | |
| | at org.hibernate.transaction.JDBCTransaction.commit(JDBCTransaction.java:133) | |
| | at org.hibernate.ejb.TransactionImpl.commit(TransactionImpl.java:76) |
--------------------------------------------------------------
Reply to this message by going to Community
[https://community.jboss.org/message/739593#739593]
Start a new discussion in jBPM at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&con...]
12 years