You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@mina.apache.org by "Jeff Mesnil (JIRA)" <ji...@apache.org> on 2009/02/03 11:17:59 UTC

[jira] Created: (DIRMINA-659) AccessControlException when running MINA in a Applet: RuntimePermission "modifyThread"

AccessControlException when running MINA in a Applet: RuntimePermission "modifyThread"
--------------------------------------------------------------------------------------

                 Key: DIRMINA-659
                 URL: https://issues.apache.org/jira/browse/DIRMINA-659
             Project: MINA
          Issue Type: Bug
    Affects Versions: 2.0.0-M4
         Environment: Java 5 Applet (using appletviewer)
            Reporter: Jeff Mesnil


I'm using MINA 2.0.0-M4 within a restricted environment (an Applet in my case, could also be JNLP).

When running the code in appletviewer, I need to add a permission for the code to be executed successfully:
     permission java.lang.RuntimePermission "modifyThread";

If I don't add this permission, the code fails with the following stack trace:

Exception in thread "pool-2-thread-1" 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.util.concurrent.ThreadPoolExecutor.shutdown(ThreadPoolExecutor.java:893)
	at org.apache.mina.core.service.SimpleIoProcessorPool.dispose(SimpleIoProcessorPool.java:230)
	at org.apache.mina.core.polling.AbstractPollingIoConnector$Connector.run(AbstractPollingIoConnector.java:512)
	at org.apache.mina.util.NamePreservingRunnable.run(NamePreservingRunnable.java:65)
	at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:650)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:675)
	at java.lang.Thread.run(Thread.java:613)

The exception occurs when I close the SocketConnector:

   public synchronized void close()
   {
      if (connector != null)
      {
         connector.dispose();
         connector = null;
      }
   }

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (DIRMINA-659) AccessControlException when running MINA in a Applet: RuntimePermission "modifyThread"

Posted by "Jeff Mesnil (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/DIRMINA-659?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12725592#action_12725592 ] 

Jeff Mesnil commented on DIRMINA-659:
-------------------------------------

+1 for documenting it.
As long as the developer can know in advance what permissions are required by MINA to work in a sandbox, it's fine.

iirc, when I tested MINA in an applet, it was the only permission required. It's a pity I have to sign the applet to allow MINA to shutdown properly (but it was a prototype applet and it is likely that a real applet would have to be signed anyway).

To sum up, +1 to document the permission(s) and close this issue

> AccessControlException when running MINA in a Applet: RuntimePermission "modifyThread"
> --------------------------------------------------------------------------------------
>
>                 Key: DIRMINA-659
>                 URL: https://issues.apache.org/jira/browse/DIRMINA-659
>             Project: MINA
>          Issue Type: Bug
>    Affects Versions: 2.0.0-M4
>         Environment: Java 5 Applet (using appletviewer)
>            Reporter: Jeff Mesnil
>            Assignee: Edouard De Oliveira
>
> I'm using MINA 2.0.0-M4 within a restricted environment (an Applet in my case, could also be JNLP).
> When running the code in appletviewer, I need to add a permission for the code to be executed successfully:
>      permission java.lang.RuntimePermission "modifyThread";
> If I don't add this permission, the code fails with the following stack trace:
> Exception in thread "pool-2-thread-1" 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.util.concurrent.ThreadPoolExecutor.shutdown(ThreadPoolExecutor.java:893)
> 	at org.apache.mina.core.service.SimpleIoProcessorPool.dispose(SimpleIoProcessorPool.java:230)
> 	at org.apache.mina.core.polling.AbstractPollingIoConnector$Connector.run(AbstractPollingIoConnector.java:512)
> 	at org.apache.mina.util.NamePreservingRunnable.run(NamePreservingRunnable.java:65)
> 	at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:650)
> 	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:675)
> 	at java.lang.Thread.run(Thread.java:613)
> The exception occurs when I close the SocketConnector:
>    public synchronized void close()
>    {
>       if (connector != null)
>       {
>          connector.dispose();
>          connector = null;
>       }
>    }

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (DIRMINA-659) AccessControlException when running MINA in a Applet: RuntimePermission "modifyThread"

