1.執行流程出現如下錯誤:
org.jbpm.pvm.internal.type.variable.UnpersistableVariable
出現錯誤的原因:
變數沒有實現 Serializable 介面
解決辦法:
變數需要實現 Serializable 介面。
2.java.lang.ClassCastException: $Proxy53 cannot be cast to oracle.sql.BLOB
出現錯誤原因:
我使用的是Hibernate 3.6版本。
解決辦法:
在網上查到解決辦法 使用 hibernate3.5.4替換3.6.
3.項目啟動第一次訪問,發布流程沒問題。但是第二次啟動項目,再發布一個新流程的時候報如下錯誤.
2010-10-14 19:51:58,234 ERROR [org.hibernate.util.JDBCExceptionReporter] - 流已被關閉
org.hibernate.exception.GenericJDBCException: could not initialize a collection: [org.jbpm.pvm.internal.repository.DeploymentImpl.resources#1]
出現錯誤的原因是:
hibernate自動建立資料庫時,設定檔中某些欄位被hibernate解析成long類型。
在產生表後手動將LONG類型修改為字串類型。
4.在發布流程的時候 使用addResourceFromString方法發布流程,資源名稱應該是 以 .jpdl.xml 結尾的。
如果不是發布會不成功。
5.流程定義檔案讀取亂碼的問題。
使用PL/SQL直接在資料庫中查看是亂碼,以為是Hibernate的問題。發現其他的資料都是正常的。
java.io.InputStream ss = repositoryService.getResourceAsStream(deployment,"process.jpdl.xml");
//在這裡指定字元編碼UTF-8。
BufferedReader in = new BufferedReader(new InputStreamReader(ss,"UTF-8"));
StringBuffer buffer = new StringBuffer();
while ((line = in.readLine()) != null){
buffer.append(line);
}
6.取得我的工作和候選任務。
jbpm 中我是用hql擷取自己的當前任務和候選任務,發現重複記錄使用distinct出錯,發現出錯的原因是在JBPM4_TASK表中的欄位為clob類型,我將其修改成nvarchar類型,再使用distinct查詢問題解決了。
StringBuffer hqlSb = new StringBuffer();
hqlSb.append("select distinct task from org.jbpm.pvm.internal.task.TaskImpl task left join task.participations pt where task.assignee=?");
hqlSb.append(" or task.assignee is null and ((pt.type = 'candidate' and pt.userId =? ) ");
if (groups.length()> 0) {
hqlSb.append(" or pt.groupId in (" +groups + ")");
}
hqlSb.append(")");
hqlSb.append(" order by task.createTime desc");