When I try to run a freshly created project using Grails 2.5.0:
$ grails create-app test250
$ cd test250
$ grails run-app
I get the following error:
| Running Grails application
| Error java.lang.NoClassDefFoundError: org/apache/commons/logging/LogFactory
| Error at org.grails.plugins.tomcat.fork.ForkedTomcatServer.<clinit>(ForkedTomcatServer.groovy:44)
| Error Caused by: java.lang.ClassNotFoundException: org.apache.commons.logging.LogFactory
| Error at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
| Error at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
| Error at java.security.AccessController.doPrivileged(Native Method)
| Error at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
| Error at java.lang.ClassLoader.loadClass(ClassLoader.java:423)
| Error at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
| Error at java.lang.ClassLoader.loadClass(ClassLoader.java:356)
| Error ... 1 more
Exception in thread "main"
| Error Forked Grails VM exited with error
My machine is running OSX 10.10.2 and I have several projects running on Grails 2.2.5 without problems.
It looks like the problem is that commons-logging is indirectly used by the Tomcat plugin (ForkedTomcatServer extends the Grails ForkedGrailsProcess class which references org.apache.commons.logging.Log) but it's not exported, and it's not a Grails dependency.
It is an indirect dependency of the asset-pipeline plugin, so that should make the jar available and work around the bug for most users. Did you remove asset-pipeline as a dependent plugin in BuildConfig.groovy?
You should be able to get things working by explicitly adding a dependency for commons-logging in BuildConfig.groovy:
dependencies {
runtime 'commons-logging:commons-logging:1.2'
...
}
The problem was solved using GVM (as pointed by Jeff) to manage the different Grails versions installed on my machine.
Related
Java version: 8
Runner: Dataflow
Everything worked before I upgrade to beam 2.5.0. Exception:
Exception in thread "main" java.lang.RuntimeException: Failed to construct instance from factory method DataflowRunner#fromOptions(interface org.apache.beam.sdk.options.PipelineOptions)
at org.apache.beam.sdk.util.InstanceBuilder.buildFromMethod(InstanceBuilder.java:233)
at org.apache.beam.sdk.util.InstanceBuilder.build(InstanceBuilder.java:162)
at org.apache.beam.sdk.PipelineRunner.fromOptions(PipelineRunner.java:55)
at org.apache.beam.sdk.Pipeline.create(Pipeline.java:150)
at com.geotab.bigdata.streaming.mapserver.backfill.MapServerBatchBeamApplication.main(MapServerBatchBeamApplication.java:115)
Caused by: java.lang.reflect.InvocationTargetException
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.apache.beam.sdk.util.InstanceBuilder.buildFromMethod(InstanceBuilder.java:222)
... 4 more
Caused by: java.lang.NoSuchMethodError: com.google.api.client.googleapis.services.json.AbstractGoogleJsonClient$Builder.setBatchPath(Ljava/lang/String;)Lcom/google/api/client/googleapis/services/AbstractGoogleClient$Builder;
at com.google.api.services.storage.Storage$Builder.setBatchPath(Storage.java:9307)
at com.google.api.services.storage.Storage$Builder.<init>(Storage.java:9286)
at org.apache.beam.sdk.util.Transport.newStorageClient(Transport.java:95)
at org.apache.beam.sdk.util.GcsUtil$GcsUtilFactory.create(GcsUtil.java:96)
at org.apache.beam.sdk.util.GcsUtil$GcsUtilFactory.create(GcsUtil.java:84)
at org.apache.beam.sdk.options.ProxyInvocationHandler.returnDefaultHelper(ProxyInvocationHandler.java:592)
at org.apache.beam.sdk.options.ProxyInvocationHandler.getDefault(ProxyInvocationHandler.java:533)
at org.apache.beam.sdk.options.ProxyInvocationHandler.invoke(ProxyInvocationHandler.java:155)
at com.sun.proxy.$Proxy25.getGcsUtil(Unknown Source)
at org.apache.beam.sdk.extensions.gcp.storage.GcsPathValidator.verifyPathIsAccessible(GcsPathValidator.java:88)
at org.apache.beam.sdk.extensions.gcp.storage.GcsPathValidator.validateOutputFilePrefixSupported(GcsPathValidator.java:61)
my gradle config:
dependencies {
compile 'org.apache.beam:beam-runners-direct-java:2.5.0'
compile 'org.apache.beam:beam-runners-reference-parent:2.4.0'
compile 'org.apache.beam:beam-runners-reference-java:2.5.0'
compile ('org.apache.beam:beam-runners-google-cloud-dataflow-java:2.5.0') {
exclude group: 'com.google.guava'
}
compile ('com.google.api-client:google-api-client:1.22.0') {
force = true //version 1.23.0 causes HTTP response 404 not found exception in Beam
//Is this still the case? Which version should I use with beam 2.5.0?
exclude group: 'com.google.guava'
}
compile 'com.google.guava:guava:23.0'
compile 'com.typesafe:config:1.3.2'
compile 'org.apache.httpcomponents:httpclient:4.5.5'
}
Side questions are:
Which google-api-client version is compatible with beam 2.5?
Which com.google.guava:guava version is compatible for beam and google-api-client?
Cloud Dataflow SDK 2.5.0 for Java has the following compile and runtime dependencies:
+-----------------------+-------------------+----------+
| GroupId | ArtifactId | Version |
+-----------------------+-------------------+----------+
| com.google.api-client | google-api-client | 1.23.0 |
| com.google.guava | guava | 20.0 |
+-----------------------+-------------------+----------+
The error indicates that AbstractGoogleClient.Builder is missing. Checking the documentation for the google-api-java-client versions, this was present in 1.19 and 1.20, but from 1.21 onward is not to be found.
According to this GitHub issue report, updating to at least 1.23 solves those kinds of problems. Note also this comment from Nilson Pontello: "You must make a clean build after changing from 1.22.0 to 1.23.0 otherwise old libs will still be used, specially if you are generating war files using maven."
I've imported a Grails project and am attempting to "convert it to grails". When I do this, I"m getting a NoClassDefFound on the apache commons logging package. Where do I add the jar for this? Is this in the IDE's class path, the Grails class path or the app's class path? It does not appear to be in grails-2.2.4/lib. That is the first place I'd expect it. This appears to use Ivy, so should that come as a dependency? Below is the error I'm seeing:
Loading Grails 2.2.4
| Error java.lang.NoClassDefFoundError: org/apache/commons/logging/LogFactory
| Error at org.codehaus.groovy.grails.io.support.PathMatchingResourcePatternResolver.<clinit>(PathMatchingResourcePatternResolver.java:136)
| Error at org.codehaus.groovy.grails.cli.GrailsScriptRunner.getAvailableScripts(GrailsScriptRunner.java:813)
| Error at org.codehaus.groovy.grails.cli.GrailsScriptRunner.executeScriptWithCaching(GrailsScriptRunner.java:423)
| Error at org.codehaus.groovy.grails.cli.GrailsScriptRunner.executeScriptWithCaching(GrailsScriptRunner.java:417)
| Error at org.grails.ide.api.impl.GrailsConnectorImpl.executeCommand(GrailsConnectorImpl.java:160)
| Error at org.grails.ide.eclipse.longrunning.process.GrailsProcess.run(GrailsProcess.java:130)
| Error at org.grails.ide.eclipse.longrunning.process.GrailsProcess.main(GrailsProcess.java:93)
| Error at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
| Error at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
| Error at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
| Error at java.lang.reflect.Method.invoke(Method.java:483)
| Error at org.codehaus.groovy.grails.cli.support.GrailsStarter.rootLoader(GrailsStarter.java:234)
| Error at org.codehaus.groovy.grails.cli.support.GrailsStarter.main(GrailsStarter.java:262)
| Error Caused by: java.lang.ClassNotFoundException: org.apache.commons.logging.LogFactory
| Error at org.codehaus.groovy.tools.RootLoader.findClass(RootLoader.java:175)
| Error at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
| Error at org.codehaus.groovy.tools.RootLoader.loadClass(RootLoader.java:147)
| Error at org.codehaus.groovy.grails.cli.support.GrailsRootLoader.loadClass(GrailsRootLoader.java:52)
| Error at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
| Error ... 13 more
Remove jdk1.8. I had both 1.7 and 1.8 jdks installed and 1.8 was my default runtime for osx. The project was specified as 1.7 but GGTS is looking at the default java runtime. After removing 1.8, it all works as expected.
Grails version 2.4.1 was recently released. One of the bugs fixed was restoring the ability to use servlet version 2.5. See https://jira.grails.org/browse/GRAILS-11466
I created a new grails app. Without changing anything, I was able to compile it and run it. When I changed the grails.servlet.version to "2.5", I was able to compile but when I ran it I got the the following stack trace error.
Does anyone know if there are other settings I need to change to get Grails 2.4.1 to run on a servlet 2.5 container? Specifically, tomcat 6.
Error loading plugin manager: Unable to locate constructor with Class parameter for class org.codehaus.groovy.grails.commons.DefaultGrailsControllerClass (NOTE: Stack trace has been filtered. Use --verbose to see entire trace.)
java.lang.RuntimeException: Unable to locate constructor with Class parameter for class org.codehaus.groovy.grails.commons.DefaultGrailsControllerClass
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1612)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1549)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:539)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:475)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:304)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:228)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:300)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:195)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:684)
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:760)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:482)
at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:403)
at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:306)
at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:106)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4973)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5467)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1559)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1549)
Caused by: java.lang.reflect.InvocationTargetException
at org.springsource.loaded.ri.ReflectiveInterceptor.jlrConstructorNewInstance(ReflectiveInterceptor.java:1002)
... 19 more
Caused by: java.lang.NoClassDefFoundError: Lorg/codehaus/groovy/grails/plugins/web/async/api/ControllersAsyncApi;
at org.springsource.loaded.ri.ReflectiveInterceptor.jlClassGetDeclaredFields(ReflectiveInterceptor.java:1593)
... 20 more
Caused by: java.lang.ClassNotFoundException: org.codehaus.groovy.grails.plugins.web.async.api.ControllersAsyncApi
... 21 more
Error |
Error loading plugin manager: Unable to locate constructor with Class parameter for class org.codehaus.groovy.grails.commons.DefaultGrailsControllerClass
Error |
Forked Grails VM exited with error
Process finished with exit code 1
This error would happen if you didn't do a grails clean prior to running Grails after changing the version to 2.5
What happens is that when the version is 3.0 Grails adds extra dependencies to the classpath that result in new behaviour being added to the compiled classes.
If you then change the version to 2.5 and just do run-app the extra dependencies are gone, but the new behaviour is still compiled into the classes. Doing a clean resolve this.
I'm trying to install a dojo plugin plugin from a local directory, but I get a grails error:
plugin not found.
The problem is that I try to do something kind new for using the dojo 1.9 librery. I am using Ubuntu 10.04, 64 bit architecture, and the Spring IDE GGSTS. I am trying to install default dojo plugin (1.7) on grails from the internet that downloads the plugin to a local directory. The thing lay on the modification of the related plugin, uncompressed it, change the dojo library on web-app/js/dojo directory for the update one dojo 1.9. files. Then uninstall dojo plugin, remove the dojo cache on .grails/ivy-cache/org.grails.pluggin/ and on the .grails/GRAILS_VERSION/project/_PROJECT. After these, only rest the modified plugin installation by install-plugin command. The problem is that grails return an error:
plugin () not found
Loading Grails 2.2.3
| Configuring classpath.
| Environment set to development.....
| Warning The install-plugin command is deprecated and may be removed from a future version of Grails. Plugin dependencies should be expressed in grails-app/conf/BuildConfig.groovy. See http://grails.org/doc/2.2.x/guide/conf.html#pluginDependencies.
| Resolving plugin /home/israel/dojo-1.7.2.0.zip. Please wait...
| Error resolving plugin [name:/home/israel/dojo-1.7.2.0.zip, group:org.grails.plugins, version:latest.integration]. Plugin not found.
| Error Plugin not found for name [/home/israel/dojo-1.7.2.0.zip] and version [not specified]
| Error Error installing plugin: null (Use --stacktrace to see the full trace)
| Error org.codehaus.groovy.grails.cli.ScriptExitException
| Error at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
| Error at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
| Error at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
| Error at java.lang.reflect.Constructor.newInstance(Constructor.java:532)
| Error at org.codehaus.groovy.reflection.CachedConstructor.invoke(CachedConstructor.java:77)
| Error at org.codehaus.groovy.runtime.callsite.ConstructorSite$ConstructorSiteNoUnwrapNoCoerce.callConstructor(ConstructorSite.java:102)
| Error at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallConstructor(CallSiteArray.java:57)
| Error at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callConstructor(AbstractCallSite.java:182)
| Error at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callConstructor(AbstractCallSite.java:194)
| Error at gant.Gant$_dispatch_closure5.doCall(Gant.groovy:391)
| Error at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
| Error at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
| Error at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
| Error at java.lang.reflect.Method.invoke(Method.java:616)
| Error at org.codehaus.groovy.runtime.callsite.PogoMetaMethodSite$PogoCachedMethodSiteNoUnwrapNoCoerce.invoke(PogoMetaMethodSite.java:272)
| Error at org.codehaus.groovy.runtime.callsite.PogoMetaMethodSite.call(PogoMetaMethodSite.java:64)
| Error at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:45)
| Error at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:108)
| Error at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:116)
| Error at gant.Gant$_dispatch_closure7.doCall(Gant.groovy:415)
| Error at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
| Error at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
...
With current Grails version 2.2.3 you are using, install-plugin has been deprecated. You need to define it in your buildConfig. If you have the plugin in maven repository just define it in plugins dsl otherwise you need to define it inline using grails.plugin.location here. Take a look at creating and installing plugins.
I am trying to run grails in my laptop, I have installed jdk 1.8.0 and jre8, I have set JAVA_HOME and GRAILS_HOME correctly. When I type %JAVA_HOME% or %GRAILS_HOME% in command prompt, it displays correct paths. But when I try to run any grails command, I get the following error:
| Loading Grails 2.1.1
| Error java.lang.reflect.InvocationTargetException
| Error at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
| Error at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
| Error at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
| Error at java.lang.reflect.Method.invoke(Method.java:491)
| Error at org.codehaus.groovy.grails.cli.support.GrailsStarter.rootLoader(GrailsStarter.java:234)
| Error at org.codehaus.groovy.grails.cli.support.GrailsStarter.main(GrailsStarter.java:262)
| Error at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
| Error at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
| Error at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
| Error at java.lang.reflect.Method.invoke(Method.java:491)
| Error at org.codehaus.groovy.grails.cli.support.GrailsStarter.rootLoader(GrailsStarter.java:234)
| Error at org.codehaus.groovy.grails.cli.support.GrailsStarter.main(GrailsStarter.java:262)
| Error Caused by: java.lang.NullPointerException: Cannot invoke method getAt() on null object
| Error at grails.util.BuildSettings.configureDependencyManager(BuildSettings.groovy:1208)
| Error at grails.util.BuildSettings$configureDependencyManager.callCurrent(Unknown Source)
| Error at grails.util.BuildSettings.postLoadConfig(BuildSettings.groovy:1121)
| Error at grails.util.BuildSettings.loadConfig(BuildSettings.groovy:1003)
| Error at grails.util.BuildSettings$loadConfig.callCurrent(Unknown Source)
| Error at grails.util.BuildSettings.loadConfig(BuildSettings.groovy:978)
My laptop has windows 8.
Any help regarding this would be greatly appreciated.
I was using java8, I tried using java7 and it worked fine! Apparently grails does not work with java8
grails 2.4 works with jdk - 8. grails 2.1.1 works with jdk - 7.
Switch to Grails 2.5.0 to run on jdk8u40+.
Also, if you are using the IDE GGTS, make sure it is v3.6.4, and that you install Groovy 2.4 from the extensions page to get the show on the road.
for my case, I re-synced the JDK home link. I use quite a few java versions these days.
after install the intrusive jdk1.8.0_51. THE /Library/Java/Home get overridden (maybe in most cases intended). if you just want to play with jdk1.8 and works mainly under other versions, you should link this place back
Now Grails 3+ version support java8 and there are lots of feature with new build system and also integrated spring boot. So you can update your project with grails 3+ version. But you need to Change your application architecture cause of spring boot and gradle build system.