Talend Startup error, Talend twebservice component error - web-services

I have encountered a problem with one of my twebservice components, which seems to originate from the apache cxf jar. I see the error during startup also.
WARN [org.apache.cxf.bus.extension.ExtensionManagerImpl] Loading Bus extensions via META-INF/cxf/bus-extensions.xml (found url jar:file:/data5/TalendEE/jboss-4.2.2.GA/server/default/tmp/deploy/tmp3204124133425837210tem.ear-contents/lib/z.cxf-2.2.5.jar!/META-INF/cxf/bus-extensions.xml) is deprecated. Use META-INF/cxf/bus-extensions.txt instead.
Caused by: java.lang.ClassNotFoundException: Unexpected error during load of: org.apache.cxf.ws.policy.AssertionBuilderRegistry, msg=Implementing class
at org.jboss.mx.loading.RepositoryClassLoader.loadClassImpl(RepositoryClassLoader.java:560)
at org.jboss.mx.loading.RepositoryClassLoader.loadClass(RepositoryClassLoader.java:415)
at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
... 164 more
Caused by: java.lang.IncompatibleClassChangeError: Implementing class
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClassCond(ClassLoader.java:632)
at java.lang.ClassLoader.defineClass(ClassLoader.java:616)

Related

java.lang.NoClassDefFoundError for clojure.java.api.Clojure