Posted by "Julien Vermillard (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/DIRMINA-659?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12680896#action_12680896 ] 

Julien Vermillard commented on DIRMINA-659:
-------------------------------------------

Apparently it's needed by : 
http://java.sun.com/j2se/1.5.0/docs/api/java/util/concurrent/ExecutorService.html#shutdown()
I'm no expert in applet and security what do you expect us to do ?

> AccessControlException when running MINA in a Applet: RuntimePermission "modifyThread"
> --------------------------------------------------------------------------------------
>
>                 Key: DIRMINA-659
>                 URL: https://issues.apache.org/jira/browse/DIRMINA-659
>             Project: MINA
>          Issue Type: Bug
>    Affects Versions: 2.0.0-M4
>         Environment: Java 5 Applet (using appletviewer)
>            Reporter: Jeff Mesnil
>
> I'm using MINA 2.0.0-M4 within a restricted environment (an Applet in my case, could also be JNLP).
> When running the code in appletviewer, I need to add a permission for the code to be executed successfully:
>      permission java.lang.RuntimePermission "modifyThread";
> If I don't add this permission, the code fails with the following stack trace:
> Exception in thread "pool-2-thread-1" 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.util.concurrent.ThreadPoolExecutor.shutdown(ThreadPoolExecutor.java:893)
> 	at org.apache.mina.core.service.SimpleIoProcessorPool.dispose(SimpleIoProcessorPool.java:230)
> 	at org.apache.mina.core.polling.AbstractPollingIoConnector$Connector.run(AbstractPollingIoConnector.java:512)
> 	at org.apache.mina.util.NamePreservingRunnable.run(NamePreservingRunnable.java:65)
> 	at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:650)
> 	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:675)
> 	at java.lang.Thread.run(Thread.java:613)
> The exception occurs when I close the SocketConnector:
>    public synchronized void close()
>    {
>       if (connector != null)
>       {
>          connector.dispose();
>          connector = null;
>       }
>    }

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Closed: (DIRMINA-659) AccessControlException when running MINA in a Applet: RuntimePermission "modifyThread"

Posted by "Edouard De Oliveira (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/DIRMINA-659?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Edouard De Oliveira closed DIRMINA-659.
---------------------------------------

    Resolution: Fixed

> AccessControlException when running MINA in a Applet: RuntimePermission "modifyThread"
> --------------------------------------------------------------------------------------
>
>                 Key: DIRMINA-659
>                 URL: https://issues.apache.org/jira/browse/DIRMINA-659
>             Project: MINA
>          Issue Type: Task
>          Components: Web Site / Documentation
>    Affects Versions: 2.0.0-M4
>         Environment: Java 5 Applet (using appletviewer)
>            Reporter: Jeff Mesnil
>            Assignee: Edouard De Oliveira
>             Fix For: 2.0.0-M7
>
>
> I'm using MINA 2.0.0-M4 within a restricted environment (an Applet in my case, could also be JNLP).
> When running the code in appletviewer, I need to add a permission for the code to be executed successfully:
>      permission java.lang.RuntimePermission "modifyThread";
> If I don't add this permission, the code fails with the following stack trace:
> Exception in thread "pool-2-thread-1" 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.util.concurrent.ThreadPoolExecutor.shutdown(ThreadPoolExecutor.java:893)
> 	at org.apache.mina.core.service.SimpleIoProcessorPool.dispose(SimpleIoProcessorPool.java:230)
> 	at org.apache.mina.core.polling.AbstractPollingIoConnector$Connector.run(AbstractPollingIoConnector.java:512)
> 	at org.apache.mina.util.NamePreservingRunnable.run(NamePreservingRunnable.java:65)
> 	at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:650)
> 	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:675)
> 	at java.lang.Thread.run(Thread.java:613)
> The exception occurs when I close the SocketConnector:
>    public synchronized void close()
>    {
>       if (connector != null)
>       {
>          connector.dispose();
>          connector = null;
>       }
>    }

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (DIRMINA-659) AccessControlException when running MINA in a Applet: RuntimePermission "modifyThread"

