首页上一页 1 下一页尾页 1 条记录 1/1页
Java Web编程宝典十年典藏版 第21章 博客,上传功能问题,请明日的大侠帮忙解答一下,谢谢!
发表在JavaWeb图书答疑
2011-04-01
是否精华
是
否
版块置顶:
是
否
上传视频时tomcat抛出异常,我觉得应该是上传路径的问题。
上传功能MediaServler类的上传文件路径代码:
String serialName = String.valueOf(System.currentTimeMillis());
String basePath = getServletContext().getRealPath("\\videos\\")+ "\\"; // 获取Web应用的实际存放路径
String upFilePath = basePath + "temp\\" + serialName + "."+ upfile.getFileExt();
String flvFilePath = basePath+ serialName + ".flv"; // 设置转换为flv格式后文件的保存路径
String cutPicPath = basePath +serialName + ".jpg"; // 设置从上传的视频中截取的图片的保存路径
upfile.saveAs(upFilePath, File.SAVEAS_PHYSICAL); // 保存文件到磁盘中,作为临时文件
上传后抛出异常的代码如下:
catch (Exception e3) {
message = "<li>操作失败!</li>";
e3.printStackTrace();
}
抛出异常后tomcat的具体信息如下:
java.lang.IllegalArgumentException: This path does not exist (1135).
at com.jspsmart.upload.SmartUpload.getPhysicalPath(SmartUpload.java:1128)
at com.jspsmart.upload.File.saveAs(File.java:91)
at com.mr.servlet.MediaServlet.doInsert(MediaServlet.java:54)
at com.mr.servlet.MediaServlet.doGet(MediaServlet.java:27)
at com.mr.servlet.MediaServlet.doPost(MediaServlet.java:33)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:637)
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:127)
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:298)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:859)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:588)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
at java.lang.Thread.run(Thread.java:662)
上传功能MediaServler类的上传文件路径代码:
String serialName = String.valueOf(System.currentTimeMillis());
String basePath = getServletContext().getRealPath("\\videos\\")+ "\\"; // 获取Web应用的实际存放路径
String upFilePath = basePath + "temp\\" + serialName + "."+ upfile.getFileExt();
String flvFilePath = basePath+ serialName + ".flv"; // 设置转换为flv格式后文件的保存路径
String cutPicPath = basePath +serialName + ".jpg"; // 设置从上传的视频中截取的图片的保存路径
upfile.saveAs(upFilePath, File.SAVEAS_PHYSICAL); // 保存文件到磁盘中,作为临时文件
上传后抛出异常的代码如下:
catch (Exception e3) {
message = "<li>操作失败!</li>";
e3.printStackTrace();
}
抛出异常后tomcat的具体信息如下:
java.lang.IllegalArgumentException: This path does not exist (1135).
at com.jspsmart.upload.SmartUpload.getPhysicalPath(SmartUpload.java:1128)
at com.jspsmart.upload.File.saveAs(File.java:91)
at com.mr.servlet.MediaServlet.doInsert(MediaServlet.java:54)
at com.mr.servlet.MediaServlet.doGet(MediaServlet.java:27)
at com.mr.servlet.MediaServlet.doPost(MediaServlet.java:33)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:637)
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:127)
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:298)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:859)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:588)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
at java.lang.Thread.run(Thread.java:662)