Grails

test-app is broken after upgrade to garils-1.2.1

Details

  • Type: Bug Bug
  • Status: Closed Closed
  • Priority: Major Major
  • Resolution: Fixed
  • Affects Version/s: 1.2.1
  • Fix Version/s: 1.2.2, 1.3-M1
  • Component/s: Testing
  • Labels:
    None
  • Environment:
    Windows XP, grails-1.2.1,grails-functional-test-1.2.7,JDK-1.6

Description

Test project has been attached. It works well in grails-1.2.0

Looks the bug only affect "test-app" without any test phase argument.

"grails run-app" and browse "http://localhost:8080/testExample/book" is ok.

"grails test-app functional:" is also fine.

but

"grails test-app" will throw exceptions:

Running test test.BookFunctionalTests...2010-02-02 15:07:52,812 [http-8080-1] ERROR hibernate.LazyInitializationException  - could not initialize proxy - no Session
org.hibernate.LazyInitializationException: could not initialize proxy - no Session
        at org.hibernate.proxy.AbstractLazyInitializer.initialize(AbstractLazyInitializer.java:86)
        at org.codehaus.groovy.grails.orm.hibernate.cfg.GrailsHibernateUtil.unwrapProxy(GrailsHibernateUtil.java:321)
        at org.codehaus.groovy.grails.orm.hibernate.cfg.GrailsHibernateUtil$unwrapProxy.call(Unknown Source)
        at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:40)
        at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:117)
        at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:125)
        at org.codehaus.groovy.grails.plugins.orm.hibernate.HibernatePluginSupport$__clinit__closure88.doCall(HibernatePluginSupport.groovy:401)
        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.codehaus.groovy.runtime.callsite.PogoMetaMethodSite$PogoCachedMethodSiteNoUnwrapNoCoerce.invoke(PogoMetaMethodSite.java:266)
        at org.codehaus.groovy.runtime.callsite.PogoMetaMethodSite.callCurrent(PogoMetaMethodSite.java:51)
        at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallCurrent(CallSiteArray.java:44)
        at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:143)
        at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:151)
        at org.codehaus.groovy.grails.plugins.orm.hibernate.HibernatePluginSupport$__clinit__closure88.call(HibernatePluginSupport.groovy)
        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.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:86)
        at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:234)
        at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1049)
        at groovy.lang.ExpandoMetaClass.invokeMethod(ExpandoMetaClass.java:923)
        at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:880)
        at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:924)
        at groovy.lang.ExpandoMetaClass.invokeMethod(ExpandoMetaClass.java:923)
        at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:880)
        at org.codehaus.groovy.runtime.InvokerHelper.invokePogoMethod(InvokerHelper.java:739)
        at org.codehaus.groovy.runtime.InvokerHelper.invokeMethod(InvokerHelper.java:722)
        at org.codehaus.groovy.runtime.metaclass.ClosureMetaMethod$1.invoke(ClosureMetaMethod.java:135)
        at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:234)
        at groovy.lang.MetaClassImpl.getProperty(MetaClassImpl.java:1594)
        at groovy.lang.ExpandoMetaClass.getProperty(ExpandoMetaClass.java:951)
        at groovy.lang.MetaClassImpl.getProperty(MetaClassImpl.java:3287)
        at groovy.lang.ExpandoMetaClass.getProperty(ExpandoMetaClass.java:964)
        at org.codehaus.groovy.runtime.callsite.PogoMetaClassGetPropertySite.getProperty(PogoMetaClassGetPropertySite.java:48)
        at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callGetProperty(AbstractCallSite.java:237)
        at test.BookController$_closure1.doCall(BookController.groovy:6)
        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.codehaus.groovy.runtime.callsite.PogoMetaMethodSite$PogoCachedMethodSite.invoke(PogoMetaMethodSite.java:225)
        at org.codehaus.groovy.runtime.callsite.PogoMetaMethodSite.callCurrent(PogoMetaMethodSite.java:51)
        at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallCurrent(CallSiteArray.java:44)
        at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:143)
        at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:151)
        at test.BookController$_closure1.doCall(BookController.groovy)
        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.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:86)
        at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:234)
        at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1049)
        at groovy.lang.ExpandoMetaClass.invokeMethod(ExpandoMetaClass.java:923)
        at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:880)
        at groovy.lang.Closure.call(Closure.java:279)
        at groovy.lang.Closure.call(Closure.java:274)
        at org.codehaus.groovy.grails.web.servlet.mvc.SimpleGrailsControllerHelper.handleAction(SimpleGrailsControllerHelper.java:377)
        at org.codehaus.groovy.grails.web.servlet.mvc.SimpleGrailsControllerHelper.executeAction(SimpleGrailsControllerHelper.java:244)
        at org.codehaus.groovy.grails.web.servlet.mvc.SimpleGrailsControllerHelper.handleURI(SimpleGrailsControllerHelper.java:202)
        at org.codehaus.groovy.grails.web.servlet.mvc.SimpleGrailsControllerHelper.handleURI(SimpleGrailsControllerHelper.java:137)
        at org.codehaus.groovy.grails.web.servlet.mvc.SimpleGrailsController.handleRequest(SimpleGrailsController.java:88)
        at org.springframework.web.servlet.mvc.SimpleControllerHandlerAdapter.handle(SimpleControllerHandlerAdapter.java:48)
        at org.codehaus.groovy.grails.web.servlet.GrailsDispatcherServlet.doDispatch(GrailsDispatcherServlet.java:255)
        at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:716)
        at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:647)
        at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:552)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:707)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
        at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:70)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
        at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:70)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
        at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:70)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
        at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:646)
        at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:436)
        at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:374)
        at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:302)
        at org.codehaus.groovy.grails.web.util.WebUtils.forwardRequestForUrlMappingInfo(WebUtils.java:302)
        at org.codehaus.groovy.grails.web.util.WebUtils.forwardRequestForUrlMappingInfo(WebUtils.java:278)
        at org.codehaus.groovy.grails.web.util.WebUtils.forwardRequestForUrlMappingInfo(WebUtils.java:270)
        at org.codehaus.groovy.grails.web.mapping.filter.UrlMappingsFilter.doFilterInternal(UrlMappingsFilter.java:187)
        at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
        at org.codehaus.groovy.grails.web.sitemesh.GrailsPageFilter.obtainContent(GrailsPageFilter.java:249)
        at org.codehaus.groovy.grails.web.sitemesh.GrailsPageFilter.doFilter(GrailsPageFilter.java:140)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
        at org.codehaus.groovy.grails.web.servlet.mvc.GrailsWebRequestFilter.doFilterInternal(GrailsWebRequestFilter.java:65)
        at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
        at org.codehaus.groovy.grails.web.filters.HiddenHttpMethodFilter.doFilterInternal(HiddenHttpMethodFilter.java:66)
        at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
        at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:88)
        at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)
        at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:237)
        at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:167)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
        at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
        at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
        at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
        at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
        at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
        at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293)
        at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:849)
        at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
        at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:454)
        at java.lang.Thread.run(Thread.java:619)
