Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Could not create service of type ScriptPluginFactory

My gradle has stopped working all of sudden. Current configuration is that:

  • Environment variable as GRADLE_HOME, pointing to Gradle-3.2.1

Simply ran the command gradle in command prompt, and I get following message:

* What went wrong:
Could not create service of type ScriptPluginFactory using BuildScopeServices.createScriptPluginFactory().

Running with debug gives the following additional message:

23:11:45.439 [INFO] [org.gradle.internal.nativeintegration.services.NativeServices] Initialized native services in: C:\Users\<user>\.gradle\native
23:11:45.486 [DEBUG] [org.gradle.internal.nativeintegration.services.NativeServices] Native-platform posix files is not available.  Continuing with fallback.
23:11:45.486 [DEBUG] [org.gradle.internal.nativeintegration.filesystem.services.FileSystemServices] Using JDK 7 file service org.gradle.internal.nativeintegration.filesystem.jdk7.WindowsJdk7Symlink
23:11:45.924 [DEBUG] [org.gradle.launcher.daemon.client.DaemonClient] Executing build 3b214279-3ced-4a5f-ab1e-457e044f7c3f.1 in daemon client {pid=924}
23:11:45.939 [DEBUG] [org.gradle.internal.remote.internal.inet.InetAddresses] Adding IP addresses for network interface Software Loopback Interface 1
23:11:45.939 [DEBUG] [org.gradle.internal.remote.internal.inet.InetAddresses] Is this a loopback interface? true
23:11:45.939 [DEBUG] [org.gradle.internal.remote.internal.inet.InetAddresses] Is this a multicast interface? true
23:11:45.939 [DEBUG] [org.gradle.internal.remote.internal.inet.InetAddresses] Adding loopback address /127.0.0.1
23:11:45.939 [DEBUG] [org.gradle.internal.remote.internal.inet.InetAddresses] Adding loopback address /0:0:0:0:0:0:0:1
23:11:45.939 [DEBUG] [org.gradle.internal.remote.internal.inet.InetAddresses] Adding loopback multicast interface Software Loopback Interface 1
23:11:45.939 [DEBUG] [org.gradle.internal.remote.internal.inet.InetAddresses] Adding IP addresses for network interface vmxnet3 Ethernet Adapter
23:11:45.939 [DEBUG] [org.gradle.internal.remote.internal.inet.InetAddresses] Is this a loopback interface? false
23:11:45.939 [DEBUG] [org.gradle.internal.remote.internal.inet.InetAddresses] Is this a multicast interface? true
23:11:45.939 [DEBUG] [org.gradle.internal.remote.internal.inet.InetAddresses] Adding remote address /10.172.37.80
23:11:45.939 [DEBUG] [org.gradle.internal.remote.internal.inet.InetAddresses] Adding remote multicast interface vmxnet3 Ethernet Adapter
23:11:45.939 [DEBUG] [org.gradle.internal.remote.internal.inet.InetAddresses] Adding IP addresses for network interface Microsoft Kernel Debug Network Adapter
23:11:45.939 [DEBUG] [org.gradle.internal.remote.internal.inet.InetAddresses] Is this a loopback interface? false
23:11:45.939 [DEBUG] [org.gradle.internal.remote.internal.inet.InetAddresses] Is this a multicast interface? true
23:11:45.939 [DEBUG] [org.gradle.internal.remote.internal.inet.InetAddresses] Adding loopback multicast interface Microsoft Kernel Debug Network Adapter
23:11:45.939 [DEBUG] [org.gradle.internal.remote.internal.inet.InetAddresses] Adding IP addresses for network interface vmxnet3 Ethernet Adapter-WFP Native MAC Layer LightWeight Filter-0000
23:11:45.939 [DEBUG] [org.gradle.internal.remote.internal.inet.InetAddresses] Is this a loopback interface? false
23:11:45.939 [DEBUG] [org.gradle.internal.remote.internal.inet.InetAddresses] Is this a multicast interface? true
23:11:45.939 [DEBUG] [org.gradle.internal.remote.internal.inet.InetAddresses] Adding loopback multicast interface vmxnet3 Ethernet Adapter-WFP Native MAC Layer LightWeight Filter-0000
23:11:45.939 [DEBUG] [org.gradle.internal.remote.internal.inet.InetAddresses] Adding IP addresses for network interface vmxnet3 Ethernet Adapter-Symantec Endpoint Protection Firewall-0000
23:11:45.939 [DEBUG] [org.gradle.internal.remote.internal.inet.InetAddresses] Is this a loopback interface? false
23:11:45.939 [DEBUG] [org.gradle.internal.remote.internal.inet.InetAddresses] Is this a multicast interface? true
23:11:45.939 [DEBUG] [org.gradle.internal.remote.internal.inet.InetAddresses] Adding loopback multicast interface vmxnet3 Ethernet Adapter-Symantec Endpoint Protection Firewall-0000
23:11:45.939 [DEBUG] [org.gradle.internal.remote.internal.inet.InetAddresses] Adding IP addresses for network interface vmxnet3 Ethernet Adapter-QoS Packet Scheduler-0000
23:11:45.939 [DEBUG] [org.gradle.internal.remote.internal.inet.InetAddresses] Is this a loopback interface? false
23:11:45.939 [DEBUG] [org.gradle.internal.remote.internal.inet.InetAddresses] Is this a multicast interface? true
23:11:45.939 [DEBUG] [org.gradle.internal.remote.internal.inet.InetAddresses] Adding loopback multicast interface vmxnet3 Ethernet Adapter-QoS Packet Scheduler-0000
23:11:45.939 [DEBUG] [org.gradle.internal.remote.internal.inet.InetAddresses] Adding IP addresses for network interface vmxnet3 Ethernet Adapter-WFP 802.3 MAC Layer LightWeight Filter-0000
23:11:45.939 [DEBUG] [org.gradle.internal.remote.internal.inet.InetAddresses] Is this a loopback interface? false
23:11:45.955 [DEBUG] [org.gradle.internal.remote.internal.inet.InetAddresses] Is this a multicast interface? true
23:11:45.955 [DEBUG] [org.gradle.internal.remote.internal.inet.InetAddresses] Adding loopback multicast interface vmxnet3 Ethernet Adapter-WFP 802.3 MAC Layer LightWeight Filter-0000
23:11:45.955 [DEBUG] [org.gradle.cache.internal.DefaultFileLockManager] Waiting to acquire shared lock on daemon addresses registry.
23:11:45.955 [DEBUG] [org.gradle.cache.internal.DefaultFileLockManager] Lock acquired.
23:11:46.002 [DEBUG] [org.gradle.cache.internal.DefaultFileLockManager] Releasing lock on daemon addresses registry.
23:11:46.017 [DEBUG] [org.gradle.internal.remote.internal.inet.TcpOutgoingConnector] Attempting to connect to [b4241497-ed70-4c43-8b4f-854517103401 port:53311, addresses:[/127.0.0.1, /0:0:0:0:0:0:0:1]].
23:11:46.017 [DEBUG] [org.gradle.internal.remote.internal.inet.TcpOutgoingConnector] Trying to connect to address /127.0.0.1.
23:11:46.017 [DEBUG] [org.gradle.internal.remote.internal.inet.TcpOutgoingConnector] Connected to address /127.0.0.1:53311.
23:11:46.080 [INFO] [org.gradle.launcher.daemon.client.DaemonClient] Connected to daemon DaemonInfo{pid=7592, address=[b4241497-ed70-4c43-8b4f-854517103401 port:53311, addresses:[/127.0.0.1, /0:0:0:0:0:0:0:1]], state=Idle, lastBusy=1536894331315, context=DefaultDaemonContext[uid=7ee1af1d-8759-44bf-84d3-69e6dd38a351,javaHome=C:\Program Files\Java\jdk1.8.0_144,daemonRegistryDir=C:\Users\<user>\.gradle\daemon,pid=7592,idleTimeout=10800000,daemonOpts=-Xms1g,-Xmx4g,-Dfile.encoding=windows-1252,-Duser.country=US,-Duser.language=en,-Duser.variant]}. Dispatching request Build{id=3b214279-3ced-4a5f-ab1e-457e044f7c3f.1, currentDir=D:\<myProject>}.
23:11:46.080 [DEBUG] [org.gradle.launcher.daemon.client.DaemonClientConnection] thread 1: dispatching class org.gradle.launcher.daemon.protocol.Build
23:11:46.111 [INFO] [org.gradle.launcher.daemon.client.DaemonClient] Received result org.gradle.launcher.daemon.protocol.BuildStarted@198d6542 from daemon DaemonInfo{pid=7592, address=[b4241497-ed70-4c43-8b4f-854517103401 port:53311, addresses:[/127.0.0.1, /0:0:0:0:0:0:0:1]], state=Idle, lastBusy=1536894331315, context=DefaultDaemonContext[uid=7ee1af1d-8759-44bf-84d3-69e6dd38a351,javaHome=C:\Program Files\Java\jdk1.8.0_144,daemonRegistryDir=C:\Users\<user>\.gradle\daemon,pid=7592,idleTimeout=10800000,daemonOpts=-Xms1g,-Xmx4g,-Dfile.encoding=windows-1252,-Duser.country=US,-Duser.language=en,-Duser.variant]} (build should be starting).
23:11:46.111 [INFO] [org.gradle.launcher.daemon.server.exec.LogToClient] The client will now receive all logging from the daemon (pid: 7592). The daemon log file: C:\Users\<user>\.gradle\daemon\3.2.1\daemon-7592.out.log
23:11:46.111 [INFO] [org.gradle.launcher.daemon.server.exec.LogAndCheckHealth] Starting 5th build in daemon [uptime: 11 mins 37.485 secs, performance: 100%, no major garbage collections]
23:11:46.111 [DEBUG] [org.gradle.launcher.daemon.server.exec.ExecuteBuild] The daemon has started executing the build.
23:11:46.111 [INFO] [org.gradle.launcher.daemon.server.exec.ExecuteBuild] Executing build with daemon context: DefaultDaemonContext[uid=7ee1af1d-8759-44bf-84d3-69e6dd38a351,javaHome=C:\Program Files\Java\jdk1.8.0_144,daemonRegistryDir=C:\Users\<user>\.gradle\daemon,pid=7592,idleTimeout=10800000,daemonOpts=-Xms1g,-Xmx4g,-Dfile.encoding=windows-1252,-Duser.country=US,-Duser.language=en,-Duser.variant]
23:11:46.111 [DEBUG] [org.gradle.launcher.daemon.server.exec.ExecuteBuild] The daemon has finished executing the build.
23:11:46.174 [DEBUG] [org.gradle.launcher.daemon.client.DaemonClientInputForwarder] Dispatching close input message: org.gradle.launcher.daemon.protocol.CloseInput@f173c7e
23:11:46.189 [DEBUG] [org.gradle.launcher.daemon.client.DaemonClientConnection] thread 14: dispatching class org.gradle.launcher.daemon.protocol.CloseInput
23:11:46.189 [INFO] [org.gradle.launcher.daemon.client.DaemonClient] Received result Failure[value=org.gradle.internal.service.ServiceCreationException: Could not create service of type ScriptPluginFactory using BuildScopeServices.createScriptPluginFactory().] from daemon DaemonInfo{pid=7592, address=[b4241497-ed70-4c43-8b4f-854517103401 port:53311, addresses:[/127.0.0.1, /0:0:0:0:0:0:0:1]], state=Idle, lastBusy=1536894331315, context=DefaultDaemonContext[uid=7ee1af1d-8759-44bf-84d3-69e6dd38a351,javaHome=C:\Program Files\Java\jdk1.8.0_144,daemonRegistryDir=C:\Users\<user>\.gradle\daemon,pid=7592,idleTimeout=10800000,daemonOpts=-Xms1g,-Xmx4g,-Dfile.encoding=windows-1252,-Duser.country=US,-Duser.language=en,-Duser.variant]} (build should be done).
23:11:46.189 [DEBUG] [org.gradle.launcher.daemon.client.DaemonClientConnection] thread 1: dispatching class org.gradle.launcher.daemon.protocol.Finished
23:11:46.205 [DEBUG] [org.gradle.launcher.daemon.client.DaemonClientConnection] thread 1: connection stop
23:11:46.205 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]
23:11:46.205 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] FAILURE: Build failed with an exception.
23:11:46.205 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]
23:11:46.205 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] * What went wrong:
23:11:46.205 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] Could not create service of type ScriptPluginFactory using BuildScopeServices.createScriptPluginFactory().
23:11:46.205 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]
23:11:46.205 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] * Try:
23:11:46.205 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] Run with --stacktrace option to get the stack trace.