we are struggling here with a java.lang.NoClassDefFoundError that makes no sense.
The same WAR file runs perfectly in the server B, but throws a java.lang.NoClassDefFoundError on server A.
Configurations are:
Server A (throws Exception):
OS:
NAME="SLES"
VERSION="12-SP4"
VERSION_ID="12.4"
PRETTY_NAME="SUSE Linux Enterprise Server 12 SP4"
Apache Tomcat 8.5.49
Oracle Java dk1.8.0_231
Server B (works perfectly):
OS:
NAME="Ubuntu"
VERSION="16.04.6 LTS (Xenial Xerus)"
ID=ubuntu
ID_LIKE=debian
VERSION_ID="16.04"
PRETTY_NAME="Ubuntu 16.04.6 LTS"
Apache Tomcat 8.5.37
Oracle Java jdk 1.8.0_201-b09
The exception is:
2020-01-27 15:57:27.103 [http-nio-8081-exec-10] ERROR o.g.w.errors.GrailsExceptionResolver - NoClassDefFoundError occurred when processing request: [GET] /server-0.1/cenario/getCenarioJson
Could not initialize class clojure.java.api.Clojure. Stacktrace follows:
org.springframework.web.util.NestedServletException: Handler dispatch failed; nested exception is java.lang.NoClassDefFoundError: Could not initialize class clojure.java.api.Clojure
at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:982)
at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:901)
at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:970)
...
at java.lang.Thread.run(Thread.java:748)
Caused by: java.lang.NoClassDefFoundError: Could not initialize class clojure.java.api.Clojure
at com.nitryx.brkmopt.util.ClojureHandler.invoke(ClojureHandler.java:176)
at com.nitryx.brkmopt.util.ClojureHandler.invoke(ClojureHandler.java:173)
at com.nitryx.brkmopt.CenarioService.$tt__getCenarioJson(CenarioService.groovy:35)
...
The WAR file runs perfectly on server B but throws the exception on server A.
We inspected the ~/WEB-INF/lib/ folder under tomcat, and the necessary dependency (clojure-1.9.0.jar) is there and is consistent. On a desperate action, we have even tried to replace the jar file for a newer one manually, and it did not work.
From Why am I getting a NoClassDefFoundError in Java? :
java.lang.NoClassDefFoundError This exception indicates that the JVM
looked in its internal class definition data structure for the
definition of a class and did not find it. This is different than
saying that it could not be loaded from the classpath. Usually this
indicates that we previously attempted to load a class from the
classpath, but it failed for some reason
Please advise!
Edit:
Full stacktrace: (many thanks to clojurians #jumar #alexmiller #ghadi #seancorfield)
2020-02-05 16:00:02.342 [http-nio-8081-exec-10] ERROR o.g.w.errors.GrailsExceptionResolver - NoClassDefFoundError occurred when processing request: [GET] /server-0.1/cenario/getCenarioJson
Could not initialize class clojure.java.api.Clojure. Stacktrace follows:
org.springframework.web.util.NestedServletException: Handler dispatch failed; nested exception is java.lang.NoClassDefFoundError: Could not initialize class clojure.java.api.Clojure
at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:982)
at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:901)
at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:970)
at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:861)
at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:846)
at net.bull.javamelody.MonitoringFilter.doFilter(MonitoringFilter.java:239)
at net.bull.javamelody.MonitoringFilter.doFilter(MonitoringFilter.java:215)
at org.springframework.boot.web.filter.ApplicationContextHeaderFilter.doFilterInternal(ApplicationContextHeaderFilter.java:55)
at net.bull.javamelody.MonitoringFilter.doFilter(MonitoringFilter.java:239)
at net.bull.javamelody.MonitoringFilter.doFilter(MonitoringFilter.java:215)
at org.grails.web.servlet.mvc.GrailsWebRequestFilter.doFilterInternal(GrailsWebRequestFilter.java:77)
at org.grails.web.filters.HiddenHttpMethodFilter.doFilterInternal(HiddenHttpMethodFilter.java:67)
at org.springframework.boot.web.support.ErrorPageFilter.doFilter(ErrorPageFilter.java:130)
at org.springframework.boot.web.support.ErrorPageFilter.access$000(ErrorPageFilter.java:66)
at org.springframework.boot.web.support.ErrorPageFilter$1.doFilterInternal(ErrorPageFilter.java:105)
at org.springframework.boot.web.support.ErrorPageFilter.doFilter(ErrorPageFilter.java:123)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
Caused by: java.lang.NoClassDefFoundError: Could not initialize class clojure.java.api.Clojure
at com.nitryx.brkmopt.util.ClojureHandler.invoke(ClojureHandler.java:176)
at com.nitryx.brkmopt.util.ClojureHandler.invoke(ClojureHandler.java:173)
at com.nitryx.brkmopt.CenarioService.$tt__getCenarioJson(CenarioService.groovy:35)
at grails.melody.plugin.MelodyInterceptorEnhancer$_enhance_closure1$_closure2.doCall(MelodyInterceptorEnhancer.groovy:77)
at grails.gorm.transactions.GrailsTransactionTemplate$2.doInTransaction(GrailsTransactionTemplate.groovy:94)
at org.springframework.transaction.support.TransactionTemplate.execute(TransactionTemplate.java:133)
at grails.gorm.transactions.GrailsTransactionTemplate.execute(GrailsTransactionTemplate.groovy:91)
at grails.melody.plugin.MelodyInterceptorEnhancer$_enhance_closure1$_closure2.doCall(MelodyInterceptorEnhancer.groovy:77)
at com.nitryx.brkmopt.CenarioController.getCenarioJson(CenarioController.groovy:20)
at org.grails.core.DefaultGrailsControllerClass$MethodHandleInvoker.invoke(DefaultGrailsControllerClass.java:223)
at org.grails.core.DefaultGrailsControllerClass.invoke(DefaultGrailsControllerClass.java:188)
at org.grails.web.mapping.mvc.UrlMappingsInfoHandlerAdapter.handle(UrlMappingsInfoHandlerAdapter.groovy:90)
at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:967)
... 18 common frames omitted
It looks like Tomcat 8.5.50 contains a bunch of regression fixes in Catalina with resource loading which may be affecting the loading of Clojure source files. Suggest either downgrading to same as the working one or upgrading to 8.5.50.
https://tomcat.apache.org/tomcat-8.5-doc/changelog.html

Is there a way localy publish Webservice Endpoints With IBM JRE

