java.lang.ArrayIndexOutOfBoundsException: 145012
com.jspsmart.upload.SmartUpload.getDataHeader(SmartUpload.java:857)
com.jspsmart.upload.SmartUpload.upload(SmartUpload.java:259)
org.apache.jsp.manage.cp.productaddcheck_jsp._jspService(productaddcheck_jsp.java:68)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:94)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:324)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
上面这个是错误 在自己tomcat测试是完全好使的 但是传到虚机上以后 第一次上传是好使的 但是再传就开始报错误了!有谁用过,请帮忙下解决问题!  急等!~

解决方案 »

  1.   

    java.lang.ArrayIndexOutOfBoundsException: 145012
    这个exception是数组越界,
    楼主可以仔细看看上传的过程中哪些变量使用了
    数组,能不能将源码贴出来啊?
    对了,在虚拟机上重新部署或将tomcat重启,还是那种问题?
      

  2.   

     很不幸的是 客户租用的虚机没办法重起啊!~   在FTP上重新保存一下 又恢复到原来的样子 - -  这个exception 我也知道是数据越界  但是因为从来没碰见过 在服务器上根本追踪不到.class 文件 在我自己的tomcat上测试 就根本没问题! 所以 一直也没解决了!   哪位高人请给下指点!  下面是check页的源代码 写的有点糙!<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
    <%@ page import="com.jspsmart.upload.*, java.util.*,java.io.*,com.jspsmart.upload.File" %>
    <%@ page import="com.zhiji.products.*"%>
    <html>
      <head>
        <title>My JSP 'saveFile.jsp' starting page</title>
        
      </head>
      
      <body><%  //实例化上载bean
        com.jspsmart.upload.SmartUpload mySmartUpload=new com.jspsmart.upload.SmartUpload();
        //初始化
        mySmartUpload.initialize(pageContext); 
        //设置上载的最大值
        mySmartUpload.setMaxFileSize(500 * 1024*1024);
        //上载文件
        mySmartUpload.upload();
       //循环取得所有上载的文件
       for (int i=0;i<mySmartUpload.getFiles().getCount();i++){//取得上载的文件
       com.jspsmart.upload.File myFile = mySmartUpload.getFiles().getFile(i);
       if (!myFile.isMissing())
        {
       //取得上载的文件的文件名
        String myFileName=myFile.getFileName();
        //取得不带后缀的文件名
        String  suffix=myFileName.substring(0,myFileName.lastIndexOf('.'));
        //取得后缀名
        String  ext= mySmartUpload.getFiles().getFile(0).getFileExt();  
        //取得文件的大小  
        int fileSize=myFile.getSize();
        //保存路径
    String session_id = request.getSession().getId();
        String aa=getServletContext().getRealPath("/")+"upload/";
    String reName = session_id + (new Date()).getTime() + "."
    + ext;
        String trace=aa+reName;
       //将文件保存在服务器端 
        myFile.saveAs(trace,mySmartUpload.SAVE_PHYSICAL);

         //取得别的参数
        String explain=(String)mySmartUpload.getRequest().getParameter("text");
        String send=(String)mySmartUpload.getRequest().getParameter("send"); String p_comm=reName; 
    ProductList pd = new ProductList();
    pd.setO1_tid((String)mySmartUpload.getRequest().getParameter("O1_id"));
    pd.setO2_id((String)mySmartUpload.getRequest().getParameter("O2_id"));
    pd.setP_cname((String)mySmartUpload.getRequest().getParameter("p_cname"));
    pd.setP_ic((String)mySmartUpload.getRequest().getParameter("p_ic"));
    pd.setP_pc((String)mySmartUpload.getRequest().getParameter("p_pc"));
    pd.setP_bvcbo((String)mySmartUpload.getRequest().getParameter("p_bvcbo"));
    pd.setP_bvceo((String)mySmartUpload.getRequest().getParameter("p_bvceo"));
    pd.setP_hfe((String)mySmartUpload.getRequest().getParameter("p_hfe"));
    pd.setP_if((String)mySmartUpload.getRequest().getParameter("p_if"));
    pd.setP_vrrm((String)mySmartUpload.getRequest().getParameter("p_vrrm"));
    pd.setP_trr((String)mySmartUpload.getRequest().getParameter("p_trr"));
    pd.setP_it((String)mySmartUpload.getRequest().getParameter("p_it"));
    pd.setP_igt((String)mySmartUpload.getRequest().getParameter("p_igt"));
    pd.setP_vdrm((String)mySmartUpload.getRequest().getParameter("p_vdrm"));
    pd.setP_vtm((String)mySmartUpload.getRequest().getParameter("p_vtm")); pd.setP_vf((String)mySmartUpload.getRequest().getParameter("p_vf"));
    pd.setP_fz((String)mySmartUpload.getRequest().getParameter("p_fz"));
    pd.setP_cs((String)mySmartUpload.getRequest().getParameter("p_cs"));
    pd.setP_td((String)mySmartUpload.getRequest().getParameter("p_td"));
    pd.setP_content((String)mySmartUpload.getRequest().getParameter("p_content"));
    pd.setP_type((String)mySmartUpload.getRequest().getParameter("p_type"));
    pd.setP_image((String)mySmartUpload.getRequest().getParameter("p_image"));
    pd.setP_comm(p_comm);
    ProductDo po = new ProductDo();
    try {
    po.addProduct(pd);
    } catch (Exception e) {
    // TODO Auto-generated catch block
    e.printStackTrace();
    }
         out.print("<script>");
    out.print("alert('upload is ok ');");
    out.print("history.back(-1);");
    out.print("</script>");
       }
       else 
       { out.print("<script>");
    out.print("alert('sorry ');");
    out.print("history.back(-1);");
    out.print("</script>");

       }//与前面的if对应
    %>
      
      </body>
    </html>java.lang.ArrayIndexOutOfBoundsException: 145012 
    com.jspsmart.upload.SmartUpload.getDataHeader(SmartUpload.java:857) 
    com.jspsmart.upload.SmartUpload.upload(SmartUpload.java:259) 
    org.apache.jsp.manage.cp.productaddcheck_jsp._jspService(productaddcheck_jsp.java:68) 
    org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:94) 
    javax.servlet.http.HttpServlet.service(HttpServlet.java:802) 
    org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:324) 
    org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292) 
    org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236) 
    javax.servlet.http.HttpServlet.service(HttpServlet.java:802)