IllegalAccessErrors: "...FilenameUtils.isSystemWindows()Z from class org.apache.commons.io.FileUtils"

Hello,

since several day I am running into IllegalAccessErrors.

Gradle terminates with
tried to access method org.apache.commons.io.FilenameUtils.isSystemWindows()Z from class org.apache.commons.io.FileUtils
Complete stacktrace is below. The error message is the same than the one reported in this issue.

gradle buildEnvironment delivers following classpath:

classpath
±-- gradle.plugin.com.github.eerohele:dita-ot-gradle:0.2.1
— commons-io:commons-io:2.4

Because of the linked issue, I tried to enforce commons-io version 2.2, but the IllegalAccessError still occurs.

Can anybody help?

Complete Stacktrace:

  • Exception
    is:

org.gradle.api.tasks.TaskExecutionException:
Execution failed for task ‘:backend-aixmdb-dbscripts:extractTestDependencies’.

            at

org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:69)

            at

org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:46)

            at org.gradle.api.internal.tasks.execution.PostExecutionAnalysisTaskExecuter.execute(PostExecutionAnalysisTaskExecuter.java:35)

            at

org.gradle.api.internal.tasks.execution.SkipUpToDateTaskExecuter.execute(SkipUpToDateTaskExecuter.java:64)

            at

org.gradle.api.internal.tasks.execution.ValidatingTaskExecuter.execute(ValidatingTaskExecuter.java:58)

            at

org.gradle.api.internal.tasks.execution.SkipEmptySourceFilesTaskExecuter.execute(SkipEmptySourceFilesTaskExecuter.java:52)

            at

org.gradle.api.internal.tasks.execution.SkipTaskWithNoActionsExecuter.execute(SkipTaskWithNoActionsExecuter.java:52)

            at

org.gradle.api.internal.tasks.execution.SkipOnlyIfTaskExecuter.execute(SkipOnlyIfTaskExecuter.java:53)

            at

org.gradle.api.internal.tasks.execution.ExecuteAtMostOnceTaskExecuter.execute(ExecuteAtMostOnceTaskExecuter.java:43)

            at

org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker.execute(DefaultTaskGraphExecuter.java:203)

            at

org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker.execute(DefaultTaskGraphExecuter.java:185)

            at

org.gradle.execution.taskgraph.AbstractTaskPlanExecutor$TaskExecutorWorker.processTask(AbstractTaskPlanExecutor.java:66)

            at

org.gradle.execution.taskgraph.AbstractTaskPlanExecutor$TaskExecutorWorker.run(AbstractTaskPlanExecutor.java:50)

            at

org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:54)

            at

org.gradle.internal.concurrent.StoppableExecutorImpl$1.run(StoppableExecutorImpl.java:40)

            at

java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)

            at

java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)

            at

java.lang.Thread.run(Thread.java:722)

Caused by:
java.lang.IllegalAccessError: tried to access method org.apache.commons.io.FilenameUtils.isSystemWindows()Z
from class org.apache.commons.io.FileUtils

            at

org.apache.commons.io.FileUtils.isSymlink(FileUtils.java:2667)

            at

org.apache.commons.io.FileUtils.deleteDirectory(FileUtils.java:1464)

            at

org.gradle.util.GFileUtils.deleteDirectory(GFileUtils.java:140)

            at

org.gradle.api.internal.file.copy.SyncCopyActionDecorator$SyncCopyActionDecoratorFileVisitor.maybeDelete(SyncCopyActionDecorator.java:84)

            at

org.gradle.api.internal.file.copy.SyncCopyActionDecorator$SyncCopyActionDecoratorFileVisitor.visitDir(SyncCopyActionDecorator.java:73)

            at

org.gradle.api.internal.file.collections.jdk7.Jdk7DirectoryWalker$1.postVisitDirectory(Jdk7DirectoryWalker.java:111)

            at

org.gradle.api.internal.file.collections.jdk7.Jdk7DirectoryWalker$1.postVisitDirectory(Jdk7DirectoryWalker.java:54)

            at

java.nio.file.FileTreeWalker.walk(FileTreeWalker.java:224)

            at

java.nio.file.FileTreeWalker.walk(FileTreeWalker.java:199)

            at

java.nio.file.FileTreeWalker.walk(FileTreeWalker.java:199)

            at

java.nio.file.FileTreeWalker.walk(FileTreeWalker.java:199)

            at

java.nio.file.FileTreeWalker.walk(FileTreeWalker.java:199)

            at

java.nio.file.FileTreeWalker.walk(FileTreeWalker.java:199)

            at

java.nio.file.FileTreeWalker.walk(FileTreeWalker.java:199)

            at java.nio.file.FileTreeWalker.walk(FileTreeWalker.java:69)

            at

java.nio.file.Files.walkFileTree(Files.java:2591)

            at

org.gradle.api.internal.file.collections.jdk7.Jdk7DirectoryWalker.walkDir(Jdk7DirectoryWalker.java:54)

            at

org.gradle.api.internal.file.collections.DirectoryFileTree.walkDir(DirectoryFileTree.java:146)

            at

org.gradle.api.internal.file.collections.DirectoryFileTree.visitFrom(DirectoryFileTree.java:130)

            at

org.gradle.api.internal.file.collections.DirectoryFileTree.visit(DirectoryFileTree.java:115)

            at

org.gradle.api.internal.file.copy.SyncCopyActionDecorator.execute(SyncCopyActionDecorator.java:58)

            at

org.gradle.api.internal.file.copy.NormalizingCopyActionDecorator.execute(NormalizingCopyActionDecorator.java:52)

            at org.gradle.api.internal.file.copy.DuplicateHandlingCopyActionDecorator.execute(DuplicateHandlingCopyActionDecorator.java:42)

            at

org.gradle.api.internal.file.copy.CopyActionExecuter.execute(CopyActionExecuter.java:38)

            at

org.gradle.api.tasks.AbstractCopyTask.copy(AbstractCopyTask.java:83)

            at

sun.reflect.GeneratedMethodAccessor387.invoke(Unknown Source)

            at

sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

            at

java.lang.reflect.Method.invoke(Method.java:601)

            at

org.gradle.internal.reflect.JavaMethod.invoke(JavaMethod.java:75)

            at

org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$StandardTaskAction.doExecute(AnnotationProcessingTaskFactory.java:227)

            at

org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$StandardTaskAction.execute(AnnotationProcessingTaskFactory.java:220)

            at

org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$StandardTaskAction.execute(AnnotationProcessingTaskFactory.java:209)

            at org.gradle.api.internal.AbstractTask$TaskActionWrapper.execute(AbstractTask.java:585)

            at

org.gradle.api.internal.AbstractTask$TaskActionWrapper.execute(AbstractTask.java:568)

            at

org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeAction(ExecuteActionsTaskExecuter.java:80)

            at

org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:61)

            ... 17 more

I just saw, that there is a newer version of the 3rd party plugin which has a dependency to an older commons-io and now the build is working again.

There was a second problem in addition to the jar dependency. We were messing with the ant classloader:

ClassLoader antClassLoader = org.apache.tools.ant.Project.class.classLoader
antClassLoader.addURL(PathToCommonIO_JAR)

If you are doing something like this, you will need to remove it.