好吧,我将我的开发电脑从 Windows 7 升级到了 Windows 10。当我尝试运行以前可以运行的应用程序时,它会产生一个奇怪的错误。
我使用BIPublisher.FOprocessor生成用于报告的 pdf。我将 jdk7 与 Netbeans8.0.2 IDE 一起使用,我的 Web 应用程序在 Apache Tomcat 7.0.27 上运行
当我尝试生成pdf时
//Now process the XSLFO template against the XML data
// Instantiate the FOprocessor
FOProcessor processor = new FOProcessor();
// set CFG input file
processor.setConfig(sourceFileLocation + "xdo.cfg");
// set XML input file
processor.setData(sourceOutputFileLocation + inputXMLFile);
// set XSL input file
processor.setTemplate(sourceOutputFileLocation + inputXSLFile);
// set the output format
if (fOutputFormat.equalsIgnoreCase(".pdf")) {
processor.setOutputFormat(FOProcessor.FORMAT_PDF);
} else if (fOutputFormat.equalsIgnoreCase(".html")) {
processor.setOutputFormat(FOProcessor.FORMAT_HTML);
} else if (fOutputFormat.equalsIgnoreCase(".xls")) {
processor.setOutputFormat(FOProcessor.FORMAT_EXCEL);
} else if (fOutputFormat.equalsIgnoreCase(".rtf")) {
processor.setOutputFormat(FOProcessor.FORMAT_RTF);
} else {
processor.setOutputFormat(FOProcessor.FORMAT_PDF);
outputFile = Fname + rInt + ".pdf";
}
//set output file
processor.setOutput(outputLocation + outputFile);
processor.generate(); //HERE IS THE EXCEPTION
我得到以下异常
WARNING: oracle.xdo.XDOIOException: java.io.IOException: Access is denied
at oracle.xdo.template.FOProcessor.getTmpFOFile(FOProcessor.java:2003)
at oracle.xdo.template.FOProcessor.createFO(FOProcessor.java:1971)
at oracle.xdo.template.FOProcessor.generate(FOProcessor.java:1117)
at admin.reports.XMLpublisher.foProcessorEngine(XMLpublisher.java:97)
at admin.reports.XMLpublisher.XMLout_CreateDocument(XMLpublisher.java:371)
at admin.db.TR.DownloadAttendeeLunchList.getReport(DownloadAttendeeLunchList.java:101)
at admin.db.TR.DownloadAttendeeLunchList.processRequest(DownloadAttendeeLunchList.java:42)
at admin.db.TR.DownloadAttendeeLunchList.doGet(DownloadAttendeeLunchList.java:128)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:621)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at com.opcat.gzip.GZIPFilter.doFilter(GZIPFilter.java:36)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:225)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:169)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:168)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:98)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:927)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:407)
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:999)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:565)
at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:309)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:745)
Caused by: java.io.IOException: Access is denied
at java.io.WinNTFileSystem.createFileExclusively(Native Method)
at java.io.File.createTempFile(File.java:2001)
at oracle.xdo.common.tmp.TmpFile.createTmpFile(TmpFile.java:85)
at oracle.xdo.template.FOProcessor.getTmpFOFile(FOProcessor.java:1999)
... 28 more
Feb 25, 2016 1:02:57 PM oracle.xdo.template.FOProcessor
SEVERE: End Memory: max=2709MB, total=872MB, free=117MB
到目前为止,我尝试了很多解决方案,但没有一个有效:
- 授予输出目录的权限
- 将输出目录从根目录移开 (c:)
- 以管理员身份运行我的 Tomcat
- 授予用户对我的本地驱动器的完全权限
我没主意了。任何人都知道这里的问题是什么?显然,代码不是问题,因为它在 Windows 7 中运行正常,并且在我的生产环境中部署了 Windows Server 2008。