java.security.AccessControlException: access denied (java.lang.RuntimePermission modifyThread)

JDK Bug System | Girish Manwani | 1 decade ago
  1. 0

    FULL PRODUCT VERSION : java version "1.5.0" Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0-b64) Java HotSpot(TM) Client VM (build 1.5.0-b64, mixed mode, sharing) ADDITIONAL OS VERSION INFORMATION : Linux mjirko 2.4.18-14 #1 Wed Sep 4 13:35:50 EDT 2002 i686 athlon i386 GNU/Linux Microsoft Windows 2000 [Verze 5.00.2195] A DESCRIPTION OF THE PROBLEM : NameService resolving (calling ORB.resolve_initial_references("NameService")) in Apllet causes AccessControlException and deadlock (applet hangs). STEPS TO FOLLOW TO REPRODUCE THE PROBLEM : - run name service (on port 2809): tnameserv -ORBInitialPort 2809 - run test applet using appleviewer: appletviewer CorbaTest.html EXPECTED VERSUS ACTUAL BEHAVIOR : EXPECTED - NameSrvice should be resolved and message "Nameservice resolved." printed into System.out. ACTUAL - The applet hangs in ORB.resolve_initial_references(). ERROR MESSAGES/STACK TRACES THAT OCCUR : Exception in thread "Thread-2" java.security.AccessControlException: access denied (java.lang.RuntimePermission modifyThread) at java.security.AccessControlContext.checkPermission(AccessControlContext.java:264) at java.security.AccessController.checkPermission(AccessController.java:427) at java.lang.SecurityManager.checkPermission(SecurityManager.java:532) at sun.applet.AppletSecurity.checkAccess(AppletSecurity.java:138) at java.lang.Thread.checkAccess(Thread.java:1218) at java.lang.Thread.setName(Thread.java:1001) at com.sun.corba.se.impl.transport.SelectorImpl.run(SelectorImpl.java:239) REPRODUCIBILITY : This bug can be reproduced always. ---------- BEGIN SOURCE ---------- <!-- FILE: CorbaTest.html --> <HTML> <HEAD> <TITLE>CORBA Test</TITLE> </HEAD> <BODY> <h1>CORBA Test</h1> <hr> <applet code="CorbaTest.class" width="400" height="250"> <param name="org.omg.CORBA.ORBInitialPort" value="2809"/> alt="Your browser understands the &lt;APPLET&gt; tag but isn't running the applet, for some reason." Your browser is completely ignoring the &lt;APPLET&gt; tag! </applet> </BODY> </HTML> /** * FILE: CorbaTest.java */ import java.applet.Applet; import org.omg.CORBA.*; import org.omg.CosNaming.*; public class CorbaTest extends Applet { private ORB orb; public void init() { // create ORB try { orb = ORB.init(this, null); //((com.sun.corba.se.spi.orb.ORB) orb).transportDebugFlag = true; } catch(RuntimeException e) { } } public void start() { if(orb==null) return; // resolve NamingContext try { org.omg.CORBA.Object objRef = orb.resolve_initial_references("NameService"); NamingContext nc = NamingContextHelper.narrow(objRef); System.out.println("NameService resolved."); } catch(Exception e) { } } public void destroy() { if(orb!=null) { orb.shutdown(false); orb = null; } } } ---------- END SOURCE ---------- CUSTOMER SUBMITTED WORKAROUND : Grant "modifyThread" and "modifyThreadGroup" permissions to Applet. Suggested fix supplied by community member ###@###.###: A DESCRIPTION OF THE FIX : Bug number : 6203567 Bug Description : NameService resolving in Applet causes AccessControlException and deadlock Diff Baseline : Tiger b05 Diff : --- com/sun/corba/se/impl/transport/SelectorImpl.java 2005-08-26 22:54:33.000000000 +0200 +++ com/sun/corba/se/impl/transport/SelectorImpl2.java 2005-11-10 10:23:42.000000000 +0100 @@ -236,7 +236,12 @@ public void run() { - setName("SelectorThread"); + AccessController.doPrivileged(new PrivilegedAction() { + public Object run() { + setName("SelectorThread"); + return null; + } + }); while (!closed) { try { int n = 0; FIX FOR BUG NUMBER: 6203567 Test case supplied by community member ###@###.###: Hello, here is a little test case for the fix. Steps to use this test case: 1) compile CorbaInAppletTest.java 2) run name service (on port 2809): tnameserv -ORBInitialPort 2809 3) run the test applet using appleviewer: appletviewer CorbaInAppletTest.html If the bug is present, the exception message is printed out and the apllet hangs in ORB.resolve_initial_references(). If the bug is corrected, NameSrvice should be resolved and message "Nameservice resolved." printed into System.out. Refer to the attached files for CorbaInAppletTest.java and CorbaInAppletTest.html

    JDK Bug System | 1 decade ago | Girish Manwani
    java.security.AccessControlException: access denied (java.lang.RuntimePermission modifyThread)
  2. 0

    client as an applet with CORBA

    Oracle Community | 9 years ago | 843807
    java.security.AccessControlException: access denied (java.lang.RuntimePermission modifyThread)
  3. 0

    RMI -IIOP with an Applet

    Oracle Community | 1 decade ago | 843793
    java.security.AccessControlException: access deni ed (java.lang.RuntimePermission modifyThread)
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0

    Game disposal issue - Pathfinding/Workboard related?

    GitHub | 2 years ago | Cervator
    java.security.AccessControlException: access denied ("java.lang.RuntimePermission" "modifyThread")
  6. 0

    [OPENJPA-369] AccessDeclaredMembers RuntimePermission requires by Solaris JDK with security enabled - ASF JIRA

    apache.org | 1 year ago
    java.security.AccessControlException: Access denied (java.lang.RuntimePermission modifyThread)

    Not finding the right solution?
    Take a tour to get the most out of Samebug.

    Tired of useless tips?

    Automated exception search integrated into your IDE

    Root Cause Analysis

    1. java.security.AccessControlException

      access denied (java.lang.RuntimePermission modifyThread)

      at java.security.AccessControlContext.checkPermission()
    2. Java RT
      SelectorImpl.run
      1. java.security.AccessControlContext.checkPermission(AccessControlContext.java:264)
      2. java.security.AccessController.checkPermission(AccessController.java:427)
      3. java.lang.SecurityManager.checkPermission(SecurityManager.java:532)
      4. sun.applet.AppletSecurity.checkAccess(AppletSecurity.java:138)
      5. java.lang.Thread.checkAccess(Thread.java:1218)
      6. java.lang.Thread.setName(Thread.java:1001)
      7. com.sun.corba.se.impl.transport.SelectorImpl.run(SelectorImpl.java:239)
      7 frames