Gradle will not run


(Graham Webber) #1

Hi, Gradle was working fine last week, then all of a sudden I am getting this error when I try to run any gradle build commands. The only thing I can think that has changed is I updated Java 6 to Java 7 and consequently from Apples Java implementation to Oracles. But I have that on another Mac and Gradle still runs fine. Any ideas?

Gradle Details ------------------------------------------------------------ Gradle 1.4 ------------------------------------------------------------

Gradle build time: Monday, 28 January 2013 3:42:46 AM UTC Groovy: 1.8.6 Ant: Apache Ant™ version 1.8.4 compiled on May 22 2012 Ivy: 2.2.0 JVM: 1.7.0_13 (Oracle Corporation 23.7-b01) OS: Mac OS X 10.8.2 x86_64

Exception:

java.lang.reflect.InvocationTargetException

at org.springsource.ide.eclipse.gradle.core.util.GradleRunnable.run(GradleRunnable.java:93)

at org.eclipse.jface.operation.ModalContext$ModalContextThread.run(ModalContext.java:121) Caused by: org.eclipse.core.runtime.CoreException: Unable to start the daemon process. This problem might be caused by incorrect configuration of the daemon. For example, an unrecognized jvm option is used. Please refer to the user guide chapter on the daemon at http://gradle.org/docs/1.3/userguide/gradle_daemon.html Please read below process output to find out more: ----------------------- log4j:WARN No appenders could be found for logger (org.gradle.launcher.daemon.bootstrap.DaemonMain). log4j:WARN Please initialize the log4j system properly.

at org.springsource.ide.eclipse.gradle.core.GradleModelProvider$GroupedModelProvider.ensureModels(GradleModelProvider.java:277)

at org.springsource.ide.eclipse.gradle.core.GradleProject.getGradleModel(GradleProject.java:604)

at org.springsource.ide.eclipse.gradle.core.GradleProject.getSkeletalGradleModel(GradleProject.java:625)

at org.springsource.ide.eclipse.gradle.ui.wizards.GradleImportWizardPageOne$11.doit(GradleImportWizardPageOne.java:514)

at org.springsource.ide.eclipse.gradle.core.util.GradleRunnable.run(GradleRunnable.java:85)

… 1 more Caused by: org.gradle.tooling.GradleConnectionException: Could not fetch model of type ‘HierarchicalEclipseProject’ using Gradle distribution ‘http://services.gradle.org/distributions/gradle-1.3-bin.zip’.

at org.gradle.tooling.internal.consumer.ResultHandlerAdapter.onFailure(ResultHandlerAdapter.java:55)

at org.gradle.tooling.internal.consumer.async.DefaultAsyncConnection$2.run(DefaultAsyncConnection.java:71)

at org.gradle.internal.concurrent.DefaultExecutorFactory$StoppableExecutorImpl$1.run(DefaultExecutorFactory.java:66)

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)

This is what is in the log file under ~/.gradle/daemon/1.4/daemon-*.log

FAILURE: Build aborted because of an internal error.

  • What went wrong: Build aborted because of an unexpected internal error. Please file an issue at: http://forums.gradle.org.

  • Try: Run with --debug option to get additional debug info.

  • Exception is: java.lang.ClassCastException: org.slf4j.impl.Log4jLoggerFactory cannot be cast to ch.qos.logback.classic.LoggerContext

at org.gradle.logging.internal.logback.LogbackLoggingConfigurer.doFailSafeConfiguration(LogbackLoggingConfigurer.java:86)

at org.gradle.logging.internal.logback.LogbackLoggingConfigurer.configure(LogbackLoggingConfigurer.java:61)

at org.gradle.logging.internal.DefaultLoggingConfigurer.configure(DefaultLoggingConfigurer.java:37)

at org.gradle.logging.internal.LoggingSystemAdapter.setLevel(LoggingSystemAdapter.java:55)

at org.gradle.logging.internal.LoggingSystemAdapter.on(LoggingSystemAdapter.java:42)

at org.gradle.logging.internal.DefaultLoggingManager$StartableLoggingSystem.start(DefaultLoggingManager.java:171)

at org.gradle.logging.internal.DefaultLoggingManager.start(DefaultLoggingManager.java:60)

at org.gradle.logging.internal.DefaultLoggingManager.start(DefaultLoggingManager.java:31)

at org.gradle.launcher.daemon.bootstrap.DaemonMain.initialiseLogging(DaemonMain.java:169)

at org.gradle.launcher.daemon.bootstrap.DaemonMain.doAction(DaemonMain.java:102)

at org.gradle.launcher.bootstrap.EntryPoint.run(EntryPoint.java:45)

at org.gradle.launcher.daemon.bootstrap.DaemonMain.main(DaemonMain.java:82)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)

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

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

at org.gradle.launcher.bootstrap.ProcessBootstrap.runNoExit(ProcessBootstrap.java:50)

at org.gradle.launcher.bootstrap.ProcessBootstrap.run(ProcessBootstrap.java:32)

at org.gradle.launcher.daemon.bootstrap.GradleDaemon.main(GradleDaemon.java:22)

Daemon vm is shutting down… The daemon has exited normally or was terminated in response to a user interrupt.


(Graham Webber) #2

Bump


(Luke Daley) #3

It’s likely you’ve installed something that has either modified your JDK installation, or has messed with your ‘JAVA_OPTS’ env var.

Given that you are running from Eclipse, it could be a change in Eclipse that is causing Gradle to be run with a different environment. Do you get the same error when running Gradle directly?


