4

.xlsx ファイルへの書き込み中に JVM がクラッシュします。同じためにPOI(XSSF)を使用しています。コードのエラー位置ポイントは書き込みですmethod--> workBook.write(fileOutputStream);

コンソールで私は得る..

A fatal error has been detected by the Java Runtime Environment:
  SIGBUS (0x7) at pc=0xb68d77f3, pid=14653, tid=1849355120
  JRE version: 7.0_04-b20
 Java VM: Java HotSpot(TM) Server VM (23.0-b21 mixed mode linux-x86 )
 Problematic frame:
 C  [libzip.so+0x47f3]  newEntry+0x73
 Failed to write core dump. Core dumps have been disabled. To enable core dumping, try "ulimit -c unlimited" before starting Java again
 If you would like to submit a bug report, please visit:
   http://bugreport.sun.com/bugreport/crash.jsp
 The crash happened outside the Java Virtual Machine in native code.
 See problematic frame for where to report the bug.
4

3 に答える 3

10

これに対して私が見つけた解決策はWorkbook、 .を保存するためFileに. 代わりに、を使用してを開きます。FileOutputStreamWorkbookFileInputStreamWorkbook

このようなものは問題なく動作します

        File inputFile = new File("Your-Path");
        this.inputStream = new FileInputStream(inputFile);
        this.opc = OPCPackage.open(this.inputStream);
        this.workbook = WorkbookFactory.create(opc);

...

        this.outputStream = new FileOutputStream(inputFile);
        this.workbook.write(this.outputStream);

開いているすべてのストリームとOPCPackage.

于 2013-06-26T19:53:57.913 に答える