JBoss JBPM 5.2.0 中遇到的几个问题及解决方法

http://cutelion.blog.hexun.com/71681028_d.html


1. 问题一
(1) Caused by: org.hibernate.HibernateException: Errors in named queries:
TasksAssignedAsPotentialOwnerWithGroups, TasksOwned,
TasksAssignedAsPotentialOwner,
TasksAssignedAsRecipient, TasksAssignedAsTaskStakeholder, TasksAssignedAsExcludedOwner,
TasksAssignedAsPotentialOwnerByGroup, GetSubTasksByParentTaskId, TasksAssignedAsTaskInitiator,
TasksAssignedAsBusinessAdministrator, SubTasksAssignedAsPotentialOwner
    at org.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:407)
    at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1341)
    at org.hibernate.cfg.AnnotationConfiguration.buildSessionFactory(AnnotationConfiguration.java:867)
    at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:669)
    ... 55 more


(2) java.lang.IllegalArgumentException: Named query not found: UnescalatedDeadlines
    at org.hibernate.ejb.AbstractEntityManagerImpl.createNamedQuery(AbstractEntityManagerImpl.java:108)
    at org.jbpm.task.service.TaskService.<init>(TaskService.java:109)
    at org.jbpm.task.service.TaskService.<init>(TaskService.java:92)

解决办法:src目录下加入 META-INF 文件夹, 将 jbpm-human-task-5.2.0.Final.jar 中的 Taskorm.xml 复制到 META-INF 下面, 并重命名为 orm.xml.


2. 问题二

java.lang.RuntimeException: Unable To initialise TaskService, could not find Operations DSL
    at org.jbpm.task.service.TaskService.<init>(TaskService.java:128)
    at org.jbpm.task.service.TaskService.<init>(TaskService.java:92)


==> 原因是 jbpm-human-task-5.2.0.Final.jar 中的 org.jbpm.task.service 包中没有 operations-dsl.mvel 文件。
如下源代码:
        // Search operations-dsl.mvel, if necessary using superclass if TaskService is subclassed
        InputStream is = null;
        for (Class c = getClass(); c != null; c = c.getSuperclass()) {
            is = c.getResourceAsStream("operations-dsl.mvel");
            if (is != null) {
                break;
            }
        }
        if (is == null) {
            throw new RuntimeException("Unable To initialise TaskService, could not find Operations DSL");
        }
        Reader reader = new InputStreamReader(is);
        try {
            operations = (Map<Operation, List<OperationCommand>>) eval(toString(reader),  vars);
        } catch (IOException e) {
            throw new RuntimeException("Unable To initialise TaskService, could not load Operations DSL");
        }

解决办法:在工程中新建包结构org.jbpm.task.service,并在其中加入从jbpm-human-task-5.1.0.Final.jar中的org.jbpm.task.service中的operations-dsl.mvel。
或者重新打包 jbpm-human-task-5.2.0.Final.jar 且在其中加入 operations-dsl.mvel 到 org.jbpm.task.service 包中。


3. 问题三
java.lang.LinkageError: loader constraint violation: when resolving interface method "javax.servlet.jsp.JspApplicationContext.getExpressionFactory()Ljavax/el/ExpressionFactory;" the class loader (instance of org/apache/jasper/servlet/JasperLoader) of the current class, org/apache/jsp/index_jsp, and the class loader (instance of org/apache/catalina/loader/StandardClassLoader) for resolved class, javax/servlet/jsp/JspApplicationContext, have different Class objects for the type javax/el/ExpressionFactory used in the signature

解决办法:删除 el-api.jar 即可。

4. 问题四

ERROR drools.persistence.SingleSessionCommandService.rollbackTransaction  - Could not commit session
java.lang.IllegalArgumentException: Named query not found: ProcessInstancesWaitingForEvent

    at org.hibernate.ejb.AbstractEntityManagerImpl.createNamedQuery(AbstractEntityManagerImpl.java:108)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)


解决办法: src --> META-INF --> orm.xml 中加入
    <named-query name="ProcessInstancesWaitingForEvent">
        <query>
            select
            processInstanceInfo.processInstanceId
            from
            ProcessInstanceInfo processInstanceInfo join processInstanceInfo.eventTypes eventTypes
            where
            eventTypes = :type
          </query>
    </named-query>


整合Hibernate4.2.x的时候碰到的问题
1. Could not determine type for: java.util.Set, at table: ProcessInstanceInfo, for columns: [org.hibernate.mapping.Column(eventTypes)]
https://community.jboss.org/message/643956Peter Brewer的解决方

2. javax.persistence.spi.PersistenceUnitInfo.getValidationMode()
解决一: http://openjpa.208410.n2.nabble.com/Error-running-on-Spring-3-td5781867.html
解决二 http://blog.csdn.net/lusi64/article/details/7717072
我是这样解决
使用这个http://mvnrepository.com/artifact/org.hibernate.javax.persistence/hibernate-jpa-2.0-api,替换jpa1.0的包。
先使用:
<dependency>
			<groupId>org.hibernate.javax.persistence</groupId>
			<artifactId>hibernate-jpa-2.0-api</artifactId>
			<version>1.0.1.Final</version>
		</dependency>

再排除依赖
<dependency>
			<groupId>org.drools</groupId>
			<artifactId>drools-spring</artifactId>
			<version>${drools.version}</version>
			<exclusions>
				<exclusion>
					<groupId>javax.persistence</groupId>
					<artifactId>persistence-api</artifactId>
				</exclusion>
			</exclusions>
		</dependency>

drools-persistence-jpa,drools-spring,jbpm-human-task, jbpm-bam都要排除

你可能感兴趣的:(jboss)