(Graham Webber) #4

Hey Luke, thanks for that. Below is the part of the log that shows all the env variables. Is there anything in there that looks suspicious?

10:49:44.736 [INFO] [org.gradle.launcher.daemon.client.DefaultDaemonConnector] Starting Gradle daemon 10:49:44.755 [DEBUG] [org.gradle.launcher.daemon.client.DefaultDaemonStarter] Using daemon opts: [-Xms128m, -Xmx256m, -Dfile.encoding=UTF-8] 10:49:44.757 [INFO] [org.gradle.launcher.daemon.client.DefaultDaemonStarter] Starting daemon process: workingDir = /Users/gman/.gradle/daemon/1.4, daemonArgs: [/Library/Java/JavaVirtualMachines/jdk1.7.0_13.jdk/Contents/Home/bin/java, -Xms128m, -Xmx256m, -Dfile.encoding=UTF-8, -cp, /Volumes/Maestro/Work/Tools/gradle-1.4/lib/gradle-launcher-1.4.jar, org.gradle.launcher.daemon.bootstrap.GradleDaemon, 1.4, /Users/gman/.gradle/daemon, 10800000, ec73ee4a-f892-4cb0-9391-3d0c4eaf23d5, -Xms128m, -Xmx256m, -Dfile.encoding=UTF-8] 10:49:44.777 [INFO] [org.gradle.process.internal.DefaultExecHandle] Starting process ‘Gradle build daemon’. Working directory: /Users/gman/.gradle/daemon/1.4 Command: /Library/Java/JavaVirtualMachines/jdk1.7.0_13.jdk/Contents/Home/bin/java -Xms128m -Xmx256m -Dfile.encoding=UTF-8 -cp /Volumes/Maestro/Work/Tools/gradle-1.4/lib/gradle-launcher-1.4.jar org.gradle.launcher.daemon.bootstrap.GradleDaemon 1.4 /Users/gman/.gradle/daemon 10800000 ec73ee4a-f892-4cb0-9391-3d0c4eaf23d5 -Xms128m -Xmx256m -Dfile.encoding=UTF-8 10:49:44.778 [DEBUG] [org.gradle.process.internal.DefaultExecHandle] Environment for process ‘Gradle build daemon’: {OLDPWD=/Volumes/Maestro/Work/Tools/gradle-1.4, TERM=xterm-256color, SHELL=/bin/bash, TMPDIR=/var/folders/qf/0k6jylyn3s9_20xzkg53l6r40000gn/T/, TERM_PROGRAM_VERSION=309, SHLVL=1, APP_ICON_82894=/Volumes/Maestro/Work/Tools/gradle-1.4/media/gradle.icns, __CF_USER_TEXT_ENCODING=0x1F5:0:0, TERM_PROGRAM=Apple_Terminal, PATH=/opt/local/bin:/opt/local/sbin:/Volumes/Maestro/Work/Tools/gradle-1.4/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/opt/X11/bin:/usr/local/git/bin, COMMAND_MODE=unix2003, APP_NAME_82894=Gradle, DISPLAY=/tmp/launch-G2aXKE/org.macosforge.xquartz:0, USER=gman, JAVA_MAIN_CLASS_82894=org.gradle.launcher.GradleMain, com.apple.java.jvmTask=CommandLine, JAVA_OPTS=-Djava.ext.dirs=, PWD=/Users/gman, JAVA_ARCH=x86_64, TERM_SESSION_ID=98DB1333-B1C7-45AF-B72C-DB3C50482876, HOME=/Users/gman, LOGNAME=gman, Apple_Ubiquity_Message=/tmp/launch-njUL6t/Apple_Ubiquity_Message, Apple_PubSub_Socket_Render=/tmp/launch-9HWfST/Render, SSH_AUTH_SOCK=/tmp/launch-9CTBob/Listeners, LANG=en_AU.UTF-8}


(Luke Daley) #5

‘-Djava.ext.dirs=,’ looks pretty suspicious.

That shouldn’t cause a problem on its own, but it’s a red flag that something has messed with your environment (or at least I think it is).

Something may have touched your JDK install. I’d suggest comparing it with a known working version and seeing if there are any extra files in the broken one.


#6

It looks like slf4j-log4j.jar is ending up on the classpath used to launch Gradle, conflicting with logback-classic.jar. If you haven’t added anything to the Gradle distribution’s lib directory, then the jar might be coming from something in the environment. Some options:

  • Via the ‘$GRADLE_OPTS’ or ‘$JAVA_OPTS’ environment variables * In ‘$JAVA_HOME/lib/ext’ or ‘/Library/Java/Extensions’ * Using a non-standard ‘java’ launcher in $JAVA_HOME/bin

You may get a hint if you run ‘gradle tasks --debug’ and check the output for lines like:

SLF4J: Class path contains multiple SLF4J bindings.
 SLF4J: Found binding in...

(Graham Webber) #7

Hey guys, thanks for your help and sorry for the late reply.

I found log4j, slf4j-api and slf4j-log4j12 in /Library/Java/Extensions. I have no idea how they got there, but once I removed them gradle worked as normal.

I guess I now just wait for some other application to fall over to see who the culprit was.

Thanks again for your help.


(brendtos) #8

@Graham Webber that you so much for solving my issue. New to Gradle I’ve been grappling for days trying to move and existing project across and the project dependancies setup. Got it all running on my Macbook but couldn’t get it on my iMac and your solution resolved the exact error I was seeing above. Thanks!