在流程定义后需要对流程定义文件发布到数据库中,在学习过程中我使用的是以下的方法,当然在实际开发中不会是这样的,不过应该也类似,后面可能会介绍. 具体的发布代码如下: package com.worldunion.test; import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.IOException; import java.io.InputStream; import java.util.zip.ZipInputStream; import org.jbpm.JbpmConfiguration; import org.jbpm.JbpmContext; import org.jbpm.graph.def.ProcessDefinition; public class DeploymentTest { public static void main(String[] args) throws IOException{ // String archiveFile = "D:/Development/jbpm/jbpmWeb/processes/payment/payment.rar"; // deploy(archiveFile); String path = "D:/Development/jbpm/jbpmWeb03/processes/purchase/purchase.rar"; deploy(path); } private static void deploy(String archiveFile) throws IOException{ JbpmContext jbpmContext = JbpmConfiguration.getInstance().createJbpmContext(); try{ InputStream is = new FileInputStream(new File(archiveFile)); ZipInputStream zis = new ZipInputStream(is); ProcessDefinition pd = ProcessDefinition.parseParZipInputStream(zis); jbpmContext.deployProcessDefinition(pd); zis.close(); is.close(); System.out.println("--------------------------------------"); System.out.println("发布成功!!!!"); System.out.println("--------------------------------------"); }finally{ jbpmContext.close(); } } } 希望对看到的你有所帮助!!!