# Integration tests fail with java.security.AccessControlException

**URL:** <https://discuss.elastic.co/t/integration-tests-fail-with-java-security-accesscontrolexception/69979>\
**Category:** Elasticsearch\
**Created:** [December 26, 2016, 7:30am UTC](https://discuss.elastic.co/t/integration-tests-fail-with-java-security-accesscontrolexception/69979 "2016-12-26T07:30:03Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![jvj](https://avatars.discourse-cdn.com/v4/letter/j/b5a626/32.png) [@jvj](https://discuss.elastic.co/u/jvj)\
**Post date:** [December 26, 2016, 7:30am UTC](https://discuss.elastic.co/t/integration-tests-fail-with-java-security-accesscontrolexception/69979/1 "2016-12-26T07:30:03Z")

</div>

I'm trying to run integration tests with Elasticsearch 5 by extending ESIntegTestCase in my class. However, it always fails with java.security.AccessControlException: access denied ("java.lang.RuntimePermission" "setDefaultUncaughtExceptionHandler"), no matter what I try.

I have tried to set ES\_JAVA\_OPTS="-Dtests.security.manager=false" and ES\_JAVA\_OPTS="-Djava.security.policy=my\_project/src/main/resources/plugin-security.policy". The file contains:  
grant {  
permission java.lang.RuntimePermission "setDefaultUncaughtExceptionHandler";  
permission org.elasticsearch.ThreadPermission "modifyArbitraryThreadGroup";  
};

[https://www.elastic.co/guide/en/elasticsearch/plugins/5.0/plugin-authors.html](https://www.elastic.co/guide/en/elasticsearch/plugins/5.0/plugin-authors.html) asks to put plugin-security.policy in src/main/plugin-metadata, which I did, but I use Maven and the file does not get picked up, I guess. I could use Gradle as well if needed, but it's not clear what "Gradle build system" is and how to get that in my project?

I also tried to run the integration tests following the instructions in [http://david.pilato.fr/blog/2016/10/18/elasticsearch-real-integration-tests-updated-for-ga/](http://david.pilato.fr/blog/2016/10/18/elasticsearch-real-integration-tests-updated-for-ga/), but no luck.

How can I get testing work?

---

<div class="post-metadata">

**Author:** ![jvj](https://avatars.discourse-cdn.com/v4/letter/j/b5a626/32.png) [@jvj](https://discuss.elastic.co/u/jvj)\
**Post date:** [December 26, 2016, 8:39am UTC](https://discuss.elastic.co/t/integration-tests-fail-with-java-security-accesscontrolexception/69979/2 "2016-12-26T08:39:36Z")

</div>

Replying to myself: I got it solved by including `<argLine>-Dtests.security.manager=false</argLine>` in randomizedtesting maven plugin configuration. Not sure why the policy file is not picked up, though.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [January 23, 2017, 8:39am UTC](https://discuss.elastic.co/t/integration-tests-fail-with-java-security-accesscontrolexception/69979/3 "2017-01-23T08:39:52Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