Posted by "Edouard De Oliveira (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/DIRMINA-659?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Edouard De Oliveira updated DIRMINA-659:
----------------------------------------

      Component/s: Web Site / Documentation
    Fix Version/s: 2.0.0-M7
       Issue Type: Task  (was: Bug)

Added some doc on the wiki

> AccessControlException when running MINA in a Applet: RuntimePermission "modifyThread"
> --------------------------------------------------------------------------------------
>
>                 Key: DIRMINA-659
>                 URL: https://issues.apache.org/jira/browse/DIRMINA-659
>             Project: MINA
>          Issue Type: Task
>          Components: Web Site / Documentation
>    Affects Versions: 2.0.0-M4
>         Environment: Java 5 Applet (using appletviewer)
>            Reporter: Jeff Mesnil
>            Assignee: Edouard De Oliveira
>             Fix For: 2.0.0-M7
>
>
> I'm using MINA 2.0.0-M4 within a restricted environment (an Applet in my case, could also be JNLP).
> When running the code in appletviewer, I need to add a permission for the code to be executed successfully:
>      permission java.lang.RuntimePermission "modifyThread";
> If I don't add this permission, the code fails with the following stack trace:
> Exception in thread "pool-2-thread-1" 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.util.concurrent.ThreadPoolExecutor.shutdown(ThreadPoolExecutor.java:893)
> 	at org.apache.mina.core.service.SimpleIoProcessorPool.dispose(SimpleIoProcessorPool.java:230)
> 	at org.apache.mina.core.polling.AbstractPollingIoConnector$Connector.run(AbstractPollingIoConnector.java:512)
> 	at org.apache.mina.util.NamePreservingRunnable.run(NamePreservingRunnable.java:65)
> 	at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:650)
> 	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:675)
> 	at java.lang.Thread.run(Thread.java:613)
> The exception occurs when I close the SocketConnector:
>    public synchronized void close()
>    {
>       if (connector != null)
>       {
>          connector.dispose();
>          connector = null;
>       }
>    }

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (DIRMINA-659) AccessControlException when running MINA in a Applet: RuntimePermission "modifyThread"

Posted by "Edouard De Oliveira (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/DIRMINA-659?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Edouard De Oliveira updated DIRMINA-659:
----------------------------------------

    Assignee: Edouard De Oliveira

Isn't some documentation the real solution here ? 
Maybe a special section for restricted envs like applets in the wiki
Jeff you can also sign your applet which will give your applet an unrestricted access to the system and thus eliminate the issue.

> AccessControlException when running MINA in a Applet: RuntimePermission "modifyThread"
> --------------------------------------------------------------------------------------
>
>                 Key: DIRMINA-659
>                 URL: https://issues.apache.org/jira/browse/DIRMINA-659
>             Project: MINA
>          Issue Type: Bug
>    Affects Versions: 2.0.0-M4
>         Environment: Java 5 Applet (using appletviewer)
>            Reporter: Jeff Mesnil
>            Assignee: Edouard De Oliveira
>
> I'm using MINA 2.0.0-M4 within a restricted environment (an Applet in my case, could also be JNLP).
> When running the code in appletviewer, I need to add a permission for the code to be executed successfully:
>      permission java.lang.RuntimePermission "modifyThread";
> If I don't add this permission, the code fails with the following stack trace:
> Exception in thread "pool-2-thread-1" 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.util.concurrent.ThreadPoolExecutor.shutdown(ThreadPoolExecutor.java:893)
> 	at org.apache.mina.core.service.SimpleIoProcessorPool.dispose(SimpleIoProcessorPool.java:230)
> 	at org.apache.mina.core.polling.AbstractPollingIoConnector$Connector.run(AbstractPollingIoConnector.java:512)
> 	at org.apache.mina.util.NamePreservingRunnable.run(NamePreservingRunnable.java:65)
> 	at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:650)
> 	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:675)
> 	at java.lang.Thread.run(Thread.java:613)
> The exception occurs when I close the SocketConnector:
>    public synchronized void close()
>    {
>       if (connector != null)
>       {
>          connector.dispose();
>          connector = null;
>       }
>    }

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.