Jump to content

Recommended Posts

Posted

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 Made
INFO:   Connection was made
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(("org.osgi.framework.AdminPermission" "(id=14)" "resolve,resource"))
INFO:   JACC Policy Provider: Failed Permission Check, context(PA2/PA2)- permission(("java.lang.RuntimePermission" "createClassLoader"))

server.policy

grant 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
  • Replies 0
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

Popular Days

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 account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...