簡體   English   中英

Ghost4J-EXCEPTION_ACCESS_VIOLATION(JVM崩潰)

[英]Ghost4J - EXCEPTION_ACCESS_VIOLATION (JVM is crashing)

我正在嘗試替換公司中使用的PDF轉換器,但是Ghost4J卻遇到了這個問題。 請注意,我的代碼與他們提供的示例非常相似...

我正在將Java SE 1.6(jrockit-jre1.6.0_33-R28.2.4)和Ghostscript 9.10用於Win 64位。

我的代碼是:

public void convertPostScriptToPDF() {
        File file= new File (this.getClass().getResource( "/resources/employer_report_last_page.ps").getFile());
        FileOutputStream fos = null;
        try{

            //load PostScript document
            PSDocument document = new PSDocument();
            document.load(file);        

            fos = new FileOutputStream(new File("rendition.pdf"));    
            //create converter
            PDFConverter converter = new PDFConverter();

            //set options
            converter.setPDFSettings(PDFConverter.OPTION_PDFSETTINGS_PREPRESS);

            //convert
            converter.convert(document, fos);

        } catch (Exception e) {
            System.out.println("ERROR: " + e.getMessage());
        } finally{
            IOUtils.closeQuietly(fos);
        }
    }

JVM崩潰,發生在“ converter.convert(document,fos);”上 在轉儲文件上顯示以下消息:

Error Message: Illegal memory access. [54]
Exception Rec: EXCEPTION_ACCESS_VIOLATION (00000000c0000005) at 0x0000000067ECE347 - memory at 0xFFFFFFFFFFFFFFFF could not be read.
Minidump     : Wrote mdmp. Size is 650MB
SafeDllMode  : -1
Version      : Oracle JRockit(R) R28.2.4-14-151097-1.6.0_33-20120618-1634-windows-x86_64
CPU          : Intel  SSE SSE2 SSE3 SSSE3 SSE4.1 SSE4.2 Intel64**strong text**
Number CPUs  : 4
Tot Phys Mem : 4110749696 (3920 MB)
OS version   : Microsoft Windows 7 version 6.1 Service Pack 1 (Build 7601) (64-bit)
Thread System: Windows Threads
Java locking : Lazy unlocking enabled (class banning) (transfer banning)
State        : JVM is running
Command Line : -Xms=512m -Xmx=512m -Dfile.encoding=Cp1252 -Dsun.java.command=org.eclipse.jdt.internal.junit.runner.RemoteTestRunner -version 3 -port 57292 -testLoaderClass org.eclipse.jdt.internal.junit4.runner.JUnit4TestLoader -loaderpluginname org.eclipse.jdt.junit4.runtime -test au.edu.nsw.det.reportgenerator.business.ReportManagerTest:convertPostScriptToPDF -Dsun.java.launcher=SUN_STANDARD org.eclipse.jdt.internal.junit.runner.RemoteTestRunner -version 3 -port 57292 -testLoaderClass org.eclipse.jdt.internal.junit4.runner.JUnit4TestLoader -loaderpluginname org.eclipse.jdt.junit4.runtime -test au.edu.nsw.det.reportgenerator.business.ReportManagerTest:convertPostScriptToPDF
Repository   : 
java.home    : C:\Program Files\Java\jrockit-jre1.6.0_33-R28.2.4
j.class.path : C:\EmployerReportGenerator\bin;C:\EmployerReportGenerator\lib\emp-model.jar;C:\EmployerReportGenerator\lib\ghost4j-0.5.0.jar;C:\EmployerReportGenerator\lib\commons-io-1.3.1.jar;C:\EmployerReportGenerator\lib\jna-platform-4.0.0.jar;C:\EmployerReportGenerator\lib\log4j-1.2.15.jar;C:\EmployerReportGenerator\lib\xmlgraphics-commons-1.4.jar;C:\EmployerReportGenerator\lib\commons-beanutils-1.8.3.jar;C:\EmployerReportGenerator\lib\commons-logging-1.1.1.jar;C:\EmployerReportGenerator\lib\itext-2.1.7.jar;C:\EmployerReportGenerator\lib\jna-3.3.0.jar;C:\projects\det\lib\jasperreports-1.2.8.jar;C:\projects\det\release\PDFGeneratorService-client-1.0.jar;C:\TBO\DependentJars\ojdbc14.jar;C:\oracle\oc4j10.1.3.2\j2ee\home\applib\rdbthin.jar;C:\projects\det\release\xmlCommon-1_0.jar;C:\projects\det\release\jet-3_0.jar;C:\eclipse\configuration\org.eclipse.osgi\bundles\797\1\.cp\lib\j2ee-1.3\ejb-api.jar;C:\eclipse\configuration\org.eclipse.osgi\bundles\797\1\.cp\lib\j2ee-1.3\jca-api.jar;C:\eclipse\configuration\org.eclipse.osgi\bundles\797\1\.cp\lib\j2ee-1.3\jms-api.jar;C:\eclipse\configuration\org.eclipse.osgi\bundles\797\1\.cp\lib\j2ee-1.3\jsp-api.jar;C:\eclipse\configuration\org.eclipse.osgi\bundles\797\1\.cp\lib\j2ee-1.3\jta-api.jar;C:\eclipse\configuration\org.eclipse.osgi\bundles\797\1\.cp\lib\j2ee-1.3\servlet-api.jar;C:\eclipse\configuration\org.eclipse.osgi\bundles\797\1\.cp\lib\j2ee-1.3\sql-api.jar;C:\eclipse\plugins\org.junit_4.10.0.v4_10_0_v20120426-0900\junit.jar;C:\eclipse\plugins\org.hamcrest.core_1.1.0.v20090501071000.jar;C:\projects\det\lib\commons-logging-1.1.jar;/C:/eclipse/configuration/org.eclipse.osgi/bundles/346/1/.cp/;/C:/eclipse/configuration/org.eclipse.osgi/bundles/979/1/.cp/
j.lib.path   : C:\Program Files\Java\jrockit-jre1.6.0_33-R28.2.4\bin;C:\Windows\system32;C:\Windows;C:\app\tfirmino\product\11.2.0\client_1;C:\app\tfirmino\product\11.2.0\client_1\bin;C:\oracle\product\10.2.0\client_1\bin;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\QuickTime\QTSystem\;C:\Program Files (x86)\Common Files\GTK\2.0\bin;C:\Program Files (x86)\cvsnt;C:\Program Files\Internet Explorer;C:\Program Files (x86)\SSH Communications Security\SSH Secure Shell;C:\Program Files\SlikSvn\bin;C:\Program Files (x86)\Sybase\Shared\PowerBuilder\;C:\Program Files (x86)\SSH Communications Security\SSH Secure Shell;C:\Users\thais.firmino\Application Data\SSH\UserKeys;C:\Python27;C:\Program Files\apache-maven-3.0.5\bin;C:\Program Files\Java\jdk1.7.0_17\bin;;.
JAVA_HOME    : C:\Program Files\Java\jdk1.7.0_17\
_JAVA_OPTIONS: <not set>
PATH         : C:\app\tfirmino\product\11.2.0\client_1;C:\app\tfirmino\product\11.2.0\client_1\bin;C:\oracle\product\10.2.0\client_1\bin;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\QuickTime\QTSystem\;C:\Program Files (x86)\Common Files\GTK\2.0\bin;C:\Program Files (x86)\cvsnt;C:\Program Files\Internet Explorer;C:\Program Files (x86)\SSH Communications Security\SSH Secure Shell;C:\Program Files\SlikSvn\bin;C:\Program Files (x86)\Sybase\Shared\PowerBuilder\;C:\Program Files (x86)\SSH Communications Security\SSH Secure Shell;C:\Users\thais.firmino\Application Data\SSH\UserKeys;C:\Python27;C:\Program Files\apache-maven-3.0.5\bin;C:\Program Files\Java\jdk1.7.0_17\bin;
StackOverFlow: 0 StackOverFlowErrors have occured
OutOfMemory  : 0 OutOfMemoryErrors have occured
C Heap       : Good; no memory allocations have failed
GC Strategy  : Mode: throughput, with strategy: genparpar (basic strategy: genparpar)
GC Status    : OC is not running. Last finished OC was OC#0.
             : YC is not running. Last finished YC was YC#0.        

