我用poi生成导出excel 在服务器端保存。
在自己XP系统里正常,
在测试的2003server服务器,
在运行服务器不能生成excel 文件。想了半天,代码都是一样的,
分不多了,大家帮忙找找原因吧!

解决方案 »

  1.   

    会不会是内存太小了。poi会报OutOfMemoryError错的这个不是异常,所以一般不捕获,建议楼主      try {
             book = new HSSFWorkbook(in);
          }
          catch(OutOfMemoryError e) {
             throw new Exception(e.getMessage);
          }
      

  2.   

    很可能时内存问题。POI经常会有这问题
      

  3.   

    原来的代码是
    FileOutputStream fileOut = new FileOutputStream(fileName);
    wb.write(fileOut);
    fileOut.close();
    现在是
    FileOutputStream fileOut = new FileOutputStream(fileName);
    try {wb.write(fileOut);}
    catch(Exception  e)
    {
      System.out.println("exception");
      throw e;
    }
    finally
    {
      System.out.println("finally");
    }
    fileOut.close();直接输出"finally"   但是能生成文件  能打印了  
    给小弟解释解释吧