簡體   English   中英

Xpages運行時錯誤:'java class java.lang.IllegalStateException:Access denied(java.lang.RuntimePermission getClassLoader)'

[英]Xpages runtime error: 'java class java.lang.IllegalStateException: Access denied (java.lang.RuntimePermission getClassLoader)'

我試圖調用'new XWPFDocument(inStream);' 在XPage應用程序的java類中。 XWPFDocument類是Apache POI庫的一部分。 但是當它在運行時調用此構造函數時,我得到以下堆棧跟蹤:

11/02/2014 20:57:02 HTTP JVM:java.lang.IllegalStateException:拒絕訪問(java.lang.RuntimePermission getClassLoader)11/02/2014 20:57:02 HTTP JVM:at org.apache.xmlbeans.XmlBeans .getContextTypeLoader(XmlBeans.java:336)11/02/2014 20:57:02 HTTP JVM:at org.openxmlformats.schemas.wordprocessingml.x2006.main.DocumentDocument $ Factory.parse(Unknown Source)11/02/2014 20 :57:02 HTTP JVM:at org.apache.poi.xwpf.usermodel.XWPFDocument.onDocumentRead(XWPFDocument.java:134)11/02/2014 20:57:02 HTTP JVM:at org.apache.poi.POIXMLDocument。加載(POIXMLDocument.java:159)...

我已將所有必需的jar文件添加到package explorer下的'Web Content / WEB INF / lib'文件夾中,然后將它們添加到項目的java構建路徑中。 我錯過了什么嗎?

呼叫周圍的代碼是:

        OutputStream outStream = response.getOutputStream();
        InputStream inStream = null;
        EmbeddedObject embeddedObj = null;
        XWPFDocument document = null;

        if (attachments.size() > 0) {
            String attachmentName = attachments.get(0).toString();
            embeddedObj = downloadDocument.getAttachment(attachmentName);
            if (embeddedObj != null) {
                inStream = embeddedObj.getInputStream();
                document = new XWPFDocument(inStream);
                inStream.close();

                document.write(outStream);
            }
        }

添加到Domino服務器的jvm/lib/security/java.policy文件

grant codeBase "xspnsf://server:0/<application>.nsf/WEB-INF/lib/*" {
    permission java.lang.RuntimePermission "getClassLoader";
}

或者將jar文件放入Domino服務器的可信文件夾jvm/lib/ext

暫無
暫無

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

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