刘政道 - 应用程序框架

《31天学会CRM项目开发(C#编程入门及项目实战)》作者,IT经理,程序员
  博客园  :: 新随笔  :: 联系 :: 管理

null Nested exception: null

Posted on 2010-01-28 16:37  刘政道  阅读(2598)  评论(0编辑  收藏  举报

(44480 ms) [http-80-12] ERROR: org.jbpm.jpdl.xml.JpdlXmlReader#readProcessDefinition : couldn't parse process definition org.dom4j.DocumentException: null Nested exception: null

原来使用的是ProcessDefinition pDef = ProcessDefinition.parseXmlResource(xmlPath),
系 统就抱这个错,后来将parseXmlResource改成parseXmlString,将xml的内容读出来存在字符串中xml,这个错误居然解决 了。
ProcessDefinition pDef = ProcessDefinition.parseXmlString(xml);

其实,这两个方法在windows下面都没有问题,但是在linux环境下 parseXmlResource就不好使,具体的也不知道什么原因。

如果你 的xml中有中文的话,可能会报错,当时流程部署应该是没有错误的。
此时,你读取xml文件 时,可能要指定字符编码,如UTF-8。
BufferedReader input = new BufferedReader(new InputStreamReader(new FileInputStream(path),"UTF-8"));

原来这样的代码也会导致上述错误,Element root = DocumentHelper.parseText(new String(gpdBytes)).getRootElement();

应为我的gpd.xml中有中文,所以代码应该改成
Element root = DocumentHelper.parseText(new String(gpdBytes,"GBK")).getRootElement();