I'm trying to write a test for a Webservice using the approach described at http://antoniogoncalves.org/2012/10/24/no-you-dont-need-to-mock-your-soap-web-service-to-test-it/
But on calling Endpoint.publish I get the following exception
java.lang.NoClassDefFoundError: com.ibm.ffdc.impl.Ffdc
at com.ibm.ffdc.Manager.<clinit>(Unknown Source)
at java.lang.J9VMInternals.initializeImpl(Native Method)
at java.lang.J9VMInternals.initialize(J9VMInternals.java:235)
at com.ibm.ws.ffdc.FFDCFilter.processException(FFDCFilter.java:82)
at com.ibm.ws.webservices.engine.components.logger.LogFactory$2.run(LogFactory.java:159)
at com.ibm.ws.security.util.AccessController.doPrivileged(AccessController.java:63)
at com.ibm.ws.webservices.engine.components.logger.LogFactory.createLogFactory(LogFactory.java:141)
at com.ibm.ws.webservices.engine.components.logger.LogFactory.<clinit>(LogFactory.java:98)
at java.lang.J9VMInternals.initializeImpl(Native Method)
at java.lang.J9VMInternals.initialize(J9VMInternals.java:235)
at com.ibm.ws.webservices.engine.soap.MessageFactoryImpl.<clinit>(MessageFactoryImpl.java:103)
at java.lang.J9VMInternals.initializeImpl(Native Method)
at java.lang.J9VMInternals.initialize(J9VMInternals.java:235)
at com.ibm.ws.webservices.engine.soap.SAAJMetaFactoryImpl.newMessageFactory(SAAJMetaFactoryImpl.java:56)
at javax.xml.soap.MessageFactory.newInstance(MessageFactory.java:143)
at com.sun.xml.internal.ws.api.SOAPVersion.<init>(SOAPVersion.java:179)
at com.sun.xml.internal.ws.api.SOAPVersion.<clinit>(SOAPVersion.java:84)
at java.lang.J9VMInternals.initializeImpl(Native Method)
at java.lang.J9VMInternals.initialize(J9VMInternals.java:235)
at com.sun.xml.internal.ws.api.BindingID.<clinit>(BindingID.java:336)
at java.lang.J9VMInternals.initializeImpl(Native Method)
at java.lang.J9VMInternals.initialize(J9VMInternals.java:235)
at com.sun.xml.internal.ws.spi.ProviderImpl.createAndPublishEndpoint(ProviderImpl.java:104)
at javax.xml.ws.Endpoint.publish(Endpoint.java:181)
at <junit stuff>
Caused by: java.lang.ClassNotFoundException: com.ibm.ffdc.impl.Ffdc
at java.net.URLClassLoader.findClass(URLClassLoader.java:434)
at java.lang.ClassLoader.loadClassHelper(ClassLoader.java:701)
at java.lang.ClassLoader.loadClass(ClassLoader.java:680)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:358)
at java.lang.ClassLoader.loadClass(ClassLoader.java:663)
... 48 more
Which is I assume because I'm running in an IBM JRE (Websphere 8.0.x) (Thx for the condolence)
Can I use Endpoint.publish in a IBM JRE, without starting a complete Websphere?
The test or the JRE configuration that produced this stack trace has somehow included com.ibm.ws classes that are shipped with Websphere. If you have removed all reference to Websphere classes from your test, then you could get a standalone JRE with no Websphere changes to test with. You can download for AIX, Linux or z/OS from:
https://www.ibm.com/developerworks/java/jdk/

java.lang.ExceptionInInitializerError groovy compiler loading error

