kamarjit Posted January 5, 2015 Posted January 5, 2015 Hi,I am getting a permission check error accessing ireport from a java servlet. I am using glassfish 4.0 on windows environment as my web server. I use netbeans for java development. I have modified the server.policy file to grant permissions without any success. Here is my code calling report:ServletOutputStream servletOutputStream = response.getOutputStream(); File reportFile = new File(getServletConfig().getServletContext() .getRealPath("/JasperReports/PanceResults.jasper")); byte[] bytes = null; try { bytes = JasperRunManager.runReportToPdf(reportFile.getPath(), parameters, new JREmptyDataSource()); response.setContentType("application/pdf"); response.setContentLength(bytes.length); servletOutputStream.write(bytes, 0, bytes.length); servletOutputStream.flush(); servletOutputStream.close(); } catch (JRException e) { // display stack trace in the browser StringWriter stringWriter = new StringWriter(); PrintWriter printWriter = new PrintWriter(stringWriter); e.printStackTrace(printWriter); response.setContentType("text/plain"); response.getOutputStream().print(stringWriter.toString()); } Here is the errors: Connection MadeINFO: Connection was madeINFO: JACC Policy Provider: Failed Permission Check, context(PA2/PA2)- permission(("org.osgi.framework.AdminPermission" "(id=14)" "resolve,resource"))INFO: JACC Policy Provider: Failed Permission Check, context(PA2/PA2)- permission(("org.osgi.framework.AdminPermission" "(id=14)" "resolve,resource"))INFO: JACC Policy Provider: Failed Permission Check, context(PA2/PA2)- permission(("org.osgi.framework.AdminPermission" "(id=14)" "resolve,resource"))INFO: JACC Policy Provider: Failed Permission Check, context(PA2/PA2)- permission(("org.osgi.framework.AdminPermission" "(id=14)" "resolve,resource"))INFO: JACC Policy Provider: Failed Permission Check, context(PA2/PA2)- permission(("org.osgi.framework.AdminPermission" "(id=14)" "resolve,resource"))INFO: JACC Policy Provider: Failed Permission Check, context(PA2/PA2)- permission(("org.osgi.framework.AdminPermission" "(id=14)" "resolve,resource"))INFO: JACC Policy Provider: Failed Permission Check, context(PA2/PA2)- permission(("org.osgi.framework.AdminPermission" "(id=14)" "resolve,resource"))INFO: JACC Policy Provider: Failed Permission Check, context(PA2/PA2)- permission(("org.osgi.framework.AdminPermission" "(id=14)" "resolve,resource"))INFO: JACC Policy Provider: Failed Permission Check, context(PA2/PA2)- permission(("org.osgi.framework.AdminPermission" "(id=14)" "resolve,resource"))INFO: JACC Policy Provider: Failed Permission Check, context(PA2/PA2)- permission(("org.osgi.framework.AdminPermission" "(id=14)" "resolve,resource"))INFO: JACC Policy Provider: Failed Permission Check, context(PA2/PA2)- permission(("org.osgi.framework.AdminPermission" "(id=14)" "resolve,resource"))INFO: JACC Policy Provider: Failed Permission Check, context(PA2/PA2)- permission(("org.osgi.framework.AdminPermission" "(id=14)" "resolve,resource"))INFO: JACC Policy Provider: Failed Permission Check, context(PA2/PA2)- permission(("org.osgi.framework.AdminPermission" "(id=14)" "resolve,resource"))INFO: JACC Policy Provider: Failed Permission Check, context(PA2/PA2)- permission(("org.osgi.framework.AdminPermission" "(id=14)" "resolve,resource"))INFO: JACC Policy Provider: Failed Permission Check, context(PA2/PA2)- permission(("org.osgi.framework.AdminPermission" "(id=14)" "resolve,resource"))INFO: JACC Policy Provider: Failed Permission Check, context(PA2/PA2)- permission(("org.osgi.framework.AdminPermission" "(id=14)" "resolve,resource"))INFO: JACC Policy Provider: Failed Permission Check, context(PA2/PA2)- permission(("org.osgi.framework.AdminPermission" "(id=14)" "resolve,resource"))INFO: JACC Policy Provider: Failed Permission Check, context(PA2/PA2)- permission(("org.osgi.framework.AdminPermission" "(id=14)" "resolve,resource"))INFO: JACC Policy Provider: Failed Permission Check, context(PA2/PA2)- permission(("org.osgi.framework.AdminPermission" "(id=14)" "resolve,resource"))INFO: JACC Policy Provider: Failed Permission Check, context(PA2/PA2)- permission(("org.osgi.framework.AdminPermission" "(id=14)" "resolve,resource"))INFO: JACC Policy Provider: Failed Permission Check, context(PA2/PA2)- permission(("org.osgi.framework.AdminPermission" "(id=14)" "resolve,resource"))INFO: JACC Policy Provider: Failed Permission Check, context(PA2/PA2)- permission(("org.osgi.framework.AdminPermission" "(id=14)" "resolve,resource"))INFO: JACC Policy Provider: Failed Permission Check, context(PA2/PA2)- permission(("org.osgi.framework.AdminPermission" "(id=14)" "resolve,resource"))INFO: JACC Policy Provider: Failed Permission Check, context(PA2/PA2)- permission(("org.osgi.framework.AdminPermission" "(id=14)" "resolve,resource"))INFO: JACC Policy Provider: Failed Permission Check, context(PA2/PA2)- permission(("org.osgi.framework.AdminPermission" "(id=14)" "resolve,resource"))INFO: JACC Policy Provider: Failed Permission Check, context(PA2/PA2)- permission(("org.osgi.framework.AdminPermission" "(id=14)" "resolve,resource"))INFO: JACC Policy Provider: Failed Permission Check, context(PA2/PA2)- permission(("org.osgi.framework.AdminPermission" "(id=14)" "resolve,resource"))INFO: JACC Policy Provider: Failed Permission Check, context(PA2/PA2)- permission(("org.osgi.framework.AdminPermission" "(id=14)" "resolve,resource"))INFO: JACC Policy Provider: Failed Permission Check, context(PA2/PA2)- permission(("org.osgi.framework.AdminPermission" "(id=14)" "resolve,resource"))INFO: JACC Policy Provider: Failed Permission Check, context(PA2/PA2)- permission(("java.lang.RuntimePermission" "createClassLoader"))server.policygrant codeBase "c:/Users/kamarjit/Documents/NetBeansProjects/PA2/build/web/-"{permission java.util.PropertyPermission "*", "read,write";permission java.lang.RuntimePermission "createClassLoader";permission java.lang.reflect.ReflectPermission "suppressAccessChecks";permission java.lang.RuntimePermission "accessDeclaredMembers";permission java.lang.RuntimePermission "getProtectionDomain"; }; Any help would be appreciated. Thanks
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now