Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Gradle: Could not create SecurityManager

I am currently trying to get some tests run in gradle for a shared build server. I get the following error:

Error occurred during initialization of VM    
java.lang.InternalError: Could not create SecurityManager:  
worker.org.gradle.process.internal.worker.child.BootstrapSecurityManager
    at sun.misc.Launcher.<init>(Launcher.java:102)
    at sun.misc.Launcher.<clinit>(Launcher.java:53)
    at java.lang.ClassLoader.initSystemClassLoader(ClassLoader.java:1451)
    at java.lang.ClassLoader.getSystemClassLoader(ClassLoader.java:1436)

The JVM commandline arguments from running with --debug are:

-DisTestMode=true
-Djava.security.manager=worker.org.gradle.process.internal.worker.child.BootstrapSecurityManager                 
-DtestLocators
-javaagent:../expandedArchives/org.jacoco.agent-0.7.8.jar_cbks496gfbgpke4b5ek12xen8/jacocoagent.jar=destfile=../../jacoco/testSpringContext_cnt_dmabtec.exec,append=true,inclnolocationclasses=false,dumponexit=true,output=file,jmx=false
-Xms128m
-Dfile.encoding=US-ASCII
-Duser.country=US
-Duser.language=en
-Duser.variant

I've tried running with different versions of gradle on local and on server to compare:
2.14.1 on local vs 2.14.1 on server
4.10.1 on local vs 4.5.x on server

  • On local, it will always pass all tests regardless of gradle version.
  • On server, it will always fail when it tries to one one specific test.
  • Both local and server have the same JVM arguments.
  • Both are using java JDK 8.
  • Same result if .gradle directory in working directory is deleted prior to gradle task
  • Cannot delete the /.gradle directory with gradle-worker.jar since it is a shared build server (I don't the permissions)

Does anyone have any ideas as to what is the issue? If you need more information, please ask and I will provide if I am able to. Thanks.

like image 840
Informat Avatar asked Nov 08 '18 22:11

Informat


3 Answers

This occurs when ~/.gradle/daemon folder is corrupted in MacOS/Unix. Forcefully removing the daemon folder resolved the issue for me.

rm -rf ~/.gradle/daemon
like image 133
Anuruddha Lanka Liyanarachchi Avatar answered Oct 23 '22 03:10

Anuruddha Lanka Liyanarachchi


Hi I could resolve my Problem with deleting the cache folder in the users home and then remove the .gradle folder in the projects folder. After that, I used gradle init and gradle wrapper to initialize it. Important I had to restart my computer (Windows) because some files in the cache folder were locked. Be sure, that everything is deleted inside the cache folder. I had some hanging gradle daemons without deleting everything.

like image 2
Mischa Imbiscuso Avatar answered Oct 23 '22 03:10

Mischa Imbiscuso


 export GRAILS_OPTS='-Xmx4g'

worked for me as charm

like image 1
Vadim Avatar answered Oct 23 '22 03:10

Vadim