有任何想法嗎? 預先謝謝泰國人

我的想法是,我的問題在某種程度上與Windows OS上的UAC有關,如http://www.java.com/en/download/help/exception_access.xml所述 ,但按建議進行更改並不能解決問題。 無論如何,通過一種變通辦法,我的問題得以解決。 參見下文,我使用的是核心API而不是高級API:

public void convert() {

        //get Ghostscript instance
        Ghostscript gs = Ghostscript.getInstance();

        File file= new File (this.getClass().getResource( "/resources/employer_report_last_page2.ps").getFile());//(Config.EMP_REPORT.REPORT_LAST_PAGE_STORE_PATH);
       // File file= new File (this.getClass().getResource( "/resources/Issues.ps").getFile());

        //prepare Ghostscript interpreter parameters
        //refer to Ghostscript documentation for parameter usage
        String[] gsArgs = new String[10];
        gsArgs[0] = "-ps2pdf";
        gsArgs[1] = "-dNOPAUSE";
        gsArgs[2] = "-dBATCH";
       gsArgs[3] = "-dSAFER";
        gsArgs[4] = "-sDEVICE=pdfwrite";
        gsArgs[5] = "-sOutputFile=output2.pdf";//output file name
       // gsArgs[5] = "-sOutputFile=" + file.getAbsolutePath();
        gsArgs[6] = "-c";
        gsArgs[7] = ".setpdfwrite";
        gsArgs[8] = "-f";
       // gsArgs[9] = "input.ps";//input file name
        gsArgs[9] = file.getAbsolutePath();//input file name

        //execute and exit interpreter
        try {

            gs.initialize(gsArgs);               
            gs.exit();

        } catch (GhostscriptException e) {
            System.out.println("ERROR: " + e.getMessage());
        }
 }

公共同步void convertPostScriptToPDF()

要么

公共無效convertPostScriptToPDF(){已同步(this){...}}

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM