I was able to reach out to IBM for some help here. To update for posterity: If anyone else runs across this issue while using Lotus/Domino environment, locate the java.policy file in both the Domino and Notes file paths by drilling down to "jvm\lib\security" folders. Edit both of the java.policy files to add the line: *permission java.lang.reflect.ReflectPermission "suppressAccessChecks","";* to the default permissions granted to all domains section.
On Wed, Aug 26, 2015 at 4:35 PM Tolen Miller <[email protected]> wrote: > forgot stack trace... > > *Exception in thread "AgentThread: JavaAgent" > java.security.AccessControlException: Access denied > (java.lang.RuntimePermission createSecurityManager)* > * at java.security.AccessController.throwACE(AccessController.java:100)* > * at > java.security.AccessController.checkPermission(AccessController.java:174)* > * at java.lang.SecurityManager.checkPermission(SecurityManager.java:544)* > * at > COM.ibm.JEmpower.applet.AppletSecurity.superDotCheckPermission(AppletSecurity.java:1449)* > * at > COM.ibm.JEmpower.applet.AppletSecurity.checkRuntimePermission(AppletSecurity.java:1311)* > * at > COM.ibm.JEmpower.applet.AppletSecurity.checkPermission(AppletSecurity.java:1611)* > * at > COM.ibm.JEmpower.applet.AppletSecurity.checkPermission(AppletSecurity.java:1464)* > * at java.lang.SecurityManager.<init>(SecurityManager.java:294)* > * at JavaAgent$MySecurityManager.<init>(JavaAgent.java:159)* > * at JavaAgent$MySecurityManager.<init>(JavaAgent.java:159)* > * at JavaAgent.NotesMain(JavaAgent.java:36)* > * at lotus.domino.AgentBase.runNotes(Unknown Source)* > * at lotus.domino.NotesThread.run(Unknown Source)* > > On Wed, Aug 26, 2015 at 4:35 PM, Tolen Miller <[email protected]> wrote: > >> Well, I'm not sure that will work either: >> >> On Wed, Aug 26, 2015 at 4:17 PM, Roberto Nibali <[email protected]> >> wrote: >> >>> Hi >>> >>> You use Notes/Domino, which is quiet a challenge when it comes to >>> application security. The Java API of Notes/Domino contains two different >>> SecurityManagers - one for agents and one for servlets. The >>> SecurityManager >>> for agents is COM.ibm.JEmpower.applet.AppletSecurity and the >>> SecurityManager for servlers is lotus.notes.AgentSecurityManager. Both >>> inherit directly from java.lang.SecurityManager. Make sure you have the >>> appropriate settings and talk to the administrator of this node. Last but >>> not least, I suppose you have a support contract with IBM. >>> >>> If you can fiddle around with the JVM you'd like to invoke, add your own >>> grant policy file: -Djava.security.policy=applet.policy >>> >>> However, I doubt Lotus will let you do this, and most probably you'll >>> hit a >>> classloader issue. With some luck you could hijack the SecurityManager as >>> follows: >>> >>> private class MySecurityManager extends SecurityManager { >>> @Override >>> public void checkPermission(Permission perm) { >>> return; >>> }} >>> >>> >>> At the start of your Applet, you do the following: >>> >>> SecurityManager sm = new >>> MySecurityManager();System.setSecurityManager(sm); >>> >>> >>> Good luck >>> >>> Roberto >>> >>> On Thu, Aug 27, 2015 at 12:08 AM, Tolen Miller <[email protected]> >>> wrote: >>> >>> > Hello again, >>> > >>> > I was able to get the PrintFields example working, so thanks for >>> that. I >>> > then applied what I learned to my situation and everything seemed to be >>> > going well, but now I have run into a roadblock: >>> > *java.lang.RuntimeException: java.security.AccessControlException: >>> Access >>> > denied (java.lang.reflect.ReflectPermission suppressAccessChecks)* >>> > * at >>> > >>> org.apache.pdfbox.pdmodel.font.PDType1CFont.load(PDType1CFont.java:411)* >>> > * at >>> > >>> org.apache.pdfbox.pdmodel.font.PDType1CFont.<init>(PDType1CFont.java:102)* >>> > * at >>> > >>> org.apache.pdfbox.pdmodel.font.PDType1Font.<init>(PDType1Font.java:162)* >>> > * at >>> > >>> > >>> org.apache.pdfbox.pdmodel.font.PDFontFactory.createFont(PDFontFactory.java:92)* >>> > * at >>> org.apache.pdfbox.pdmodel.PDResources.getFonts(PDResources.java:213)* >>> > * at >>> > >>> > >>> org.apache.pdfbox.pdmodel.interactive.form.PDAppearance.getFontAndUpdateResources(PDAppearance.java:820)* >>> > * at >>> > >>> > >>> org.apache.pdfbox.pdmodel.interactive.form.PDAppearance.setAppearanceValue(PDAppearance.java:316)* >>> > * at >>> > >>> > >>> org.apache.pdfbox.pdmodel.interactive.form.PDVariableText.setValue(PDVariableText.java:131)* >>> > * at JavaAgent.NotesMain(JavaAgent.java:69)* >>> > * at lotus.domino.AgentBase.runNotes(Unknown Source)* >>> > * at lotus.domino.NotesThread.run(Unknown Source)* >>> > *Caused by: java.security.AccessControlException: Access denied >>> > (java.lang.reflect.ReflectPermission suppressAccessChecks)* >>> > * at >>> java.security.AccessController.throwACE(AccessController.java:100)* >>> > * at >>> > >>> java.security.AccessController.checkPermission(AccessController.java:174)* >>> > * at >>> java.lang.SecurityManager.checkPermission(SecurityManager.java:544)* >>> > * at >>> > >>> > >>> COM.ibm.JEmpower.applet.AppletSecurity.superDotCheckPermission(AppletSecurity.java:1449)* >>> > * at >>> > >>> > >>> COM.ibm.JEmpower.applet.AppletSecurity.checkPermission(AppletSecurity.java:1617)* >>> > * at >>> > >>> > >>> COM.ibm.JEmpower.applet.AppletSecurity.checkPermission(AppletSecurity.java:1464)* >>> > * at >>> > >>> > >>> java.lang.reflect.AccessibleObject.setAccessible(AccessibleObject.java:118)* >>> > * at >>> > >>> org.apache.pdfbox.pdmodel.font.PDType1CFont.load(PDType1CFont.java:406)* >>> > * ... 10 more* >>> > >>> > This occurs just as I am calling PDField.setValue() and assigning a >>> value. >>> > I checked the java.policy file and the location where the PDFBox JAR is >>> > stored has "AllPermission". I also ensured that my PDF has no security. >>> > Any thoughts on what else to look for? >>> > >>> > >>> > >>> > >>> > On Wed, Aug 26, 2015 at 2:15 AM, Roberto Nibali <[email protected]> >>> wrote: >>> > >>> > > Hi >>> > > >>> > > On Wed, Aug 26, 2015 at 9:27 AM, Maruan Sahyoun < >>> [email protected]> >>> > > wrote: >>> > > >>> > > > Hi, >>> > > > >>> > > > > Am 26.08.2015 um 06:00 schrieb Tolen Miller <[email protected] >>> >: >>> > > > > >>> > > > > I uploaded my PDF again, if someone wants to see if they can get >>> all >>> > of >>> > > > the >>> > > > > fields to return: http://1drv.ms/1PRKZsI >>> > > > > >>> > > > > After looking at the sample provided by Maruan, I noticed that I >>> was >>> > > not >>> > > > > passing in a File object, when calling the PDDocument.load() >>> method. >>> > > > Doing >>> > > > > so, I now get the same result from Maruan's code (in eclipse). >>> > > > > >>> > > > > Now I am unsure how to get *all* of the fields from the >>> PDAcroForm. >>> > I >>> > > am >>> > > > > trying to get a collection of the fields, so I can loop through >>> them. >>> > > > When >>> > > > > I add this code: >>> > > > > >>> > > > > List<PDField> pdfFields = form.getFields(); >>> > > > > for (PDField field : pdfFields) { >>> > > > > System.out.println("PDF Field Full Name: ".concat(field >>> > > > > .getFullyQualifiedName())); >>> > > > > } >>> > > > > >>> > > > >>> > > > as there is only one 'root' field you have to get it's kids and >>> process >>> > > > the field tree down. Take a look at >>> > > > org.apache.pdfbox.examples.fdf.PrintFields of how to do that. >>> > > > >>> > > > >>> > > Having spent the last two months intensively with form fields, here >>> is my >>> > > current code to dump the fields: >>> > > >>> > > private void executeDumpFields(String srcDocName) throws IOException >>> { >>> > > PDDocument srcDoc = null; >>> > > try { >>> > > srcDoc = PDDocument.load(new File(srcDocName)); >>> > > >>> > > >>> > >>> srcDoc.getDocumentCatalog().getAcroForm().getFields().forEach(this::dumpField); >>> > > srcDoc.close(); >>> > > } catch (Exception e) { >>> > > logerr(e.getMessage()); >>> > > } finally { >>> > > if (srcDoc != null) { >>> > > srcDoc.close(); >>> > > } >>> > > } >>> > > } >>> > > >>> > > private void dumpField(PDField srcField) { >>> > > if (srcField instanceof PDNonTerminalField) { >>> > > ((PDNonTerminalField) >>> > > srcField).getChildren().forEach(this::dumpField); >>> > > } else if (!(srcField instanceof PDSignatureField)) { >>> > > System.out.printf("fqName=%s type=%s%n", >>> > > srcField.getFullyQualifiedName(), >>> > > srcField.getClass().getSimpleName()); >>> > > } >>> > > } >>> > > >>> > > Maybe you can use some of it. Just call the executeDumpFields(...) >>> with >>> > the >>> > > appropriate PDF name as a string and go from there. Not >>> understanding the >>> > > PDF standard and how the dictionary trees are built up inside PDF, I >>> had >>> > a >>> > > hard time initially understanding why I need to kind of recursively >>> to >>> > > through the PDField entries. >>> > > >>> > > Cheers >>> > > Roberto >>> > > >>> > >>> >> >> >

