Java Security Exception when inheriting from ESIntegTestCase

Hi,
I need to run elasticsearch for my tests, so I thought of using ESIntegTestCase.
But, I am getting this error when am running tests :

java.security.AccessControlException: access denied ("java.lang.RuntimePermission" 
"accessClassInPackage.sun.reflect")
    at java.security.AccessControlContext.checkPermission(AccessControlContext.java:472)

Down the logs, I am getting this error:

REPRODUCE WITH: gradle null -Dtests.seed=A49214270E342DC -
Dtests.class=com.tesco.productservice.elasticsearch.ElasticsearchClientTest -
Dtests.method="test_termQuery_success" -Dtests.locale=tr -Dtests.timezone=Asia/Aden

NotSerializableExceptionWrapper[class_cast_exception: org.apache.logging.slf4j.SLF4JLoggerContext 
cannot be cast to org.apache.logging.log4j.core.LoggerContext

Resolved it using

-Dtests.security.manager=false

But, now I am getting this error:

NotSerializableExceptionWrapper[class_cast_exception: org.apache.logging.slf4j.SLF4JLoggerContext 
cannot be cast to org.apache.logging.log4j.core.LoggerContext
]
    at __randomizedtesting.SeedInfo.seed([B3478902C17CBF90:CF246C1FE8179A6D]:0)

Here is my gradle file for reference:

compile fileTree (dir: 'libs')
compile (
        'javax.json:javax.json-api:1.0',
        'org.elasticsearch.client:elasticsearch-rest-high-level-client:6.1.1',
        'com.fasterxml.jackson.module:jackson-module-afterburner:2.1.5',
        'com.wordnik:swagger-core_2.10:1.3.0',
        'org.apache.commons:commons-jexl:2.1.1',
        'commons-collections:commons-collections:3.2.1',
        'commons-io:commons-io:2.2',
        'org.slf4j:slf4j-api:1.7.24',
        'org.apache.logging.log4j:log4j-to-slf4j:2.9.1',
        'org.apache.logging.log4j:log4j-api:2.9.1',
        'org.apache.logging.log4j:log4j-core:2.9.1'
)
compile('com.tesco.productservice:RSCouchBase:5.3.2') {
    exclude group: 'org.mockito'
    exclude group: 'org.hamcrest', module: 'hamcrest-core'
}
compile('io.dropwizard:dropwizard-core:0.9.1') {
    exclude group: 'org.glassfish.hk2.external'
    exclude group: 'org.slf4j'
    exclude group: 'org.hamcrest', module: 'hamcrest-core'
}
compile('io.dropwizard:dropwizard-client:0.9.1') {
    exclude group: 'org.glassfish.hk2.external'
    exclude group: 'org.slf4j'
    exclude group: 'org.hamcrest', module: 'hamcrest-core'
}
compile('io.dropwizard:dropwizard-assets:0.9.1') {
    exclude group: 'org.glassfish.hk2.external'
    exclude group: 'org.slf4j'
    exclude group: 'org.hamcrest', module: 'hamcrest-core'
}
compile('io.dropwizard:dropwizard-testing:0.9.1') {
    exclude group: 'org.glassfish.hk2.external'
    exclude group: 'org.slf4j'
    exclude group: 'org.hamcrest', module: 'hamcrest-core'
}
compile('com.tesco.productservice:common-auth:1.0.0') {
    exclude group: 'org.glassfish.hk2.external'
    exclude group: 'org.slf4j'
    exclude group: 'org.hamcrest', module: 'hamcrest-core'
}
compile ('com.wordnik:swagger-jaxrs_2.10:1.3.0') {
    exclude group: 'javax.ws.rs', module: 'jsr311-api'
    exclude group: 'org.reflections'
    exclude group: 'org.scala-lang'
}
// https://mvnrepository.com/artifact/org.slf4j/jul-to-slf4j
compile group: 'org.slf4j', name: 'jul-to-slf4j', version: '1.7.25'


def withoutHamcrestCore = {exclude group: 'org.hamcrest', module: 'hamcrest-core'}
def withoutSecureMock = {exclude group: 'org.elasticsearch', module: 'securemock'}

testCompile (
        'org.slf4j:slf4j-api:1.7.24',
        'org.apache.logging.log4j:log4j-to-slf4j:2.9.1',
        'org.apache.logging.log4j:log4j-api:2.9.1',
        'org.apache.logging.log4j:log4j-core:2.9.1'
)
testCompile 'info.cukes:cucumber-picocontainer:1.2.4', withoutHamcrestCore
testCompile 'info.cukes:cucumber-java:1.2.4', withoutHamcrestCore
testCompile 'info.cukes:cucumber-junit:1.2.4', withoutHamcrestCore
testCompile 'junit:junit:4.11', withoutHamcrestCore
testCompile 'org.elasticsearch.test:framework:6.1.1', withoutSecureMock
testCompile 'org.apache.lucene:lucene-test-framework:6.1.1'

Close this, I have read all the issues and found out it is better to spin new instances from maven plugin and not use ESIntegTestCase.

What a waste of time!

I request community to remove Testing Column in Elastic search guide and provide a good library for creating local nodes for testing purpose. (I don't use maven and I am having problem to learn maven and convert that plugin to suit my needs)

Some ideas there:

Just tell me why this is written here:
https://www.elastic.co/guide/en/elasticsearch/reference/current/testing.html

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