maxieduncan

Friday, 21 May 2010

Grails 1.3.1 and AppEngine causing java.lang.NoClassDefFoundError: for hibernate classes

I recently upgraded to grails 1.3.1 and suddenly got java.lang.NoClassDefFoundError: org/hibernate/MappingException errors when trying to start up my stack locally using grails run-app. It seems that GrailsDomainConfigurationUtil includes this class in it's interface but the hibernate jar isn't being copied into the lib directory. To fix this I copied $GRAILS_HOME/lib/hibernate-core-3.3.1.GA.jar into my projects web-app/WEB-INF/lib directory manually.

I was seeing similar exceptions when I deployed to appengine which the above also resolved.

AppEngine example

org.springframework.beans.factory.access.BootstrapException: Error executing bootstraps; nested exception is java.lang.NoClassDefFoundError: org/hibernate/mapping/SimpleValue

Local development stack trace


[java] INFO: [1274476930651000] javax.servlet.ServletContext log: Initializing Spring root WebApplicationContext
[java] 2010-05-21 21:22:19,825 [Thread-1] ERROR context.ContextLoader  - Context initialization failed
[java] org.springframework.beans.factory.access.BootstrapException: Error executing bootstraps; nested exception is java.lang.NoClassDefFoundError: org/hibernate/MappingException
[java] May 21, 2010 9:22:19 PM com.google.apphosting.utils.jetty.JettyLogger warn
[java] WARNING: Failed startup of context com.google.apphosting.utils.jetty.DevAppEngineWebAppContext@4e0456{/,/Users/maxieduncan/Documents/workspace/maxieduncan/web-app}
[java] org.springframework.beans.factory.access.BootstrapException: Error executing bootstraps; nested exception is java.lang.NoClassDefFoundError: org/hibernate/MappingException
[java] at org.codehaus.groovy.grails.web.context.GrailsContextLoader.createWebApplicationContext(GrailsContextLoader.java:83)
[java] at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:197)
[java] at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:47)
[java] at org.mortbay.jetty.handler.ContextHandler.startContext(ContextHandler.java:548)
[java] at org.mortbay.jetty.servlet.Context.startContext(Context.java:136)
[java] at org.mortbay.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1250)
[java] at org.mortbay.jetty.handler.ContextHandler.doStart(ContextHandler.java:517)
[java] at org.mortbay.jetty.webapp.WebAppContext.doStart(WebAppContext.java:467)
[java] at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:50)
[java] at org.mortbay.jetty.handler.HandlerWrapper.doStart(HandlerWrapper.java:130)
[java] at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:50)
[java] at org.mortbay.jetty.handler.HandlerWrapper.doStart(HandlerWrapper.java:130)
[java] at org.mortbay.jetty.Server.doStart(Server.java:224)
[java] at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:50)
[java] at com.google.appengine.tools.development.JettyContainerService.startContainer(JettyContainerService.java:185)
[java] at com.google.appengine.tools.development.AbstractContainerService.startup(AbstractContainerService.java:146)
[java] at com.google.appengine.tools.development.DevAppServerImpl.start(DevAppServerImpl.java:222)
[java] at com.google.appengine.tools.development.DevAppServerMain$StartAction.apply(DevAppServerMain.java:171)
[java] at com.google.appengine.tools.util.Parser$ParseResult.applyArgs(Parser.java:48)
[java] at com.google.appengine.tools.development.DevAppServerMain.(DevAppServerMain.java:120)
[java] at com.google.appengine.tools.development.DevAppServerMain.main(DevAppServerMain.java:96)
[java] Caused by: java.lang.NoClassDefFoundError: org/hibernate/MappingException
[java] at org.codehaus.groovy.grails.commons.GrailsDomainConfigurationUtil.evaluateConstraints(GrailsDomainConfigurationUtil.java:358)
[java] at org.codehaus.groovy.grails.commons.GrailsDomainConfigurationUtil.evaluateConstraints(GrailsDomainConfigurationUtil.java:426)
[java] at org.codehaus.groovy.grails.commons.DefaultGrailsDomainClass.refreshConstraints(DefaultGrailsDomainClass.java:747)
[java] at org.codehaus.groovy.grails.commons.DefaultGrailsApplication.refreshConstraints(DefaultGrailsApplication.java:468)
[java] at org.codehaus.groovy.grails.commons.spring.GrailsRuntimeConfigurator.configure(GrailsRuntimeConfigurator.java:181)
[java] at org.codehaus.groovy.grails.commons.spring.GrailsRuntimeConfigurator.configure(GrailsRuntimeConfigurator.java:129)
[java] at org.codehaus.groovy.grails.web.context.GrailsConfigUtils.configureWebApplicationContext(GrailsConfigUtils.java:114)
[java] at org.codehaus.groovy.grails.web.context.GrailsContextLoader.createWebApplicationContext(GrailsContextLoader.java:70)
[java] ... 20 more

1 comment:

  1. I ran into the same issue with Grails 1.3.1. This seems to be fixed with 1.3.5.

    Ben

    ReplyDelete