2010-02-02 15:07:52,827 [http-8080-1] ERROR errors.GrailsExceptionResolver  - could not initialize proxy - no Session
org.hibernate.LazyInitializationException: could not initialize proxy - no Session
        at test.BookController$_closure1.doCall(BookController.groovy:6)
        at test.BookController$_closure1.doCall(BookController.groovy)
        at java.lang.Thread.run(Thread.java:619)
2010-02-02 15:07:53,156 [http-8080-1] ERROR [Tomcat].[localhost]  - Exception Processing ErrorPage[errorCode=500, location=/grails-errorhandler]
java.lang.IllegalStateException: Cannot reset buffer after response has been committed
        at org.apache.catalina.connector.Response.resetBuffer(Response.java:691)
        at org.apache.catalina.core.StandardHostValve.custom(StandardHostValve.java:409)
        at org.apache.catalina.core.StandardHostValve.status(StandardHostValve.java:343)
        at org.apache.catalina.core.StandardHostValve.throwable(StandardHostValve.java:287)
        at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:142)
        at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
        at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
        at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293)
        at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:849)
        at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
        at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:454)
        at java.lang.Thread.run(Thread.java:619)

                    testSomeWebsiteFeature...FAILED
Tests Completed in 1782ms ...
-------------------------------------------------------
Tests passed: 0
Tests failed: 1
-------------------------------------------------------

Issue Links

Activity

Hide
Luke Daley added a comment -

This was introduced in this change: http://github.com/grails/grails/commit/178a1f4833d95c384ea826469d5603be13e8a255

Just need to add

appCtx?.close()

in to integrationTestPhaseCleanUp in $GRAILS_HOME/scripts/_GrailsTest.groovy which you could do to your local copy for the meantime until 1.2.2 is released.

Show
Luke Daley added a comment - This was introduced in this change: http://github.com/grails/grails/commit/178a1f4833d95c384ea826469d5603be13e8a255 Just need to add
appCtx?.close()
in to integrationTestPhaseCleanUp in $GRAILS_HOME/scripts/_GrailsTest.groovy which you could do to your local copy for the meantime until 1.2.2 is released.
Hide
Yiguang Hu added a comment -

My application has the same problem after upgrading from 1.0.3 to 1.2.1. What do I do then to fix this?

Show
Yiguang Hu added a comment - My application has the same problem after upgrading from 1.0.3 to 1.2.1. What do I do then to fix this?
Hide
Luke Daley added a comment -

See my comment above yours for how to locally patch your Grails install to work around this.

Show
Luke Daley added a comment - See my comment above yours for how to locally patch your Grails install to work around this.
Hide
Yiguang Hu added a comment -

My local does not have those scripts/_G*.groovy. My env was upgraded to 1.2.1 from 1.0.3. So I copy the _GrailsTest.groovy to my $GRAILS_HOME/scripts directory and add appCtx?.close()
in to integrationTestPhaseCleanUp

integrationTestPhaseCleanUp = {
appCtx?.close()
destroyPersistenceContext()
}

and build and test. The problem is still there. Do I miss anything?

Show
Yiguang Hu added a comment - My local does not have those scripts/_G*.groovy. My env was upgraded to 1.2.1 from 1.0.3. So I copy the _GrailsTest.groovy to my $GRAILS_HOME/scripts directory and add appCtx?.close() in to integrationTestPhaseCleanUp integrationTestPhaseCleanUp = { appCtx?.close() destroyPersistenceContext() } and build and test. The problem is still there. Do I miss anything?

People

Vote (2)
Watch (1)

Dates

  • Created:
    Updated:
    Resolved: