Embedded GlassFish inside Grails - grails

I'm using Grails 2.2.3 together with the Grails GlassFish plugin: http://grails.org/plugin/glassfish
So far, everything works as expected (run-app), except integration testing that in my understanding should startup/tear down a GlassFish instance as well.
When I try to run integration tests, I get a weird exception (see below).
It seems like if I run test-app :integration, the GlassFish instance is not started by Grails.
Any ideas?
Here's the exception:
Testing started at 18:58 ...
| Loading Grails 2.2.3
| Configuring classpath
| Error SLF4J: Class path contains multiple SLF4J bindings.
| Error SLF4J: Found binding in [jar:file:/Users/markus/.grails/ivy-cache/org.slf4j/slf4j-log4j12/jars/slf4j-log4j12-1.6.6.jar!/org/slf4j/impl/StaticLoggerBinder.class]
| Error SLF4J: Found binding in [jar:file:/Users/markus/.grails/ivy-cache/org.glassfish.main.extras/glassfish-embedded-all/jars/glassfish-embedded-all-3.1.2.jar!/org/slf4j/impl/StaticLoggerBinder.class]
| Error SLF4J: Found binding in [jar:file:/Users/markus/.grails/ivy-cache/org.grails/grails-plugin-log4j/jars/grails-plugin-log4j-2.2.3.jar!/org/slf4j/impl/StaticLoggerBinder.class]
| Error SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
| Error SLF4J: Actual binding is of type [org.slf4j.impl.Log4jLoggerFactory]
| Configuring classpath.
| Environment set to test
| Environment set to test.
| Environment set to test..
| Environment set to test...
| Environment set to test....
| Environment set to test.....
| Packaging Grails application
| Packaging Grails application.
| Packaging Grails application..
| Packaging Grails application...
| Packaging Grails application....
| Packaging Grails application.....
26.06.2013 18:58:44 com.sun.enterprise.v3.server.CommonClassLoaderServiceImpl findDerbyClient
INFO: Cannot find javadb client jar file, derby jdbc driver will not be available by default.
| Packaging Grails application
| Packaging Grails application.
| Packaging Grails application..
| Packaging Grails application...
| Packaging Grails application...
| Packaging Grails application....
| Packaging Grails application.....
| Error org.omg.CORBA.COMM_FAILURE: FEIN: IOP00410001: Connection failure: socketType: IIOP_CLEAR_TEXT; hostname: localhost; port: 3700 vmcid: OMG minor code: 1 completed: No
| Error at sun.reflect.GeneratedConstructorAccessor51.newInstance(Unknown Source)
| Error at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
| Error at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
| Error at com.sun.corba.ee.spi.orbutil.logex.corba.CorbaExtension.makeException(CorbaExtension.java:248)
| Error at com.sun.corba.ee.spi.orbutil.logex.corba.CorbaExtension.makeException(CorbaExtension.java:95)
| Error at com.sun.corba.ee.spi.orbutil.logex.WrapperGenerator.handleFullLogging(WrapperGenerator.java:387)
| Error at com.sun.corba.ee.spi.orbutil.logex.WrapperGenerator.access$400(WrapperGenerator.java:107)
| Error at com.sun.corba.ee.spi.orbutil.logex.WrapperGenerator$2.invoke(WrapperGenerator.java:511)
| Error at com.sun.corba.ee.spi.orbutil.proxy.CompositeInvocationHandlerImpl.invoke(CompositeInvocationHandlerImpl.java:99)
| Error at com.sun.proxy.$Proxy32.connectFailure(Unknown Source)

Related

What is Thread-12 error in Grails Project while run the application

Exception in thread "Thread-12"
Error |
java.lang.IllegalStateException: No file extensions list found for path not being watched
Error |
at org.codehaus.groovy.grails.compiler.WatchServiceDirectoryWatcher.run(WatchServiceDirectoryWatcher.java:87)
Error |
at org.codehaus.groovy.grails.compiler.DirectoryWatcher.run(DirectoryWatcher.java:154)
Error |
at org.codehaus.groovy.grails.project.compiler.GrailsProjectWatcher.run(GrailsProjectWatcher.java:161)

grails 2.4.0 - java.lang.RuntimeException: Reloading agent exited via exception

I am getting the "java.lang.RuntimeException: Reloading agent exited via exception" error while running grails app. Previously it was working fine. Suddenly I am getting this error. And I am not able to run application.
Full stacktrace as follows
|Loading Grails 2.4.0
|Configuring classpath
.
|Environment set to development
.................................
|Packaging Grails application
..
|Compiling 10 source files
Error |
java.lang.RuntimeException: Reloading agent exited via exception, please raise a jira
Error |
at org.springsource.loaded.agent.ClassPreProcessorAgentAdapter.transform(ClassPreProcessorAgentAdapter.java:104)
Error |
at sun.instrument.TransformerManager.transform(TransformerManager.java:188)
Error |
at sun.instrument.InstrumentationImpl.transform(InstrumentationImpl.java:424)
Error |
at java.lang.ClassLoader.defineClass1(Native Method)
Error |
at java.lang.ClassLoader.defineClass(ClassLoader.java:800)
Error |
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
Error |
at java.net.URLClassLoader.defineClass(URLClassLoader.java:449)
Error |
at java.net.URLClassLoader.access$100(URLClassLoader.java:71)
Error |
at java.net.URLClassLoader$1.run(URLClassLoader.java:361)
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:425)
Error |
at groovy.lang.GroovyClassLoader.loadClass(GroovyClassLoader.java:655)
Error |
at groovy.lang.GroovyClassLoader.loadClass(GroovyClassLoader.java:523)
Error |
at org.codehaus.groovy.control.ClassNodeResolver.tryAsLoaderClassOrScript(ClassNodeResolver.java:183)
Error |
at org.codehaus.groovy.control.ClassNodeResolver.findClassNode(ClassNodeResolver.java:168)
Error |
at org.codehaus.groovy.control.ClassNodeResolver.resolveName(ClassNodeResolver.java:124)
Error |
at org.codehaus.groovy.control.ResolveVisitor.resolveToOuter(ResolveVisitor.java:617)
Error |
at org.codehaus.groovy.control.ResolveVisitor.resolve(ResolveVisitor.java:269)
Error |
at org.codehaus.groovy.control.ResolveVisitor.resolveFromModule(ResolveVisitor.java:551)
Error |
at org.codehaus.groovy.control.ResolveVisitor.resolve(ResolveVisitor.java:269)
Error |
at org.codehaus.groovy.control.ResolveVisitor.resolve(ResolveVisitor.java:237)
Error |
at org.codehaus.groovy.control.ResolveVisitor.resolveOrFail(ResolveVisitor.java:221)
Error |
at org.codehaus.groovy.control.ResolveVisitor.resolveOrFail(ResolveVisitor.java:233)
Error |
at org.codehaus.groovy.control.ResolveVisitor.transformConstructorCallExpression(ResolveVisitor.java:988)
Error |
at org.codehaus.groovy.control.ResolveVisitor.transform(ResolveVisitor.java:647)
Error |
at org.codehaus.groovy.control.ResolveVisitor.transformBinaryExpression(ResolveVisitor.java:956)
Error |
at org.codehaus.groovy.control.ResolveVisitor.transform(ResolveVisitor.java:641)
Error |
at org.codehaus.groovy.ast.ClassCodeExpressionTransformer.visitExpressionStatement(ClassCodeExpressionTransformer.java:139)
Error |
at org.codehaus.groovy.ast.stmt.ExpressionStatement.visit(ExpressionStatement.java:40)
Error |
at org.codehaus.groovy.ast.CodeVisitorSupport.visitBlockStatement(CodeVisitorSupport.java:35)
Error |
at org.codehaus.groovy.ast.ClassCodeVisitorSupport.visitBlockStatement(ClassCodeVisitorSupport.java:163)
Error |
at org.codehaus.groovy.control.ResolveVisitor.visitBlockStatement(ResolveVisitor.java:1259)
Error |
at org.codehaus.groovy.ast.stmt.BlockStatement.visit(BlockStatement.java:69)
Solved!!!
Delete grails installation folder (GRAILS_HOME), and recreate.

NoClassDefFoundError on grails run-app (Grails 2.5.0)

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.

GGTS Convert to Grails fails with NoClassDefFoundError

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.

installing a local dojo plugin on grails 2.2.3

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.

Resources