1. 结束实例错误
Configuration con=new Configuration();
ProcessEngine pe=con.buildProcessEngine();
pe.getRepositoryService().createDeployment()
.addResourceFromClasspath("org/jbpm/examples/end/state/process.jpdl.xml")
.deploy();
ExecutionService executionService=pe.getExecutionService();
ProcessInstance processInstance = executionService.startProcessInstanceByKey("gonggu");
String pid = processInstance.getId();
processInstance = executionService.signalExecutionById(pid,"400");
System.out.println(processInstance.isEnded());
executionService.signalExecutionById(pid,"400"),
错误如下:
结束流程实例时候错误:
org.hibernate.exception.ConstraintViolationException: could not delete: [org.jbpm.pvm.internal.model.ExecutionImpl#7]
。。。。。
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:602)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
at java.lang.Thread.run(Unknown Source)
Caused by: com.mysql.jdbc.exceptions.MySQLIntegrityConstraintViolationException: Cannot delete or update a parent row: a foreign key constraint fails (`jbpm4`.`jbpm4_execution`, CONSTRAINT `FK_EXEC_INSTANCE` FOREIGN KEY (`INSTANCE_`) REFERENCES `jbpm4_execution` (`DBID_`))
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:931)
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:2985)
at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1631)
at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:1723)
at com.mysql.jdbc.Connection.execSQL(Connection.java:3283)
at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:1332)
at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:1604)
at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:1519)
....
解决办法:
将hibernate的配置中数据库方言修改为 org.hibernate.dialect.MySQLInnoDBDialect。
但是针对于jbpm4.3版本中解决上述问题:使用MySQLInnoDBDialect 方言,在初始化jbpm4的支持数据库时候会出现以下错误:
jBPM4.4 no jBPM DB schema: no JBPM4_EXECUTION table. Run the create.jbpm.schema target first in the install tool.
分析:
JBPM初始化建立表格时create语句错误,如下:
create table JBPM4_DEPLOYMENT (
DBID_ bigint not null ,
NAME_ longtext,
TIMESTAMP_ bigint,
STATE_ varchar(255),
primary key (DBID_)
) type=InnoDB
关键在于这个创建表格的语句在Navicat Lite中执行该条SQL语句也同样报错,type=InnoDB不符合语法,我的mysql版本是5.5的,
之后发现,MySQL 4.0开始不建议使用type=InnoDB,建议使用Engine=InnoDB,而MySQL 5.5只能用Engine=InnoDB
解决方案:
首先普及一下jbpm4.4创建默认表格的方法是有两种方法的,第一种是通过ant命令在dos窗口建立(用的是jbpm-4.4/install/src/db/create/jbpm.mysql.create.sql的sql语句创建的); 另一种是通过代码,运行java代码,自动创建的(这种则是在你配好java项目之后利用项目里的默认配置来创建默认表格的)。
关键是两种方法所用到的文件是不同的,认清这点这个很重要。
好了接下来咱说解决方案:
方案1.修改jbpm-4.4/install/src/db/create/jbpm.mysql.create.sql中的脚本:
将其中的type=InnoDB改为Engine=InnoDB
(这种方法适用于用ant命令创建表格的方式,这也是为什么我之前用这种方法之后在java代码中创建表格不成功的原因了 )
方案2.安装MySQL Server 5.1
(第二种方法比较彻底,读者推荐)
2.集成到javaEE的页面时候错误:
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
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:275)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
不难发现是由于解析jsp文件的类有两个,java不知道使用哪个解析jsp文件造成的。
解决方法:1. 删除你项目中WEB-INF/lib目录下的三个jar包(juel.jar, juel-engine.jar, juel-impl.jar )。
2. 将三个jar包(juel.jar, juel-engine.jar, juel-impl.jar )拷贝到${tomcate 1.6}/lib目录下。