at java.io.FileInputStream.open (Native Method)
at java.io.FileInputStream
at org.apache.jsp.deploy_jsp._jspService (deploy_jsp.java: 83)
at org.apache.jasper.runtime.HttpJspBase.service (HttpJspBase.java: 70)
at javax.servlet.http.HttpServlet.service (HttpServlet.java: 717)
at org.apache.jasper.servlet.JspServletWrapper.service (JspServletWrapper.java: 374)
at org.apache.jasper.servlet.JspServlet.serviceJspFile (JspServlet.java: 342)
at org.apache.jasper.servlet.JspServlet.service (JspServlet.java: 267)
at javax.servlet.http.HttpServlet.service (HttpServlet.java: 717)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter (ApplicationFilterChain.java: 290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter (ApplicationFilterChain.java: 206)
at org.apache.catalina.core.StandardWrapperValve.invoke (StandardWrapperValve.java: 233)
at org.apache.catalina.core.StandardContextValve.invoke (StandardContextValve.java: 191)
at org.apache.catalina.core.StandardHostValve.invoke (StandardHostValve.java: 128)
at org.apache.catalina.valves.ErrorReportValve.invoke (ErrorReportValve.java: 102)
at org.apache.catalina.core.StandardEngineValve.invoke (StandardEngineValve.java: 109)
at org.apache.catalina.connector.CoyoteAdapter.service (CoyoteAdapter.java: 293)
at org.apache.coyote.http11.Http11Processor.process (Http11Processor.java: 849)
at org.apache.coyote.http11.Http11Protocol $ Http11ConnectionHandler.process (Http11Protocol.java: 583)
at org.apache.tomcat.util.net.JIoEndpoint $ Worker.run (JIoEndpoint.java: 454)
at java.lang.Thread.run (Thread.java: 619)
<%@ page language="java" contentType="text/html; charset=gb2312"%>
<%@page import="java.io.File,java.io.FileInputStream,java.io.InputStream,java.util.zip.ZipInputStream,java.util.*,org.jbpm.api.*,java.util.zip.*"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Insert title here</title>
</head>
<body>
<%
request.setCharacterEncoding("UTF-8");
response.setCharacterEncoding("UTF-8");
String deployFile = request.getParameter("processDef");
if (deployFile != null && deployFile != "") {
//必须使用的,流程引擎
ProcessEngine processEngine = Configuration.getProcessEngine();
RepositoryService repositoryService = processEngine
.getRepositoryService();
try {
String file = deployFile;
//将ZIP文件封转到IO流里
File file1 = new File(file);
InputStream is = new FileInputStream(file1);
out.println("到这了"+file);
ZipInputStream zis = new ZipInputStream(is);
//将ZIP流程文件发布到pvm(流程虚拟机中,他会把ZIP包中的xml文件和png图片存储到数据库中)
repositoryService.createDeployment().addResourcesFromZipInputStream(zis).deploy();
zis.close();
is.close();
out.println("发布流程成功<br />");
out.println("<a href='task-write.jsp'>返回</a><br />");
} catch (Exception e) {
e.printStackTrace();
out.println("发布流程失败");
}
}
%>
<script type="text/javascript">
function readFile(obj) {
document.getElementById("file").value = obj.value;
}
</script>
<font color="red">可直接发布zip文件</font><br />
<form name="form1" method="post" action="deploy.jsp"><label>
发布流程文件 <input id="file" type="file" name="processDef" onchange="readFile(this)">
</label> <label> <input type="submit" name="Submit" value="提交">
</label></form>
</body>
</html>
to this sentence being given InputStream is = new FileInputStream (file1);
------ Solution --------------- -----------------------------
this issue of the output file path to find out why
--- --- Solution --------------------------------------------
FORM types need to be defined , such as :
没有评论:
发表评论