[GRADLE-1981] build script dependencies classloader problem Created: 04/Dec/11  Updated: 10/Feb/17  Resolved: 10/Feb/17

Status: Resolved
Project: Gradle
Affects Version/s: 1.0-milestone-6
Fix Version/s: None

Type: Bug
Reporter: Martin Kováčik Assignee: Unassigned
Resolution: Won't Fix Votes: 1

Attachments: File build.gradle    

 Description   

I'm not able to use dom4j in my build scripts due to (what is seems to me) classloader issue.

In my buildscript I have:

buildscript {
repositories

{ mavenCentral() }

dependencies

{ classpath 'dom4j:dom4j:1.6.1' }

}

....

eclipseClasspath <<

{ def classpathFile = file('.classpath') def reader = new org.dom4j.io.SAXReader() def doc = reader.read(classpathFile) .... }

When I do the build I get:

Execution failed for task ':eclipseClasspath'.
Cause: org.dom4j.DocumentException: org.dom4j.DocumentFactory cannot be cast to org.dom4j.DocumentFactory Nested exception: org.dom4j.DocumentFactory cannot be cast to org.dom4j.DocumentFactory

It seems to me that there is a classloader issue between gradle's internal dom4j and my declared dom4j.

I don't know if prior versions are affected, I just switched from M1 to M6



 Comments   
Comment by Jisung, Ahn [ 08/Dec/11 ]

I meet this problem also.

build.gradle

buildscript {
repositories

{ mavenCentral() }

dependencies

{ classpath group:'org.apache.poi', name:'poi', version:'3.7' classpath group:'org.apache.poi', name:'poi-ooxml', version:'3.7' }

}

import org.apache.poi.ss.usermodel.WorkbookFactory;

task ttt <<

{ return WorkbookFactory.create(new FileInputStream(file("a.xlsx"))); }

and Run on M6 – FAIL

gradle ttt
Picked up _JAVA_OPTIONS: -Dfile.encoding=UTF-8
:ttt

FAILURE: Build failed with an exception.

  • Where:
    Build file '/Volumes/Mac_HDD/Users/narusas/temp/build.gradle' line: 26
  • What went wrong:
    Execution failed for task ':ttt'.
    Cause: java.lang.ExceptionInInitializerError
  • Try:
    Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

but on M3 - OK

gradle-1.0-milestone-3/bin/gradle ttt
Picked up _JAVA_OPTIONS: -Dfile.encoding=UTF-8
:ttt

BUILD SUCCESSFUL

I thin, This problem is critical bug.

Comment by Jisung, Ahn [ 08/Dec/11 ]

Attach Real exception log

