- android - 多次调用 OnPrimaryClipChangedListener
- android - 无法更新 RecyclerView 中的 TextView 字段
- android.database.CursorIndexOutOfBoundsException : Index 0 requested, 光标大小为 0
- android - 使用 AppCompat 时,我们是否需要明确指定其 UI 组件(Spinner、EditText)颜色
我正在尝试在 JBoss7 应用程序服务器上部署的 jBPMv5.x 上执行简单的人工任务 bpmn。数据库是Postgresql V9.2。我发现任务正在提交到数据库,但即使在调用 ksession.dispose() 之后,sessioninfo 和 processinfo 也永远不会插入到相应的表中。
请让我知道我缺少什么。
persistence.xml
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<persistence version="2.0"
xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="
http://java.sun.com/xml/ns/persistence
http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd">
<persistence-unit name="org.drools.persistence.jpa"
transaction-type="JTA">
<provider>org.hibernate.ejb.HibernatePersistence</provider>
<jta-data-source>java:jboss/datasources/jbpmDS</jta-data-source>
<mapping-file>META-INF/ProcessInstanceInfo.hbm.xml</mapping-file>
<mapping-file>META-INF/ExtraIndexes.hbm.xml</mapping-file>
<mapping-file>META-INF/JBPMorm.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>
<properties>
<property name="hibernate.dialect" value="org.hibernate.dialect.PostgreSQLDialect" />
<property name="hibernate.default_schema" value="jbpm" />
<property name="hibernate.cache.use_query_cache" value="false" />
<property name="hibernate.show_sql" value="true" />
<property name="hibernate.format_sql" value="true" />
<property name="hibernate.use_sql_comments" value="true" />
<property name="hibernate.transaction.manager_lookup_class"
value="org.hibernate.transaction.JBossTransactionManagerLookup" />
<property name="hibernate.transaction.factory_class"
value="org.hibernate.transaction.JTATransactionFactory" />
<property name="hibernate.transaction.flush_before_completion"
value="false" />
<property name="hibernate.id.new_generator_mappings" value="false" />
</properties>
</persistence-unit>
<persistence-unit name="org.jbpm.task"
transaction-type="JTA">
<provider>org.hibernate.ejb.HibernatePersistence</provider>
<jta-data-source>java:jboss/datasources/jbpmDS</jta-data-source>
<mapping-file>META-INF/Taskorm.xml</mapping-file>
<class>org.jbpm.task.Attachment</class>
<class>org.jbpm.task.BooleanExpression</class>
<class>org.jbpm.task.Comment</class>
<class>org.jbpm.task.Content</class>
<class>org.jbpm.task.Deadline</class>
<class>org.jbpm.task.Delegation</class>
<class>org.jbpm.task.EmailNotification</class>
<class>org.jbpm.task.EmailNotificationHeader</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.OnAllSubTasksEndParentEndStrategy</class>
<class>org.jbpm.task.OnParentAbortAllSubTasksEndStrategy</class>
<class>org.jbpm.task.PeopleAssignments</class>
<class>org.jbpm.task.Reassignment</class>
<class>org.jbpm.task.Status</class>
<class>org.jbpm.task.SubTasksStrategy</class>
<class>org.jbpm.task.Task</class>
<class>org.jbpm.task.TaskData</class>
<class>org.jbpm.task.User</class>
<properties>
<property name="hibernate.dialect" value="org.hibernate.dialect.PostgreSQLDialect" />
<property name="hibernate.default_schema" value="jbpm" />
<property name="hibernate.cache.use_query_cache" value="false" />
<property name="hibernate.show_sql" value="true" />
<property name="hibernate.format_sql" value="true" />
<property name="hibernate.use_sql_comments" value="true" />
<property name="hibernate.transaction.manager_lookup_class"
value="org.hibernate.transaction.JBossTransactionManagerLookup" />
<property name="hibernate.transaction.factory_class"
value="org.hibernate.transaction.JTATransactionFactory" />
<property name="hibernate.transaction.flush_before_completion"
value="false" />
<property name="hibernate.id.new_generator_mappings" value="false" />
</properties>
</persistence-unit>
</persistence>
ProcMgmtBean
@TransactionManagement(TransactionManagementType.BEAN)
@Singleton(name = "ProcMgmt")
public class ProcMgmtBean implements IProcMgmt, Serializable {
private static final long serialVersionUID = 1L;
@PersistenceUnit(unitName = "org.jbpm.task")
private EntityManagerFactory emftask;
@PersistenceUnit(unitName = "org.drools.persistence.jpa")
private EntityManagerFactory emfpersist;
public void registerTaskService(StatefulKnowledgeSession ksession) {
Properties properties = getProperties();
System.setProperty("jbpm.usergroup.callback", properties.getProperty(
"taskservice.usergroupcallback",
"org.jbpm.task.service.DefaultUserGroupCallbackImpl"));
System.out.println("Inside register task service, create new task service");
TaskService taskService = new TaskService(emftask,
SystemEventListenerFactory.getSystemEventListener());
System.out.println("Task service instantiated, creating handler");
SyncWSHumanTaskHandler handler = new SyncWSHumanTaskHandler(
new LocalTaskService(taskService), ksession);
handler.connect();
System.out.println("Handler connected");
ksession.getWorkItemManager().registerWorkItemHandler("Human Task",
handler);
System.out.println("Task service registered");
}
protected Environment createEnvironment() {
Environment env = EnvironmentFactory.newEnvironment();
env.set(EnvironmentName.ENTITY_MANAGER_FACTORY, emfpersist);
return env;
}
public StatefulKnowledgeSession newStatefulKnowledgeSession(
KnowledgeBase kbase) {
return loadStatefulKnowledgeSession(kbase, -1);
}
public StatefulKnowledgeSession loadStatefulKnowledgeSession(
KnowledgeBase kbase, int sessionId) {
StatefulKnowledgeSession ksession;
Environment env = createEnvironment();
Properties sessionconfigproperties = new Properties();
sessionconfigproperties.put("drools.processInstanceManagerFactory",
"org.jbpm.process.instance.impl.DefaultProcessInstanceManagerFactory");
sessionconfigproperties.put("drools.processSignalManagerFactory",
"org.jbpm.process.instance.event.DefaultSignalManagerFactory");
KnowledgeSessionConfiguration config = KnowledgeBaseFactory
.newKnowledgeSessionConfiguration(sessionconfigproperties);
if (sessionId == -1) {
System.out.println("session id = -1");
ksession = JPAKnowledgeService.newStatefulKnowledgeSession(kbase,
config, env);
} else {
System.out.println("session id = " + sessionId);
ksession = JPAKnowledgeService.loadStatefulKnowledgeSession(
sessionId, kbase, config, env);
}
return ksession;
}
}
调用servlet
protected void doGet(HttpServletRequest request,
HttpServletResponse response) throws ServletException, IOException {
System.out.println("Inside doGet");
initiateWF();
}
private void initiateWF() {
System.out.println("Init");
KnowledgeBase kbase = readKnowledgeBase();
IProcMgmt processMgmt = null;
System.out.println("START OF CREATION OF PROC MANAGEMENT");
try {
Context ctx = new InitialContext();
processMgmt = (IProcMgmt) ctx
.lookup("java:global...");
System.out.println("Proc management created "
+ (processMgmt != null));
} catch (NamingException e1) {
System.out.println("Fail to create Proc mgmt");
e1.printStackTrace();
}
System.out.println("read kb complete");
StatefulKnowledgeSession ksession = processMgmt
.newStatefulKnowledgeSession(kbase);
int sessionId = ksession.getId();
System.out.println("session id:" + sessionId );
System.out
.println("got new ksession, starting to register task service");
processMgmt.registerTaskService(ksession);
System.out.println("task service registered");
// start a new process instance
//Each Command will generate an interaction
System.out.println(">>> Let's Create Process Instance");
ProcessInstance processInstance = ksession.createProcessInstance("com.sample.bpmn.humanhello",null);
System.out.println(">>> Let's Start the Process Instance");
long processInstanceId = processInstance.getId();
System.out.println(" processInstanceId:" + processInstanceId);
String processId = processInstance.getProcessId();
System.out.println(" process id:" + processId);
ksession.startProcess(processId);
System.out.println(">>> Disposing Session");
ksession.dispose();
}
private KnowledgeBase readKnowledgeBase() {
KnowledgeBuilder kbuilder = KnowledgeBuilderFactory
.newKnowledgeBuilder();
kbuilder.add(ResourceFactory
.newClassPathResource("jbpm/com.sample.HumanHello.bpmn2"),
ResourceType.BPMN2);
return kbuilder.newKnowledgeBase();
}
最佳答案
当您使用本地任务管理器时,无需为引擎和任务服务创建单独的 emf。您能否检查一下,对于运行时引擎和任务服务使用相同的电动势是否会改变任何内容?如果没有,您能否附加服务器日志,因为您似乎已将 sql 输出设置为 true,这可能很有用。
克里斯
关于java - jBPM 5 - sessioninfo 和 processinfo 没有得到持久化,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18703654/
使用 remove.packages("igraph") 删除 igraph 包后,sessionInfo() 返回: Error: $ operator is invalid for atomic
如果我想在 R 中为 PDF 很好地打印我的 sessionInfo,我可以使用 toLatex(sessionInfo()) 似乎 rmarkdown 应该有一个类似的选项来呈现在 HTML 中,但
通常我使用 R,并且经常在想要使事情可重现时,我使用 sessionInfo()。这样做的原因是我喜欢让人们知道我正在使用的所有内容的版本,我安装/加载的软件包以及我正在使用的操作系统等,这样就很清楚
我想将“sessionInfo()”的输出保存到文本文件中。使用“write()”失败,因为“list()无法由'cat()'处理”。然后,我尝试使用ascii = T进行“save()”操作,但是生
我正在尝试在 JBoss7 应用程序服务器上部署的 jBPMv5.x 上执行简单的人工任务 bpmn。数据库是Postgresql V9.2。我发现任务正在提交到数据库,但即使在调用 ksession
我正在使用 firebase 和 android studio。我在尝试删除用户时遇到了一个问题。访问我的应用程序的唯一方法是电话号码身份验证。 我已经知道当我删除用户时,必须重新验证。所以我引用了
我是一名优秀的程序员,十分优秀!