Grails
  1. Grails
  2. GRAILS-269

Grails controller fails on Glassfish App Server

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 0.3
    • Fix Version/s: 0.4
    • Component/s: Controllers
    • Labels:
      None
    • Environment:
      Grails 0.2 & Grails SVN at 0.3 both have controller issues on Glassfish

      Description

      There seems to be an issue somewhere in Grails controller code that causes Grails apps to fail on Glassfish (b48).

      To reproduce:
      grails create-app simple
      grails create-domain-class account
      (add name field to account)
      grails generate-all account
      grails war

      Deploy to glassfish and access /simple/account. You will get a stack trace like the one shown below. If you access /simple/account/list things will be just fine. This might be a variation on GRAILS-190. Perhaps Glassfish is more strict about the redirection stuff than the other app servers.

      Servlet.service() for servlet grails threw exception java.io.FileNotFoundException: /WEB-INF/grails-app/views/account/index.jsp
      at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:385)
      at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:317)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
      at org.apache.catalina.core.ApplicationFilterChain.servletService(ApplicationFilterChain.java:397)
      at org.apache.catalina.core.ApplicationDispatcher.doInvoke(ApplicationDispatcher.java:850)
      at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:697)
      at org.apache.catalina.core.ApplicationDispatcher.doInclude(ApplicationDispatcher.java:654)
      at org.apache.catalina.core.ApplicationDispatcher.include(ApplicationDispatcher.java:568)
      at org.springframework.web.servlet.view.InternalResourceView.renderMergedOutputModel(InternalResourceView.java:91)
      at org.springframework.web.servlet.view.AbstractView.render(AbstractView.java:250)
      at org.springframework.web.servlet.DispatcherServlet.render(DispatcherServlet.java:961)
      at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:738)
      at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:658)
      at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:392)
      at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:347)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:707)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
      at org.apache.catalina.core.ApplicationFilterChain.servletService(ApplicationFilterChain.java:397)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:184)
      at com.opensymphony.module.sitemesh.filter.PageFilter.parsePage(PageFilter.java:119)
      at com.opensymphony.module.sitemesh.filter.PageFilter.doFilter(PageFilter.java:55)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:216)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:184)
      at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:75)
      at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)
      at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:137)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:216)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:184)
      at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:276)
      at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:566)
      at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:536)
      at org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java:240)
      at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:179)
      at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:566)
      at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:73)
      at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:182)
      at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:566)
      at com.sun.enterprise.web.VirtualServerPipeline.invoke(VirtualServerPipeline.java:120)
      at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:939)
      at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:137)
      at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:566)
      at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:536)
      at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:939)
      at org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:231)
      at com.sun.enterprise.web.connector.grizzly.ProcessorTask.invokeAdapter(ProcessorTask.java:667)
      at com.sun.enterprise.web.connector.grizzly.ProcessorTask.processNonBlocked(ProcessorTask.java:574)
      at com.sun.enterprise.web.connector.grizzly.ProcessorTask.process(ProcessorTask.java:844)
      at com.sun.enterprise.web.connector.grizzly.ReadTask.executeProcessorTask(ReadTask.java:287)
      at com.sun.enterprise.web.connector.grizzly.ReadTask.doTask(ReadTask.java:212)
      at com.sun.enterprise.web.connector.grizzly.TaskBase.run(TaskBase.java:252)
      at com.sun.enterprise.web.connector.grizzly.WorkerThread.run(WorkerThread.java:75)

        Activity

        Hide
        Changshin Lee added a comment -

        Hi,

        Is any work on this issue in progress? I would also like to help solve this.

        Cheers,

        Ias

        Show
        Changshin Lee added a comment - Hi, Is any work on this issue in progress? I would also like to help solve this. Cheers, Ias
        Hide
        Glen Smith added a comment -

        Have tested this against Sun Java System Application Server Platform Edition 9.0_01 (build b02-p01) - also known as V1 UR1 P0 (latest patched production version of Glassfish v1) and now getting 404s on all Controller operations.

        Following instructions for "simple" at the top of this bug, the home page of Grails app displays, but no controllers are found, and any controller operation (/simple/account/list) generates a 404.

        Also, when deploying more than one grails application to the server, generates the error "Choose unique values for the 'webAppRootKey' context-param in your web.xml files" and fails to start application (may need some mods to the template as discussed here (http://www.discursive.com/discursive/BlogEntry.do?entryId=10)

        Stack trace shown below:

        Web app root system property already set to different value: 'webapp.root' = [C:\java_apps\glassfish\domains\domain1\applications\j2ee-modules\simple] instead of [C:\java_apps\glassfish\domains\domain1\applications\j2ee-modules\groogle] - Choose unique values for the 'webAppRootKey' context-param in your web.xml files!
        at org.springframework.web.util.WebUtils.setWebAppRootSystemProperty(WebUtils.java:132)
        at org.springframework.web.util.Log4jWebConfigurer.initLogging(Log4jWebConfigurer.java:117)
        at org.springframework.web.util.Log4jConfigListener.contextInitialized(Log4jConfigListener.java:51)
        at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4236)
        at org.apache.catalina.core.StandardContext.start(StandardContext.java:4760)
        at com.sun.enterprise.web.WebModule.start(WebModule.java:292)
        at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:833)
        at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:817)
        at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:662)
        at com.sun.enterprise.web.WebContainer.loadWebModule(WebContainer.java:1479)
        at com.sun.enterprise.web.WebContainer.loadWebModule(WebContainer.java:1143)
        at com.sun.enterprise.server.WebModuleDeployEventListener.moduleDeployed(WebModuleDeployEventListener.java:171)
        at com.sun.enterprise.server.WebModuleDeployEventListener.moduleDeployed(WebModuleDeployEventListener.java:275)
        at com.sun.enterprise.admin.event.AdminEventMulticaster.invokeModuleDeployEventListener(AdminEventMulticaster.java:954)
        at com.sun.enterprise.admin.event.AdminEventMulticaster.handleModuleDeployEvent(AdminEventMulticaster.java:941)
        at com.sun.enterprise.admin.event.AdminEventMulticaster.processEvent(AdminEventMulticaster.java:448)
        at com.sun.enterprise.admin.event.AdminEventMulticaster.multicastEvent(AdminEventMulticaster.java:160)
        at com.sun.enterprise.admin.server.core.DeploymentNotificationHelper.multicastEvent(DeploymentNotificationHelper.java:296)
        at com.sun.enterprise.deployment.phasing.DeploymentServiceUtils.multicastEvent(DeploymentServiceUtils.java:203)
        at com.sun.enterprise.deployment.phasing.ServerDeploymentTarget.sendStartEvent(ServerDeploymentTarget.java:285)
        at com.sun.enterprise.deployment.phasing.ApplicationStartPhase.runPhase(ApplicationStartPhase.java:119)
        at com.sun.enterprise.deployment.phasing.DeploymentPhase.executePhase(DeploymentPhase.java:95)
        at com.sun.enterprise.deployment.phasing.PEDeploymentService.executePhases(PEDeploymentService.java:871)
        at com.sun.enterprise.deployment.phasing.PEDeploymentService.start(PEDeploymentService.java:541)
        at com.sun.enterprise.deployment.phasing.PEDeploymentService.start(PEDeploymentService.java:585)
        at com.sun.enterprise.admin.mbeans.ApplicationsConfigMBean.start(ApplicationsConfigMBean.java:719)
        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 com.sun.enterprise.admin.MBeanHelper.invokeOperationInBean(MBeanHelper.java:353)
        at com.sun.enterprise.admin.MBeanHelper.invokeOperationInBean(MBeanHelper.java:336)
        at com.sun.enterprise.admin.config.BaseConfigMBean.invoke(BaseConfigMBean.java:448)
        at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke(DefaultMBeanServerInterceptor.java:836)
        at com.sun.jmx.mbeanserver.JmxMBeanServer.invoke(JmxMBeanServer.java:761)
        at sun.reflect.GeneratedMethodAccessor15.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at com.sun.enterprise.admin.util.proxy.ProxyClass.invoke(ProxyClass.java:77)
        at $Proxy1.invoke(Unknown Source)
        at com.sun.enterprise.admin.server.core.jmx.SunoneInterceptor.invoke(SunoneInterceptor.java:297)
        at com.sun.enterprise.deployment.client.DeploymentClientUtils.startApplication(DeploymentClientUtils.java:133)
        at com.sun.enterprise.deployment.client.DeployAction.run(DeployAction.java:517)
        at java.lang.Thread.run(Thread.java:619)

        Show
        Glen Smith added a comment - Have tested this against Sun Java System Application Server Platform Edition 9.0_01 (build b02-p01) - also known as V1 UR1 P0 (latest patched production version of Glassfish v1) and now getting 404s on all Controller operations. Following instructions for "simple" at the top of this bug, the home page of Grails app displays, but no controllers are found, and any controller operation (/simple/account/list) generates a 404. Also, when deploying more than one grails application to the server, generates the error "Choose unique values for the 'webAppRootKey' context-param in your web.xml files" and fails to start application (may need some mods to the template as discussed here ( http://www.discursive.com/discursive/BlogEntry.do?entryId=10 ) Stack trace shown below: Web app root system property already set to different value: 'webapp.root' = [C:\java_apps\glassfish\domains\domain1\applications\j2ee-modules\simple] instead of [C:\java_apps\glassfish\domains\domain1\applications\j2ee-modules\groogle] - Choose unique values for the 'webAppRootKey' context-param in your web.xml files! at org.springframework.web.util.WebUtils.setWebAppRootSystemProperty(WebUtils.java:132) at org.springframework.web.util.Log4jWebConfigurer.initLogging(Log4jWebConfigurer.java:117) at org.springframework.web.util.Log4jConfigListener.contextInitialized(Log4jConfigListener.java:51) at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4236) at org.apache.catalina.core.StandardContext.start(StandardContext.java:4760) at com.sun.enterprise.web.WebModule.start(WebModule.java:292) at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:833) at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:817) at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:662) at com.sun.enterprise.web.WebContainer.loadWebModule(WebContainer.java:1479) at com.sun.enterprise.web.WebContainer.loadWebModule(WebContainer.java:1143) at com.sun.enterprise.server.WebModuleDeployEventListener.moduleDeployed(WebModuleDeployEventListener.java:171) at com.sun.enterprise.server.WebModuleDeployEventListener.moduleDeployed(WebModuleDeployEventListener.java:275) at com.sun.enterprise.admin.event.AdminEventMulticaster.invokeModuleDeployEventListener(AdminEventMulticaster.java:954) at com.sun.enterprise.admin.event.AdminEventMulticaster.handleModuleDeployEvent(AdminEventMulticaster.java:941) at com.sun.enterprise.admin.event.AdminEventMulticaster.processEvent(AdminEventMulticaster.java:448) at com.sun.enterprise.admin.event.AdminEventMulticaster.multicastEvent(AdminEventMulticaster.java:160) at com.sun.enterprise.admin.server.core.DeploymentNotificationHelper.multicastEvent(DeploymentNotificationHelper.java:296) at com.sun.enterprise.deployment.phasing.DeploymentServiceUtils.multicastEvent(DeploymentServiceUtils.java:203) at com.sun.enterprise.deployment.phasing.ServerDeploymentTarget.sendStartEvent(ServerDeploymentTarget.java:285) at com.sun.enterprise.deployment.phasing.ApplicationStartPhase.runPhase(ApplicationStartPhase.java:119) at com.sun.enterprise.deployment.phasing.DeploymentPhase.executePhase(DeploymentPhase.java:95) at com.sun.enterprise.deployment.phasing.PEDeploymentService.executePhases(PEDeploymentService.java:871) at com.sun.enterprise.deployment.phasing.PEDeploymentService.start(PEDeploymentService.java:541) at com.sun.enterprise.deployment.phasing.PEDeploymentService.start(PEDeploymentService.java:585) at com.sun.enterprise.admin.mbeans.ApplicationsConfigMBean.start(ApplicationsConfigMBean.java:719) 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 com.sun.enterprise.admin.MBeanHelper.invokeOperationInBean(MBeanHelper.java:353) at com.sun.enterprise.admin.MBeanHelper.invokeOperationInBean(MBeanHelper.java:336) at com.sun.enterprise.admin.config.BaseConfigMBean.invoke(BaseConfigMBean.java:448) at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke(DefaultMBeanServerInterceptor.java:836) at com.sun.jmx.mbeanserver.JmxMBeanServer.invoke(JmxMBeanServer.java:761) at sun.reflect.GeneratedMethodAccessor15.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at com.sun.enterprise.admin.util.proxy.ProxyClass.invoke(ProxyClass.java:77) at $Proxy1.invoke(Unknown Source) at com.sun.enterprise.admin.server.core.jmx.SunoneInterceptor.invoke(SunoneInterceptor.java:297) at com.sun.enterprise.deployment.client.DeploymentClientUtils.startApplication(DeploymentClientUtils.java:133) at com.sun.enterprise.deployment.client.DeployAction.run(DeployAction.java:517) at java.lang.Thread.run(Thread.java:619)
        Hide
        Graeme Rocher added a comment -

        I've tested this with my local version of Glassfish and the latest SVN head without issues

        How do you find out the version that is installed? Can you attach an example app?

        Show
        Graeme Rocher added a comment - I've tested this with my local version of Glassfish and the latest SVN head without issues How do you find out the version that is installed? Can you attach an example app?
        Hide
        Glen Smith added a comment -

        Have just tried this with latest svn head, and the first app now deploys without issue and I can add/edit/delete just fine. If I leave the first app running, and attempt to deploy a second app, however, I still generates a similar stack trace to above.

        You can tell which Glassfish version it is by the "version" button that appears at the top left of the admin console. Happy to attach two sample apps if it helps. I'm producing simple1 and simple2 per the instructions above and deploying them one after another.

        Show
        Glen Smith added a comment - Have just tried this with latest svn head, and the first app now deploys without issue and I can add/edit/delete just fine. If I leave the first app running, and attempt to deploy a second app, however, I still generates a similar stack trace to above. You can tell which Glassfish version it is by the "version" button that appears at the top left of the admin console. Happy to attach two sample apps if it helps. I'm producing simple1 and simple2 per the instructions above and deploying them one after another.
        Hide
        Graeme Rocher added a comment -

        Hi Glen,

        I believe this is now fixed. For existing Grails app you will need to run "grails upgrade" for new ones it should be fine. Can you make sure you are happy this is resolved and then close the issue, it works here.

        Cheers

        Show
        Graeme Rocher added a comment - Hi Glen, I believe this is now fixed. For existing Grails app you will need to run "grails upgrade" for new ones it should be fine. Can you make sure you are happy this is resolved and then close the issue, it works here. Cheers
        Hide
        Glen Smith added a comment -

        Great stuff. Just retested and looks just fine.

        Show
        Glen Smith added a comment - Great stuff. Just retested and looks just fine.

          People

          • Assignee:
            Graeme Rocher
            Reporter:
            Glen Smith
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development