[英]Xpages runtime error: 'java class java.lang.IllegalStateException: Access denied (java.lang.RuntimePermission getClassLoader)'
I am trying to call 'new XWPFDocument(inStream);' 我试图调用'new XWPFDocument(inStream);' in a java class in an XPages application.
在XPage应用程序的java类中。 The XWPFDocument class is part of the Apache POI library.
XWPFDocument类是Apache POI库的一部分。 However when it gets to the call to this constructor at runtime, I get the following stack trace:
但是当它在运行时调用此构造函数时,我得到以下堆栈跟踪:
11/02/2014 20:57:02 HTTP JVM: java.lang.IllegalStateException: Access denied (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.load(POIXMLDocument.java:159) ... 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)...
I have added all the necessary jar files to the 'Web Content/WEB INF/lib' folder under package explorer, and subsequently added them to the project's java build path. 我已将所有必需的jar文件添加到package explorer下的'Web Content / WEB INF / lib'文件夹中,然后将它们添加到项目的java构建路径中。 Am I missing something?
我错过了什么吗?
The code around the call is: 呼叫周围的代码是:
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);
}
}
Add to Domino server's jvm/lib/security/java.policy
file 添加到Domino服务器的
jvm/lib/security/java.policy
文件
grant codeBase "xspnsf://server:0/<application>.nsf/WEB-INF/lib/*" {
permission java.lang.RuntimePermission "getClassLoader";
}
or put the jar files into Domino server's trusted folder jvm/lib/ext
. 或者将jar文件放入Domino服务器的可信文件夹
jvm/lib/ext
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.