Last updated by admin 3 years ago
Deploying a grails application to WebSphere 5.x is not trivial. Some have reported success, but it is not my case yet :-(This is on :
Build Date: 01/17/2005 Here is a journal of what I went through, hoping it will help others and maybe help me solve my remaining problems to a successful deployment on websphere 5.1.>
<! @see org.springframework.web.filter -->
<filter>
<filter-name>requestContextFilter</filter-name>
<filter-class>org.springframework.web.filter.RequestContextFilter</filter-class>
</filter> <filter-mapping>
<filter-name>requestContextFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
{noformat}
{panel}{panel:title="IllegalStateExecption, No thread-bound request found"}
4/2/08 14:20:08:503 EDT (+) 59232722 WebGroup E SRVE0026E: Servlet Error (+)-No thread-bound request found: Are you referring to request attributes outside of an actual web request? If you are actually operating within a web request and still receive this message,your code is probably running outside of DispatcherServlet/DispatcherPortlet: In this case, use RequestContextListener or RequestContextFilter to expose the current request. (+): java.lang.IllegalStateException: No thread-bound request found: Are you referring to request attributes outside of an actual web request? If you are actually operating within a web request and still receive this message,your code is probably running outside of DispatcherServlet/DispatcherPortlet: In this case, use RequestContextListener or RequestContextFilter to expose the current request.
at org.springframework.web.context.request.RequestContextHolder.currentRequestAttributes(RequestContextHolder.java:102)
at org.codehaus.groovy.grails.web.pages.GroovyPagesServlet.createResponseWriter(GroovyPagesServlet.java:205)
at org.codehaus.groovy.grails.web.pages.GroovyPagesServlet.renderPageWithEngine(GroovyPagesServlet.java:146)
at org.codehaus.groovy.grails.web.pages.GroovyPagesServlet.doPage(GroovyPagesServlet.java:131)
at org.codehaus.groovy.grails.web.pages.GroovyPagesServlet.doGet(GroovyPagesServlet.java:95)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
at javax.servlet.http.HttpServlet.service(HttpServlet.java(Compiled Code))
at com.ibm.ws.webcontainer.servlet.StrictServletInstance.doService(StrictServletInstance.java:110)
at com.ibm.ws.webcontainer.servlet.StrictLifecycleServlet._service(StrictLifecycleServlet.java:174)
at com.ibm.ws.webcontainer.servlet.IdleServletState.service(StrictLifecycleServlet.java:313)
at com.ibm.ws.webcontainer.servlet.StrictLifecycleServlet.service(StrictLifecycleServlet.java:116)
at com.ibm.ws.webcontainer.servlet.ServletInstance.service(ServletInstance.java:283)
at com.ibm.ws.webcontainer.servlet.ValidServletReferenceState.dispatch(ValidServletReferenceState.java:42)
at com.ibm.ws.webcontainer.servlet.ServletInstanceReference.dispatch(ServletInstanceReference.java:40)
at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:76)
at org.codehaus.groovy.grails.web.sitemesh.GrailsPageFilter.parsePage(GrailsPageFilter.java:119)
at org.codehaus.groovy.grails.web.sitemesh.GrailsPageFilter.doFilter(GrailsPageFilter.java:82)
at com.ibm.ws.webcontainer.filter.FilterInstanceWrapper.doFilter(FilterInstanceWrapper.java:132)
at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:71)
at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:96)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:75)
at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:183)
at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:138)
at com.ibm.ws.webcontainer.filter.FilterInstanceWrapper.doFilter(FilterInstanceWrapper.java:132)
at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:71)
at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.handleWebAppDispatch(WebAppRequestDispatcher.java:1040)
at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.dispatch(WebAppRequestDispatcher.java(Compiled Code))
at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.forward(WebAppRequestDispatcher.java:201)
at com.ibm.ws.webcontainer.srt.WebAppInvoker.doForward(WebAppInvoker.java:125)
at com.ibm.ws.webcontainer.srt.WebAppInvoker.handleInvocationHook(WebAppInvoker.java:286)
at com.ibm.ws.webcontainer.cache.invocation.CachedInvocation.handleInvocation(CachedInvocation.java:71)
at com.ibm.ws.webcontainer.srp.ServletRequestProcessor.dispatchByURI(ServletRequestProcessor.java:182)
at com.ibm.ws.webcontainer.oselistener.OSEListenerDispatcher.service(OSEListener.java:334)
at com.ibm.ws.webcontainer.http.HttpConnection.handleRequest(HttpConnection.java:56)
at com.ibm.ws.http.HttpConnection.readAndHandleRequest(HttpConnection.java:624)
at com.ibm.ws.http.HttpConnection.run(HttpConnection.java:448)
at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java(Compiled Code))
{panel}
- grails-1.0.1,
- Sun jdk 1.4.2 on Mac OS X 10.5.2 for running "grails war",
- WebSphere running on Linux CentOS 4.5
- IBM WebSphere Application Server, 5.1.1.3
Build Date: 01/17/2005 Here is a journal of what I went through, hoping it will help others and maybe help me solve my remaining problems to a successful deployment on websphere 5.1.
I intend to provide more deailled patches and files for workarounds I made. For now, I mostly describe what I did.
- WebSphere error at deployment with web.xml generated by "grails -Dservlet.version=2.3 war"
- Caused by addition of a xmlns attribute to web-app element in web.xml, even if template has not specified such an attribute
- Maybe also caused by absence of DOCTYPE in web.xml
- Possibly related to GRAILS-1795
- Sequence for producing web.xml descriptor :
- web.xml.tmp is first created from ${GRAILS_HOME}/src/war/WEB-INF/web2.3.template.xml into ~/.grails-${grailsVesion}/projects/${baseName} : OK
- web.xml.tmp is processed to replace
grails.project.keywith ${baseName} : OK - web.xml.tmp is processed by pluginManager.doWebDescriptor() to generate staging/WEB-INF/web.xml : NOT OK
- This last step is where the DOCTYPE specification is lost and where a xmlns attribute is added to web-app element
- Solved by :
- specifiying a custom web.xml in ${basedir}/grails-app/conf/Config.groovy (grails.config.base.webXml) for the application : use the web.xml.tmp generated at first by "grails -Dservlet.version=2.3 war"
- Customizing Package.groovy by creating a local copy into ${baseDir}/scripts : copy the custom web.xml into staging and skip web.xml generation via pluginManager.doWebDescriptor()
- Customizing War.groovy by creating a local copy into ${baseDir}/scripts : load local copy of Package.groovy ('includeTargets' for Package.groovy must be before the one for Clean.groovy)
- Choose local War.groovy script when running "grails -Dservlet.version=2.3 war"
- Others have solved by creating Package23.groovy and War23.groovy scripts straight in the grails installation : http://markmail.org/message/exu6vcqiqcwznb6x
- Trying to use PARENT_LAST for Classloader mode leads to "The chosen LogFactory implementation does not extend LogFactory"
- See GRAILS-515 and http://grails.org/FAQ#FAQ-Q%3ADeployingonWebsphere
- Solve by using an "application-associated shared library" definition in websphere for commons-logging:
- in local copy of War.groovy, exclude(name:"commons-logging-1.1.jar" in target war
- create a modified commons-logging.jar :
- mkdir -p META-INF/services
- copy the modified jar onto the machine running your websphere into a location that will be accessible at run-time by the websphere process
- define a shared library in the admin console (pages 21 to 23 in the pdf "Integrating Jakarta Commons Logging (JCL) with IBM WebSphere Application Server" made by IBM, http://ww-1.ibm.com/support/docview.wss?uid=swg27004610)
- ServletException when org.springframework.web.context.ContextLoaderServlet is used as the "context" servlet in web.xml.
- Same exception as GRAILS-2035, but different cause
- Solved by applying patch described in GRAILS-1143
- Begin backtrace for Nested Throwables
- Servlet Error 500 : No thread-bound request found on visit to index.gsp of deployed application
- The current request object is not available in org.springframework.web.context.request.RequestContextHolder
- Maybe related to GRAILS-2188 ?
- Solved by using alternate method to getting the current request into current thread (from javadoc of org.springframework.web.filter)
- Servlet Error, ClassCastException, when visiting index.gsp:
This one is unresolved ! I need help…{panel:title=ClassCastException in createResponseWriter on index.gsp} 4/1/08 9:25:22:008 EDT (+) 44d36722 WebGroup E SRVE0026E: Servlet Error (+)-org.springframework.web.context.request.ServletRequestAttributes (+): java.lang.ClassCastException: org.springframework.web.context.request.ServletRequestAttributes at org.codehaus.groovy.grails.web.pages.GroovyPagesServlet.createResponseWriter(GroovyPagesServlet.java:205) at org.codehaus.groovy.grails.web.pages.GroovyPagesServlet.renderPageWithEngine(GroovyPagesServlet.java:146) at org.codehaus.groovy.grails.web.pages.GroovyPagesServlet.doPage(GroovyPagesServlet.java:131) at org.codehaus.groovy.grails.web.pages.GroovyPagesServlet.doGet(GroovyPagesServlet.java:95) at javax.servlet.http.HttpServlet.service(HttpServlet.java:740) at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) at com.ibm.ws.webcontainer.servlet.StrictServletInstance.doService(StrictServletInstance.java:110) at com.ibm.ws.webcontainer.servlet.StrictLifecycleServlet._service(StrictLifecycleServlet.java:174) at com.ibm.ws.webcontainer.servlet.IdleServletState.service(StrictLifecycleServlet.java:313) at com.ibm.ws.webcontainer.servlet.StrictLifecycleServlet.service(StrictLifecycleServlet.java:116) at com.ibm.ws.webcontainer.servlet.ServletInstance.service(ServletInstance.java:283) at com.ibm.ws.webcontainer.servlet.ValidServletReferenceState.dispatch(ValidServletReferenceState.java:42) at com.ibm.ws.webcontainer.servlet.ServletInstanceReference.dispatch(ServletInstanceReference.java:40) at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:76) at org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:63) at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:75) at com.ibm.ws.webcontainer.filter.FilterInstanceWrapper.doFilter(FilterInstanceWrapper.java:132) at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:71) at org.codehaus.groovy.grails.web.sitemesh.GrailsPageFilter.parsePage(GrailsPageFilter.java:119) at org.codehaus.groovy.grails.web.sitemesh.GrailsPageFilter.doFilter(GrailsPageFilter.java:82) at com.ibm.ws.webcontainer.filter.FilterInstanceWrapper.doFilter(FilterInstanceWrapper.java:132) at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:71) at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:96) at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:75) at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:183) at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:138) at com.ibm.ws.webcontainer.filter.FilterInstanceWrapper.doFilter(FilterInstanceWrapper.java:132) at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:71) at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.handleWebAppDispatch(WebAppRequestDispatcher.java:1040) at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.dispatch(WebAppRequestDispatcher.java:600) at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.forward(WebAppRequestDispatcher.java:201) at com.ibm.ws.webcontainer.srt.WebAppInvoker.doForward(WebAppInvoker.java:125) at com.ibm.ws.webcontainer.srt.WebAppInvoker.handleInvocationHook(WebAppInvoker.java:286) at com.ibm.ws.webcontainer.cache.invocation.CachedInvocation.handleInvocation(CachedInvocation.java:71) at com.ibm.ws.webcontainer.srp.ServletRequestProcessor.dispatchByURI(ServletRequestProcessor.java:182) at com.ibm.ws.webcontainer.oselistener.OSEListenerDispatcher.service(OSEListener.java:334) at com.ibm.ws.webcontainer.http.HttpConnection.handleRequest(HttpConnection.java:56) at com.ibm.ws.http.HttpConnection.readAndHandleRequest(HttpConnection.java:624) at com.ibm.ws.http.HttpConnection.run(HttpConnection.java:448) at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java(Compiled Code)) {panel}



