[jBPM] - My jBPM5.2 doesn't work! Like this......
by 渊 李
渊 李 [https://community.jboss.org/people/c1269355458] created the discussion
"My jBPM5.2 doesn't work! Like this......"
To view the discussion, visit: https://community.jboss.org/message/725490#725490
--------------------------------------------------------------
hi, all.
JPA and MinaTaskServer are working well.
my action is like this:
|
| StatefulKnowledgeSession session = null; |
|
|
| try { |
|
|
| session = JbpmAPIUtil.createKnowledgeSession("bpmn/HumanTask.bpmn"); |
|
|
| session.getWorkItemManager().registerWorkItemHandler("Human Task", new WSHumanTaskHandler()); |
|
|
| } catch (Exception e) { |
|
|
| e.printStackTrace(); |
|
|
| } |
|
|
| Map<String, Object> params = new HashMap<String, Object>(); |
|
|
| params.put("userId", "krisv"); |
|
|
| params.put("description", "Need a new laptop computer"); |
|
|
| ProcessInstance instance = session.startProcess("com.sample.humantask", params); |
|
|
|
|
|
|
| System.out.println("\n\n start " + instance); |
|
|
|
|
and error:
Hibernate: insert into SessionInfo (lastModificationDate, rulesByteArray, startDate, OPTLOCK) values (?, ?, ?, ?)
Hibernate: insert into ProcessInstanceInfo (lastModificationDate, lastReadDate, processId, processInstanceByteArray, startDate, state, OPTLOCK) values (?, ?, ?, ?, ?, ?, ?)
Hibernate: insert into WorkItemInfo (creationDate, name, processInstanceId, state, OPTLOCK, workItemByteArray) values (?, ?, ?, ?, ?, ?)
2012-03-22 14:54:49,546 INFO [LoggingFilter.java:158] : CREATED
2012-03-22 14:54:49,546 INFO [LoggingFilter.java:158] : OPENED
2012-03-22 14:54:49,562 INFO [LoggingFilter.java:140] : RECEIVED: HeapBuffer[pos=0 lim=675 cap=2048: 00 00 01 4F AC ED 00 05 73 72 01 00 1D 6F 72 67...]
2012-03-22 14:54:49,734 INFO [LoggingFilter.java:140] : RECEIVED: HeapBuffer[pos=0 lim=1007 cap=2048: 00 00 01 4D AC ED 00 05 73 72 01 00 1D 6F 72 67...]
2012-03-22 14:54:49,750 WARN [JDBCExceptionReporter.java:233] : SQL Error: 1452, SQLState: 23000
2012-03-22 14:54:49,750 ERROR [JDBCExceptionReporter.java:234] : Cannot add or update a child row: a foreign key constraint fails (`example`.`peopleassignments_potowners`, CONSTRAINT `FK1EE418D2C122ED2` FOREIGN KEY (`entity_id`) REFERENCES `organizationalentity` (`id`))
javax.persistence.RollbackException: Error while committing the transaction
....
Caused by: java.sql.BatchUpdateException: Cannot add or update a child row: a foreign key constraint fails (`example`.`peopleassignments_potowners`, CONSTRAINT `FK1EE418D2C122ED2` FOREIGN KEY (`entity_id`) REFERENCES `organizationalentity` (`id`))
....
--------------------------------------------------------------
Reply to this message by going to Community
[https://community.jboss.org/message/725490#725490]
Start a new discussion in jBPM at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&con...]
12 years, 3 months
[JNDI and Naming] - How to bind objects to the java:jboss/exported from OSGI code
by Ed Roberts
Ed Roberts [https://community.jboss.org/people/ejroberts] created the discussion
"How to bind objects to the java:jboss/exported from OSGI code"
To view the discussion, visit: https://community.jboss.org/message/725364#725364
--------------------------------------------------------------
Hi,
I'm migrating some code currently working when deployed in JBoss AS 5.1.0 to 7.1.1
I have converted what was originally a SAR based deployment to an OSGI bundle deployment.
A service which was originally started by an MBean, is now registered as an OSGI Service via a Spring DM xml file.
I can see this mechanism works fine in JBoss 7.1.1.Final.
However, the service attempts to bind a remotely accessible object into the JNDI registry. I changed the JNDI name
to reflect what I had seen in documentation. However, the binding bit is failing and I cannot find any documentation with any OSGI based
code snippets to follow.
The JNDI name I want to bind to at the moment is java:jboss/exported/A/B##/C, and the code the service uses to do this is like this
When I run the AS server, I get the following exception thrown out:
Caused by: java.lang.UnsupportedOperationException: JBAS011859: Naming context is read-only
at org.jboss.as.naming.WritableServiceBasedNamingStore.requireOwner(WritableServiceBasedNamingStore.java:126)
at org.jboss.as.naming.WritableServiceBasedNamingStore.bind(WritableServiceBasedNamingStore.java:56)
at org.jboss.as.naming.NamingContext.bind(NamingContext.java:221)
at org.jboss.as.naming.InitialContext.bind(InitialContext.java:172)
at javax.naming.InitialContext.bind(InitialContext.java:404)
I have seen references https://issues.jboss.org/browse/AS7-2667?focusedCommentId=12654355&page=c... https://issues.jboss.org/browse/AS7-2667?focusedCommentId=12654355&page=c...
from February suggesting that in a non-EE component you need to use the following code:
WritableServiceBasedNamingStore.pushOwner(context.getChildTarget());
try {
jmsManager.createConnectionFactory(false, configuration, configuration.getBindings());
} finally {
WritableServiceBasedNamingStore.popOwner();
}
Is there an OSGI way of cracking this ? I would prefer not to have to reference JBoss specific code to bind into JNDI.
However, If that is the only working solution, then what exactly is the context object in this example, and how do I get hold of one within the OSGI environment.
InitialContext ctx = bundleContext.getService( bundleContext.getServiceReference(InitialContext.class.getName()) );
Name name = ctx.getNameParser("").parse( "java:jboss/exported/A/B/C" );
ctx.bind( name, myObject );
--------------------------------------------------------------
Reply to this message by going to Community
[https://community.jboss.org/message/725364#725364]
Start a new discussion in JNDI and Naming at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&con...]
12 years, 3 months
[jBPM] - KSession persistence and problems!
by ramkijbpm
ramkijbpm [https://community.jboss.org/people/ramkijbpm] created the discussion
"KSession persistence and problems!"
To view the discussion, visit: https://community.jboss.org/message/725342#725342
--------------------------------------------------------------
I get this very exception about namedQueries in Weblogic. Is there any good solution to this below problem? It really is very painful!!! Is JBPM compatible to weblogic server?
Caused By:
org.hibernate.HibernateException
: Errors in named queries: TasksAssignedAsPotentialOwner, UnescalatedDeadlines, TasksAssignedAsTaskStakeholder, TasksAssignedAsRecipient, TasksAssignedAsPotentialOwnerByGroup, TasksAssignedAsExcludedOwner, TasksAssignedAsBusinessAdministrator, SubTasksAssignedAsPotentialOwner, ProcessInstancesWaitingForEvent, TaskByWorkItemId, TasksOwned, TasksAssignedAsPotentialOwnerWithGroups, GetSubTasksByParentTaskId, TasksAssignedAsTaskInitiator
Find my persistence.xml
<?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
http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd 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 http://java.sun.com/xml/ns/persistence/orm_1_0.xsd http://java.sun.com/xml/ns/persistence/orm_1_0.xsd"
xmlns:orm=" http://java.sun.com/xml/ns/persistence/orm http://java.sun.com/xml/ns/persistence/orm" xmlns:xsi=" http://www.w3.org/2001/XMLSchema-instance http://www.w3.org/2001/XMLSchema-instance"
xmlns=" http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence">
<persistence-unit name="com.taskServer.task">
<provider>org.hibernate.ejb.HibernatePersistence</provider>
<mapping-file>META-INF/Taskorm.xml</mapping-file>
<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>
<property name="hibernate.dialect" value="org.hibernate.dialect.Oracle10gDialect" />
<property name="hibernate.connection.driver_class" value="oracle.jdbc.driver.OracleDriver" />
<property name="hibernate.connection.url" value="jdbc:oracle:thin:@//xxxx:11102/xxxxx2" />
<property name="hibernate.connection.username" value="xxxx" />
<property name="hibernate.connection.password" value="xxxxxxx" />
<property name="hibernate.connection.autocommit" value="false" />
<property name="hibernate.max_fetch_depth" value="3" />
<property name="hibernate.hbm2ddl.auto" value="validate" />
<property name="hibernate.show_sql" value="true" />
<property name="hibernate.query.startup_check" value="false" />
</properties>
</persistence-unit>
<persistence-unit name="jbpm.persistence.jpa" transaction-type="JTA">
<provider>org.hibernate.ejb.HibernatePersistence</provider>
<jta-data-source>JTADataSource1</jta-data-source>
<mapping-file>META-INF/JBPMorm.xml</mapping-file>
<class>org.drools.persistence.info.SessionInfo</class>
<class>org.jbpm.persistence.processinstance.ProcessInstanceInfo</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>
<properties>
<property name="hibernate.transaction.manager_lookup_class" value="org.hibernate.transaction.WeblogicTransactionManagerLookup"/>
<property name="hibernate.transaction.factory_class" value="org.hibernate.transaction.JTATransactionFactory"/>
<property name="hibernate.dialect" value="org.hibernate.dialect.Oracle10gDialect" />
<property name="hibernate.connection.datasource" value="JTADataSource1"/>
<property name="hibernate.hbm2ddl.auto" value="validate" />
<property name="hibernate.show_sql" value="true" />
<property name="hibernate.query.startup_check" value="false" />
</properties>
</persistence-unit>
</persistence>
As well, I have another question. Why would one want to restore the ksession? To get the tasks associated to a user, I can always use the TaskClient,
TaskClient client =
new TaskClient(new MinaTaskClientConnector("web client", new MinaTaskClientHandler(SystemEventListenerFactory.getSystemEventListener())));
client.getTasksAssignedAsPotentialOwner(userId,
LANGUAGE, responseHandler);
Can I always create a new session when the server restarts. I am assuming the only reason we would persist the Ksession is to get the process instance using the sessionId? Is there a way to fetch an existing processInstance with a new ksession. Leads to the question, what is the recommendation as to the lifecycle of a ksession. Can I create new sessions always?
--------------------------------------------------------------
Reply to this message by going to Community
[https://community.jboss.org/message/725342#725342]
Start a new discussion in jBPM at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&con...]
12 years, 3 months