Java Mailing List Archive

http://www.ant-tasks.com/

Apache Ant Archive

» Ant Users List
» Ant Developers List
Junit and java.security.AccessControlException: access denied (file permissi

Junit and java.security.AccessControlException: access denied (file permissi

2003-03-13       - By otisg

It turns out that setting
java.security.manager system property to an
empty value inside the <junit> task was the
culprit:

 <sysproperty key="java.security.manager"
value=""/>

I am not sure why this is a problem, but
taking this out seems to let junit task run
without the false file permission error.

Otis


---- On Thu, 13 Mar 2003, otisg
(otisg@(protected)) wrote:

> Hello,
>
> I am using Ant 1.5.2 with JDK 1.4.1_02 on a
> Red Hat 7.3.
> Then running JUnit task I always get an
> error such as this one:
>
>     [junit] Running
> net.wgen.amp.action.ExampleActionTest
>     [junit] Exception in thread "main"
> java.security.AccessControlException: access
> denied (java.io.FilePermission
>
/home/otis/wgen/eclipse-workspace/mclass/ampNG/build/reports/ut/TEST-net.wgen
.amp.action.ExampleActionTest.xml
> write)
>     [junit]     at
>
java.security.AccessControlContext.checkPermission(AccessControlContext.java
:270)
>     [junit]     at
>
java.security.AccessController.checkPermission(AccessController.java:401)
>     [junit]     at
>
java.lang.SecurityManager.checkPermission(SecurityManager.java:542)
>     [junit]     at
>
java.lang.SecurityManager.checkWrite(SecurityManager.java:975)
>     [junit]     at
>
java.io.FileOutputStream.<init>(FileOutputStream.java:169)
>     [junit]     at
>
java.io.FileOutputStream.<init>(FileOutputStream.java:131)
>     [junit]     at
>
org.apache.tools.ant.taskdefs.optional.junit.FormatterElement.createFormatter
(FormatterElement.java:206)
>     [junit]     at
>
org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner
.createAndStoreFormatter(JUnitTestRunner.java:562)
>     [junit]     at
>
org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.main
(JUnitTestRunner.java:507)
>     [junit] TEST
> net.wgen.amp.action.ExampleActionTest FAILED
>
>
> I cannot figure out why this is happening.
> Even if I do 'chmod -R 777 reports' (reports
> is the directory where unit test reports go)
> and re-run Ant, I still get the same error!
>
> Even if I touch the XML file that supposedly
> cannot be created/written to disk, and make
> it world writable, I still get the error.
>
> Does anyone know what the problem is here?
>
> Thank you,
> Otis
>
>
>
________________________________________________
> Get your own "800" number
> Voicemail, fax, email, and a lot more
> http://www.ureach.com/reg/tag
>
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
user-unsubscribe@(protected)
> For additional commands, e-mail:
user-help@(protected)
>
>
>


________________________________________________
Get your own "800" number
Voicemail, fax, email, and a lot more
http://www.ureach.com/reg/tag


©2008 ant-tasks.com - Jax Systems, LLC, U.S.A.