Unable to run simple Java app with JRE 10

Dima :

Just tried to run my application in JRE 10 (since 9 got killed recently). The error below indicates that it requires ant.jar but this is a complete nonsense. The application doesn't need ant to run, and it works perfectly fine with all JRE's all the way back to 7. What am I missing? Why the runtime demands something which is totally irrelevant?

java.lang.NoClassDefFoundError: org/apache/tools/ant/taskdefs/Execute
    at org.apache.commons.configuration.EnvironmentConfiguration.extractProperties14(EnvironmentConfiguration.java:160)
    at org.apache.commons.configuration.EnvironmentConfiguration.<init>(EnvironmentConfiguration.java:77)
    at org.apache.commons.configuration.interpol.EnvironmentLookup.<init>(EnvironmentLookup.java:51)
    at org.apache.commons.configuration.interpol.ConfigurationInterpolator.<clinit>(ConfigurationInterpolator.java:386)
.......
Caused by: java.lang.ClassNotFoundException: org.apache.tools.ant.taskdefs.Execute
    at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:582)
    at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:190)
    at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:499)
M.F :

It seems that you have a dependency to a rather old version of apache commons-configuration. I could neither find the mentioned line in version 1.10 nor in 2.2.

If you would elaborate the sources of the apprioriate version, I guess you will see something like super(new HashMap<String, Object>(System.getenv())); and in extractProperties14(..) (which I was not able to find in the above mentioned versions) some code that accesses org.apache.tools.ant.taskdefs.Execute due to some logic.

So, I suggest to update the version of the dependeny or, if you are not allowed to do so, remove the SystemProperty that causes the error and seems to be provided by the JRE by default.

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=80165&siteId=1