Also ran, full strack trace and received the following:

Caused by: org.gradle.api.GradleException: Could not generate a proxy class for class org.gradle.plugin.repository.internal.DefaultPluginRepositoryFactory.
        at org.gradle.api.internal.AbstractClassGenerator.generateUnderLock(AbstractClassGenerator.java:201)
        at org.gradle.api.internal.AbstractClassGenerator.generate(AbstractClassGenerator.java:64)
        at org.gradle.api.internal.ClassGeneratorBackedInstantiator.newInstance(ClassGeneratorBackedInstantiator.java:36)
        at org.gradle.plugin.use.internal.PluginUsePluginServiceRegistry$BuildScopeServices.createPluginRepositoryFactory(PluginUsePluginServiceRegistry.java:125)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at org.gradle.internal.reflect.JavaMethod.invoke(JavaMethod.java:73)
        at org.gradle.internal.service.DefaultServiceRegistry.invoke(DefaultServiceRegistry.java:462)
        at org.gradle.internal.service.DefaultServiceRegistry.access$1200(DefaultServiceRegistry.java:84)
        at org.gradle.internal.service.DefaultServiceRegistry$FactoryMethodService.invokeMethod(DefaultServiceRegistry.java:796)
        ... 65 more
Caused by: java.lang.IncompatibleClassChangeError: Found interface org.objectweb.asm.MethodVisitor, but class was expected
        at org.gradle.api.internal.AsmBackedClassGenerator$ClassBuilderImpl.addGetter(AsmBackedClassGenerator.java:426)
        at org.gradle.api.internal.AsmBackedClassGenerator$ClassBuilderImpl.addGetter(AsmBackedClassGenerator.java:421)
        at org.gradle.api.internal.AsmBackedClassGenerator$ClassBuilderImpl.mixInDynamicAware(AsmBackedClassGenerator.java:206)
        at org.gradle.api.internal.AbstractClassGenerator.generateUnderLock(AbstractClassGenerator.java:105)

Tried to search around those two exceptions, but to no avail as of yet. Any suggestion or ideas?

like image 404
jkim Avatar asked Sep 14 '18 03:09

jkim


2 Answers

Setting gradle version from 4.7 to 4.8 fixed this issue for me. In gradle-wrapper.properties, use this line instead of old one:

distributionUrl=https://services.gradle.org/distributions/gradle-4.8-all.zip

like image 88
Salih Avatar answered Oct 13 '22 10:10

Salih


I probably broke gradle 4.7 by installing Java JDK 11. The solution was to upgrade gradle.

As I'm using MacOS and as I have installed gradle using homebrew, I've upgraded it like so:

brew upgrade gradle

Now I have gradle 5.0 and it's working perfectly.

like image 33
Codo Avatar answered Oct 13 '22 10:10

Codo