----------------
17:11:07.624 [ERROR] [org.gradle.BuildExceptionReporter] * Exception is:
17:11:07.625 [ERROR] [org.gradle.BuildExceptionReporter] org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':ttt'.
17:11:07.625 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:71)
17:11:07.642 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:48)
17:11:07.645 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.api.internal.tasks.execution.PostExecutionAnalysisTaskExecuter.execute(PostExecutionAnalysisTaskExecuter.java:34)
17:11:07.648 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.api.internal.tasks.execution.SkipUpToDateTaskExecuter.execute(SkipUpToDateTaskExecuter.java:55)
17:11:07.657 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.api.internal.tasks.execution.ValidatingTaskExecuter.execute(ValidatingTaskExecuter.java:57)
17:11:07.659 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.api.internal.tasks.execution.SkipEmptySourceFilesTaskExecuter.execute(SkipEmptySourceFilesTaskExecuter.java:41)
17:11:07.659 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.api.internal.tasks.execution.SkipTaskWithNoActionsExecuter.execute(SkipTaskWithNoActionsExecuter.java:51)
17:11:07.662 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.api.internal.tasks.execution.SkipOnlyIfTaskExecuter.execute(SkipOnlyIfTaskExecuter.java:52)
17:11:07.662 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.api.internal.tasks.execution.ExecuteAtMostOnceTaskExecuter.execute(ExecuteAtMostOnceTaskExecuter.java:42)
17:11:07.664 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.api.internal.AbstractTask.executeWithoutThrowingTaskFailure(AbstractTask.java:243)
17:11:07.664 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.execution.DefaultTaskGraphExecuter.executeTask(DefaultTaskGraphExecuter.java:192)
17:11:07.666 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.execution.DefaultTaskGraphExecuter.doExecute(DefaultTaskGraphExecuter.java:177)
17:11:07.666 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.execution.DefaultTaskGraphExecuter.execute(DefaultTaskGraphExecuter.java:83)
17:11:07.667 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.execution.SelectedTaskExecutionAction.execute(SelectedTaskExecutionAction.java:36)
17:11:07.668 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:70)
17:11:07.669 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.execution.DefaultBuildExecuter.access$300(DefaultBuildExecuter.java:23)
17:11:07.669 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.execution.DefaultBuildExecuter$2.proceed(DefaultBuildExecuter.java:80)
17:11:07.670 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.execution.DryRunBuildExecutionAction.execute(DryRunBuildExecutionAction.java:32)
17:11:07.670 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:70)
17:11:07.671 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:63)
17:11:07.672 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.initialization.DefaultGradleLauncher.doBuildStages(DefaultGradleLauncher.java:157)
17:11:07.672 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.initialization.DefaultGradleLauncher.doBuild(DefaultGradleLauncher.java:112)
17:11:07.673 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.initialization.DefaultGradleLauncher.run(DefaultGradleLauncher.java:80)
17:11:07.673 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.launcher.cli.RunBuildAction.execute(RunBuildAction.java:42)
17:11:07.674 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.launcher.cli.RunBuildAction.execute(RunBuildAction.java:28)
17:11:07.674 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.launcher.exec.ExceptionReportingAction.execute(ExceptionReportingAction.java:32)
17:11:07.676 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.launcher.exec.ExceptionReportingAction.execute(ExceptionReportingAction.java:21)
17:11:07.676 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.launcher.cli.CommandLineActionFactory$WithLoggingAction.execute(CommandLineActionFactory.java:233)
17:11:07.695 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.launcher.cli.CommandLineActionFactory$WithLoggingAction.execute(CommandLineActionFactory.java:217)
17:11:07.695 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.launcher.Main.doAction(Main.java:48)
17:11:07.696 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.launcher.exec.EntryPoint$1.execute(EntryPoint.java:53)
17:11:07.697 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.launcher.exec.EntryPoint$1.execute(EntryPoint.java:51)
17:11:07.697 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.launcher.exec.Execution.execute(Execution.java:28)
17:11:07.698 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.launcher.exec.EntryPoint.run(EntryPoint.java:39)
17:11:07.699 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.launcher.Main.main(Main.java:39)
17:11:07.699 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.launcher.ProcessBootstrap.runNoExit(ProcessBootstrap.java:51)
17:11:07.700 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.launcher.ProcessBootstrap.run(ProcessBootstrap.java:33)
17:11:07.701 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.launcher.GradleMain.main(GradleMain.java:24)
17:11:07.704 [ERROR] [org.gradle.BuildExceptionReporter] Caused by: org.codehaus.groovy.runtime.InvokerInvocationException: java.lang.ExceptionInInitializerError
17:11:07.705 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.api.internal.AbstractTask$ClosureTaskAction.execute(AbstractTask.java:448)
17:11:07.706 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.api.internal.AbstractTask$ClosureTaskAction.execute(AbstractTask.java:436)
17:11:07.706 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:63)
17:11:07.707 [ERROR] [org.gradle.BuildExceptionReporter] ... 37 more
17:11:07.708 [ERROR] [org.gradle.BuildExceptionReporter] Caused by: java.lang.ExceptionInInitializerError
17:11:07.710 [ERROR] [org.gradle.BuildExceptionReporter] at org.apache.poi.openxml4j.opc.internal.unmarshallers.PackagePropertiesUnmarshaller.<clinit>(PackagePropertiesUnmarshaller.java:49)
17:11:07.711 [ERROR] [org.gradle.BuildExceptionReporter] at org.apache.poi.openxml4j.opc.OPCPackage.init(OPCPackage.java:149)
17:11:07.711 [ERROR] [org.gradle.BuildExceptionReporter] at org.apache.poi.openxml4j.opc.OPCPackage.<init>(OPCPackage.java:136)
17:11:07.714 [ERROR] [org.gradle.BuildExceptionReporter] at org.apache.poi.openxml4j.opc.Package.<init>(Package.java:54)
17:11:07.717 [ERROR] [org.gradle.BuildExceptionReporter] at org.apache.poi.openxml4j.opc.ZipPackage.<init>(ZipPackage.java:81)
17:11:07.718 [ERROR] [org.gradle.BuildExceptionReporter] at org.apache.poi.openxml4j.opc.OPCPackage.open(OPCPackage.java:220)
17:11:07.733 [ERROR] [org.gradle.BuildExceptionReporter] at org.apache.poi.ss.usermodel.WorkbookFactory.create(WorkbookFactory.java:63)
17:11:07.734 [ERROR] [org.gradle.BuildExceptionReporter] at org.apache.poi.ss.usermodel.WorkbookFactory$create.call(Unknown Source)
17:11:07.734 [ERROR] [org.gradle.BuildExceptionReporter] at build_5e128f2fh3pfogkvm5mvpaghh9$_run_closure1.doCall(/Volumes/Mac_HDD/Users/narusas/temp/build.gradle:26)
17:11:07.735 [ERROR] [org.gradle.BuildExceptionReporter] ... 40 more
17:11:07.735 [ERROR] [org.gradle.BuildExceptionReporter] Caused by: java.lang.ClassCastException: org.dom4j.DocumentFactory cannot be cast to org.dom4j.DocumentFactory
17:11:07.736 [ERROR] [org.gradle.BuildExceptionReporter] at org.dom4j.DocumentFactory.getInstance(DocumentFactory.java:97)
17:11:07.737 [ERROR] [org.gradle.BuildExceptionReporter] at org.dom4j.tree.AbstractNode.<clinit>(AbstractNode.java:39)
17:11:07.738 [ERROR] [org.gradle.BuildExceptionReporter] ... 49 more
17:11:07.739 [ERROR] [org.gradle.BuildExceptionReporter]
17:11:07.751 [LIFECYCLE] [org.gradle.BuildResultLogger]
17:11:07.752 [LIFECYCLE] [org.gradle.BuildResultLogger] BUILD FAILED

Comment by Benjamin Muschko [ 15/Nov/16 ]

As announced on the Gradle blog we are planning to completely migrate issues from JIRA to GitHub.

We intend to prioritize issues that are actionable and impactful while working more closely with the community. Many of our JIRA issues are inactionable or irrelevant. We would like to request your help to ensure we can appropriately prioritize JIRA issues you’ve contributed to.

Please confirm that you still advocate for your JIRA issue before December 10th, 2016 by:

  • Checking that your issues contain requisite context, impact, behaviors, and examples as described in our published guidelines.
  • Leave a comment on the JIRA issue or open a new GitHub issue confirming that the above is complete.

We look forward to collaborating with you more closely on GitHub. Thank you for your contribution to Gradle!

Comment by Benjamin Muschko [ 10/Feb/17 ]

Thanks again for reporting this issue. We haven't heard back from you after our inquiry from November 15th. We are closing this issue now. Please create an issue on GitHub if you still feel passionate about getting it resolved.

Generated at Wed Jun 30 12:09:34 CDT 2021 using Jira 8.4.2#804003-sha1:d21414fc212e3af190e92c2d2ac41299b89402cf.