Friday, December 7, 2012

java.security.AccessControlException: access denied (java.io.FilePermission

I have a third party service which is being invoked from my J2ee Web application. I have created a remote client class to invoke this service but I am getting  the folllowing exception while trying to access the Remote Client from Weblogic 11 G Server.

<at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:125)>
  <at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:120)>
  <at weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:2277)>
  <at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:2183)>
  <at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1454)>
  <at weblogic.work.ExecuteThread.execute(ExecuteThread.java:209)>
  <at weblogic.work.ExecuteThread.run(ExecuteThread.java:178)>
<at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)>
 <Warning> <mngd-srvr> <[ACTIVE] ExecuteThread: '0' for queue: 'weblogic.kernel.Default (self-tuning)'> <<anonymous>> <> <> <1349369405197> <BEA-2000161> <[Enhance] An exception was thrown while attempting to perform class file transformation on "com.test.services.objects.TestObject":
java.security.AccessControlException: access denied (java.io.FilePermission /srvrs/installed/servers/mngd-srvr/tmp/_WL_user/test-ear/ykrfd6/APP-INF/lib/testdataobjects.jar read)
        at java.security.AccessControlContext.checkPermission(AccessControlContext.java:374)
        at java.security.AccessController.checkPermission(AccessController.java:546)
        at java.lang.SecurityManager.checkPermission(SecurityManager.java:532)
        at java.lang.SecurityManager.checkRead(SecurityManager.java:871)
        at java.io.File.isDirectory(File.java:752)
        at java.io.File.toURL(File.java:623)


Fix: It can be fixed by providing security policy in the Java Options in your setDomainEnv file under bin directory of web logic installation:

I placed a policy file with grant all security level and set its location in the java options.

1. Place grant_all.policy in your config folder:

 grant {
  permission java.security.AllPermission;
};

2.  Add the following in JAVA_OPTIONS in setDomainEnv.

-Djava.security.policy=C:\weblogic\testdomain\config\grant_all.policy





No comments:

Post a Comment