gradle-tomcat-plugin icon indicating copy to clipboard operation
gradle-tomcat-plugin copied to clipboard

Gradle Daemon - Caused by: java.lang.Error: factory already defined

Open sgoldstein527 opened this issue 5 years ago • 2 comments

When using the Gradle daemon (the default), I'm unable to run Tomcat twice using the plugin. The first time it starts, there is no problem. I then run "gradle tomcatStop" followed by "gradle tomcatRun" to restart Tomcat. I get the error/stacktrace below. If I run, "gradle --stop" to stop the gradle daemon, I'm once again able to run "gradle tomcatRun" successfully.

I'm using the plugin version 2.5 and Tomcat version 9.0.22.

Caused by: java.lang.Error: factory already defined at java.base/java.net.URL.setURLStreamHandlerFactory(URL.java:1184) at org.apache.catalina.webresources.TomcatURLStreamHandlerFactory.(TomcatURLStreamHandlerFactory.java:130) at org.apache.catalina.webresources.TomcatURLStreamHandlerFactory.getInstanceInternal(TomcatURLStreamHandlerFactory.java:53) at org.apache.catalina.webresources.TomcatURLStreamHandlerFactory.register(TomcatURLStreamHandlerFactory.java:77) at org.apache.catalina.webresources.StandardRoot.registerURLStreamHandlerFactory(StandardRoot.java:701) at org.apache.catalina.webresources.StandardRoot.initInternal(StandardRoot.java:683) at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:136) ... 175 more

sgoldstein527 avatar Jul 27 '19 16:07 sgoldstein527

Workaround: ./gradlew tomcatRun --no-daemon

C-Otto avatar Aug 03 '20 12:08 C-Otto

Is threre a real solution for this case?

danieljeremias avatar Oct 12 '23 13:10 danieljeremias