I am getting below error when I executing my JUnit test case. I am using Expectations plugin for Grails Domain Test case.
BuildConfig.groovy file code:
plugins {
compile ":domain-expectations:0.6.1"
}
Error which I am getting:
java.lang.ExceptionInInitializerError
at org.codehaus.groovy.runtime.InvokerHelper.<clinit>(InvokerHelper.java:61)
at org.codehaus.groovy.runtime.callsite.CallSiteArray.createCallStaticSite(CallSiteArray.java:72)
at org.codehaus.groovy.runtime.callsite.CallSiteArray.createCallSite(CallSiteArray.java:159)
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:45)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:108)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:116)
at com.lonecyprus.grails.test.Specification.<clinit>(Specification.groovy)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:526)
at junit.framework.TestSuite.createTest(TestSuite.java:63)
at junit.framework.TestSuite.addTestMethod(TestSuite.java:310)
at junit.framework.TestSuite.addTestsFromTestCase(TestSuite.java:153)
at junit.framework.TestSuite.<init>(TestSuite.java:132)
at org.junit.internal.runners.JUnit38ClassRunner.<init>(JUnit38ClassRunner.java:72)
at org.junit.internal.builders.JUnit3Builder.runnerForClass(JUnit3Builder.java:11)
at org.junit.runners.model.RunnerBuilder.safeRunnerForClass(RunnerBuilder.java:59)
at org.junit.internal.builders.AllDefaultPossibilitiesBuilder.runnerForClass(AllDefaultPossibilitiesBuilder.java:26)
at org.junit.runners.model.RunnerBuilder.safeRunnerForClass(RunnerBuilder.java:59)
at org.junit.internal.requests.ClassRequest.getRunner(ClassRequest.java:26)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.<init>(JUnit4TestReference.java:33)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestClassReference.<init>(JUnit4TestClassReference.java:25)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestLoader.createTest(JUnit4TestLoader.java:48)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestLoader.loadTests(JUnit4TestLoader.java:38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:444)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:675)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:382)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:192)
Caused by: groovy.lang.GroovyRuntimeException: Conflicting module versions. Module [groovy-all is loaded in version 2.3.10 and you are trying to load version 2.3.7
at org.codehaus.groovy.runtime.metaclass.MetaClassRegistryImpl$DefaultModuleListener.onModule(MetaClassRegistryImpl.java:509)
at org.codehaus.groovy.runtime.m12n.ExtensionModuleScanner.scanExtensionModuleFromProperties(ExtensionModuleScanner.java:77)
at org.codehaus.groovy.runtime.m12n.ExtensionModuleScanner.scanExtensionModuleFromMetaInf(ExtensionModuleScanner.java:71)
at org.codehaus.groovy.runtime.m12n.ExtensionModuleScanner.scanClasspathModules(ExtensionModuleScanner.java:53)
at org.codehaus.groovy.runtime.metaclass.MetaClassRegistryImpl.<init>(MetaClassRegistryImpl.java:110)
at org.codehaus.groovy.runtime.metaclass.MetaClassRegistryImpl.<init>(MetaClassRegistryImpl.java:71)
at groovy.lang.GroovySystem.<clinit>(GroovySystem.java:33)
... 29 more
It means that you have 2 versions of Groovy on classpath: 2.3.10 and 2.3.7. One is probably brought by Grails while the other is by the plugin, which means they are incompatible. You should try to exclude Groovy from the plugin dependency.
maybe you had use groovy in two different denpendencies. For example : in com.jayway.restassured and io.rest-assured, both of them include groovy-xml.
For this 1st of you have chack the version of groovy in Maven Dependencies library and Built path. Version of groovy should be match so that this error will go else error will come because of version conflict.

How to resolve a Camel-CXF Web Service client ClassNotFoundException

I'm having a painful time resolving a Camel-CXF ClassNotFoundException. I've included a sample program exhibiting the problem
You can find the source code at:
git#bitbucket.org:levonk/camel-cxf-example.git
To run the program after checking out the project run:
mvn test exec:java
Here is the exception stack trace:
Caused by: org.apache.camel.FailedToCreateRouteException: Failed to create route route1: Route(route1)[[From[cxf://http://www.webservicex.net/globalw... because of Failed to resolve endpoint: cxf://http://www.webservicex.net/globalweather.asmx/GetWeather?publishedEndpointUrl=http%3A%2F%2Fwww.webservicex.net%2Fglobalweather.asmx&serviceClass=net.webservicex.GlobalWeather.class due to: net.webservicex.GlobalWeather.class
at org.apache.camel.model.RouteDefinition.addRoutes(RouteDefinition.java:181)
at org.apache.camel.impl.DefaultCamelContext.startRoute(DefaultCamelContext.java:750)
at org.apache.camel.impl.DefaultCamelContext.startRouteDefinitions(DefaultCamelContext.java:1829)
at org.apache.camel.impl.DefaultCamelContext.doStartCamel(DefaultCamelContext.java:1609)
at org.apache.camel.impl.DefaultCamelContext.doStart(DefaultCamelContext.java:1478)
at org.apache.camel.support.ServiceSupport.start(ServiceSupport.java:61)
at org.apache.camel.impl.DefaultCamelContext.start(DefaultCamelContext.java:1446)
at org.apache.camel.main.Main.doStart(Main.java:109)
at org.apache.camel.support.ServiceSupport.start(ServiceSupport.java:61)
at org.apache.camel.main.MainSupport.run(MainSupport.java:148)
at org.apache.camel.main.MainSupport.run(MainSupport.java:343)
at com.levonk.app.example.camel.MainApp.main(MainApp.java:17)
... 6 more
Caused by: org.apache.camel.ResolveEndpointFailedException: Failed to resolve endpoint: cxf://http://www.webservicex.net/globalweather.asmx/GetWeather?publishedEndpointUrl=http%3A%2F%2Fwww.webservicex.net%2Fglobalweather.asmx&serviceClass=net.webservicex.GlobalWeather.class due to: net.webservicex.GlobalWeather.class
at org.apache.camel.impl.DefaultCamelContext.getEndpoint(DefaultCamelContext.java:508)
at org.apache.camel.util.CamelContextHelper.getMandatoryEndpoint(CamelContextHelper.java:62)
at org.apache.camel.model.RouteDefinition.resolveEndpoint(RouteDefinition.java:191)
at org.apache.camel.impl.DefaultRouteContext.resolveEndpoint(DefaultRouteContext.java:108)
at org.apache.camel.impl.DefaultRouteContext.resolveEndpoint(DefaultRouteContext.java:114)
at org.apache.camel.model.FromDefinition.resolveEndpoint(FromDefinition.java:72)
at org.apache.camel.impl.DefaultRouteContext.getEndpoint(DefaultRouteContext.java:90)
at org.apache.camel.model.RouteDefinition.addRoutes(RouteDefinition.java:861)
at org.apache.camel.model.RouteDefinition.addRoutes(RouteDefinition.java:176)
... 17 more
Caused by: java.lang.ClassNotFoundException: net.webservicex.GlobalWeather.class
at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
at java.lang.ClassLoader.loadClass(ClassLoader.java:423)
at java.lang.ClassLoader.loadClass(ClassLoader.java:356)
at org.apache.cxf.common.classloader.ClassLoaderUtils.loadClass2(ClassLoaderUtils.java:287)
at org.apache.cxf.common.classloader.ClassLoaderUtils.loadClass(ClassLoaderUtils.java:261)
at org.apache.camel.component.cxf.CxfEndpoint.setServiceClass(CxfEndpoint.java:653)
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.apache.camel.util.IntrospectionSupport.setProperty(IntrospectionSupport.java:492)
at org.apache.camel.util.IntrospectionSupport.setProperty(IntrospectionSupport.java:546)
at org.apache.camel.util.IntrospectionSupport.setProperties(IntrospectionSupport.java:434)
at org.apache.camel.util.EndpointHelper.setProperties(EndpointHelper.java:249)
at org.apache.camel.impl.DefaultComponent.setProperties(DefaultComponent.java:258)
at org.apache.camel.component.cxf.CxfComponent.createEndpoint(CxfComponent.java:84)
at org.apache.camel.impl.DefaultComponent.createEndpoint(DefaultComponent.java:119)
at org.apache.camel.impl.DefaultCamelContext.getEndpoint(DefaultCamelContext.java:488)
... 25 more
This is an issue with the maven Exec Maven plugin not picking up the classes generated from your WSDL at runtime.
The correct way to do structure this sort of thing in Maven is to separate your WSDL -> Java generation out into a seperate project, and add a dependency on that project in your cxf-client. This way, the generated code is just a dependency like any other. See https://github.com/FuseByExample/smx-ws-examples for an example of how to do this.

Any alternative to #GrabConfig?

I'm using the javax.mail library to send emails that may or may not contain attachments.
I'm also using Groovy 2.0.6 for writing this script and am developing it in Eclipse and running unit tests using Gradle 1.5. The script I'm writing will be deployed in a jar to many different locations in the future. Therefore, the javax.mail needs to be referenced to from my script and not just manually added to the machine's classpath.
To do this, I am using the following statements in my script:
#GrabConfig(systemClassLoader=true)
#Grab(group='javax.mail', module='mail', version='1.4.7')
My issue is that I am unable to run unit tests with Gradle while the #GrabConfig statement is included. It runs fine with just the #Grab statement but fails when the #GrabConfig is in there. The error message I'm receiving is:
:compileJava UP-TO-DATE
:compileGroovy
startup failed:
General error during conversion: No suitable ClassLoader found for grab
java.lang.RuntimeException: No suitable ClassLoader found for grab
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
at org.codehaus.groovy.reflection.CachedConstructor.invoke(CachedConstructor.java:77)
at org.codehaus.groovy.runtime.callsite.ConstructorSite$ConstructorSiteNoUnwrapNoCoerce.callConstructor(ConstructorSite.java:102)
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallConstructor(CallSiteArray.java:57)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callConstructor(AbstractCallSite.java:182)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callConstructor(AbstractCallSite.java:190)
at groovy.grape.GrapeIvy.chooseClassLoader(GrapeIvy.groovy:181)
at groovy.grape.GrapeIvy$chooseClassLoader.callCurrent(Unknown Source)
at groovy.grape.GrapeIvy.grab(GrapeIvy.groovy:247)
at groovy.grape.Grape.grab(Grape.java:141)
at groovy.grape.GrabAnnotationTransformation.visit(GrabAnnotationTransformation.java:312)
at org.codehaus.groovy.transform.ASTTransformationVisitor$3.call(ASTTransformationVisitor.java:319)
at org.codehaus.groovy.control.CompilationUnit.applyToSourceUnits(CompilationUnit.java:903)
at org.codehaus.groovy.control.CompilationUnit.doPhaseOperation(CompilationUnit.java:566)
at org.codehaus.groovy.control.CompilationUnit.processPhaseOperations(CompilationUnit.java:542)
at org.codehaus.groovy.control.CompilationUnit.compile(CompilationUnit.java:519)
at org.codehaus.groovy.control.CompilationUnit.compile(CompilationUnit.java:498)
at org.gradle.api.internal.tasks.compile.ApiGroovyCompiler.execute(ApiGroovyCompiler.java:118)
at org.gradle.api.internal.tasks.compile.ApiGroovyCompiler.execute(ApiGroovyCompiler.java:39)
at org.gradle.api.internal.tasks.compile.daemon.CompilerDaemonServer.execute(CompilerDaemonServer.java:52)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.gradle.messaging.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:35)
at org.gradle.messaging.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:24)
at org.gradle.messaging.remote.internal.hub.MessageHub$Handler.run(MessageHub.java:355)
at org.gradle.internal.concurrent.DefaultExecutorFactory$StoppableExecutorImpl$1.run(DefaultExecutorFactory.java:66)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:662)
1 error
:compileGroovy FAILED
FAILURE: Build failed with an exception.
According to No suitable classloader found for grab , #GrabConfig makes code untestable.
Is there any alternative to #GrabConfig for my situation?
You can use the gradle-one-jar plugin to package your own and third-party code into a single executable Jar. Alternatively, you can use Gradle's application plugin to create a Zip distribution with start scripts.
You can disable grapes in build.gradle like so:
test {
systemProperty 'groovy.grape.enable', 'false'
}
compileGroovy {
groovyOptions.forkOptions.jvmArgs = [ '-Dgroovy.grape.enable=false' ]
}
compileTestGroovy {
groovyOptions.forkOptions.jvmArgs = [ '-Dgroovy.grape.enable=false' ]
}