NewBee: 404 Error while sending back response from controller using 'render' to a GSP in weblogic12.1.2

113 views
Skip to first unread message

Lokajit Tikayatray

unread,
Jan 13, 2015, 11:17:48 AM1/13/15
to gra...@googlegroups.com
I am facing an issue when I am deploying my grails (2.4.0) project war into weblogic 12.1.2. The war works perfectly fine when deployed into tomcat. Issue is, when the war is deployed in weblogic. Once the user logs in, the authentication process using LDAP also works fine. Next the home page should be rendered with a GSP page, but seems weblogic is not able to render the GSP page. It is throwing 404 on the browser.

Once I log in to the application, if I directly use any URL in the browser, the flow goes to the Controller and performs all the required code execution in the controller but it fails to go back to view and render the GSP page mentioned in the "render" block.

My Controller action code is as below:
def index(){
        log.debug("**********Reached MyHomeController**********")
MyHome myHome = new MyHome()
myHome.setMessageId(1)
myHome.setMessageText("***TEST MESSAGE***")
render (view: 'myhome', model: [myHome:myHome])
}

I tried to render a plain text on the browser using the same controller action and it works fine. I am able to see the message rendered on the browser without issue, even in weblogic deployment.

    def index(){
        log.debug("**********Reached MyHomeController.testCall**********")
render ("*@***Reached MyHomeController.testCall**********")
}

I have verified the weblogic issues in grails site ([here][1]) and have done the remedies mentioned there. But I think, the issue is requests are getting submitted to correct Controller but when coming back to UI, weblogic is not able to find the GSP (where as tomcat has no issue with it).

Please help in resolving how to make the GSP get rendered when deployed in weblogic.
Below is the exception in log when weblogic throws a 404 on the browser:

[[ACTIVE] ExecuteThread: '22' for queue: 'weblogic.kernel.Default (self-tuning)'] : [0cbdbb31-0fda-495e-ab95-360e622dd30f] [Lokajit_Tikayatray] : GrailsExceptionResolver - Resolving exception from handler [HandlerExecutionChain with handler [org.codehaus.groovy.grails.web.servlet.mvc.SimpleGrailsController@4702aedf]]: java.lang.NullPointerException
[[ACTIVE] ExecuteThread: '22' for queue: 'weblogic.kernel.Default (self-tuning)'] : [0cbdbb31-0fda-495e-ab95-360e622dd30f] [Lokajit_Tikayatray] : GrailsExceptionResolver - Resolving to view '/error' for exception of type [java.lang.NullPointerException], based on exception mapping [java.lang.Exception]
[[ACTIVE] ExecuteThread: '22' for queue: 'weblogic.kernel.Default (self-tuning)'] : [0cbdbb31-0fda-495e-ab95-360e622dd30f] [Lokajit_Tikayatray] : GrailsExceptionResolver - Exposing Exception as model attribute 'exception'
[[ACTIVE] ExecuteThread: '22' for queue: 'weblogic.kernel.Default (self-tuning)'] : [0cbdbb31-0fda-495e-ab95-360e622dd30f] [Lokajit_Tikayatray] : GrailsExceptionResolver - NullPointerException occurred when processing request: [GET] /CDMTPortal/AssetSearch/index
Stacktrace follows:
java.lang.NullPointerException
at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:280)
at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:254)
at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:136)


[OS: Windows X64 | JDK: 1.7 | Grails: 2.4.0 | Bowser: IE/Chrome | Weblogic: 12.1.2]

Lokajit Tikayatray

unread,
Jan 14, 2015, 10:39:43 AM1/14/15
to gra...@googlegroups.com
I updated the log level for framework classes and this is the updated log.


Not sure why it is trying to find a *.jsp file.

: MyHomeController - **********Reached MyHomeController**********

 ::: [2c5cb87d-29ad-4006-8294-4a1f355e124e] [Lokajit_Tikayatray] : OptimizedAutowireCapableBeanFactory - Returning cached instance of singleton bean 'groovyPagesUriService' 

::: [2c5cb87d-29ad-4006-8294-4a1f355e124e] [Lokajit_Tikayatray] : AbstractGrailsControllerHelper - Action [testCall1] executed with result [null] and view name [/myHome/index]

 ::: [2c5cb87d-29ad-4006-8294-4a1f355e124e] [Lokajit_Tikayatray] : AbstractGrailsControllerHelper - Action [testCall1] handled, created Spring model and view [ModelAndView: reference to view with name '/myHome/myhome'; model is {}] ::: [2c5cb87d-29ad-4006-8294-4a1f355e124e] [Lokajit_Tikayatray] : SimpleGrailsController - [SimpleGrailsController] Forwarding model and view [ModelAndView: reference to view with name '/myHome/myhome'; model is {}] with class [/myHome/myhome]

 ::: [2c5cb87d-29ad-4006-8294-4a1f355e124e] [Lokajit_Tikayatray] : CompositeInterceptor - postHandle SecurityContextHolderAwareRequestWrapper[ org.springframework.security.web.context.HttpSessionSecurityContextRepository$Servlet3SaveToSessionRequestWrapper@320c8103], org.springframework.security.web.context.HttpSessionSecurityContextRepository$SaveToSessionResponseWrapper@52ea05a0, org.codehaus.groovy.grails.web.servlet.mvc.SimpleGrailsController@4720353f, ModelAndView: reference to view with name '/myHome/myhome'; model is {} 

::: [2c5cb87d-29ad-4006-8294-4a1f355e124e] [Lokajit_Tikayatray] : GrailsDispatcherServlet - Rendering view [org.codehaus.groovy.grails.web.sitemesh.SitemeshLayoutView: unnamed; URL [null]] in DispatcherServlet with name 'grails' ::: [2c5cb87d-29ad-4006-8294-4a1f355e124e] [Lokajit_Tikayatray] :JstlView - Forwarding to resource [/WEB-INF/grails-app/views/myHome/myhome.jsp] in InternalResourceView 'null' 

::: [2c5cb87d-29ad-4006-8294-4a1f355e124e] [Lokajit_Tikayatray] : GrailsDispatcherServlet - Error rendering view [org.codehaus.groovy.grails.web.sitemesh.SitemeshLayoutView: unnamed; URL [null]] in DispatcherServlet with name 'grails' java.lang.NullPointerException at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:280) at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:254) at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:136) at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:341) at weblogic.servlet.internal.TailFilter.doFilter(TailFilter.java:25) at 

Lokajit Tikayatray

unread,
Jan 14, 2015, 12:07:29 PM1/14/15
to gra...@googlegroups.com
Seems Grails try to find a jsp if a GSP is not found in the given folder. I tried adding a jsp still it is not working. Something tricky is missing. Need some help in finding that.
After finding out it won't be that tricky for sure :) ... but for now feeling stuck.


On Tuesday, January 13, 2015 at 9:47:48 PM UTC+5:30, Lokajit Tikayatray wrote:

Lokajit Tikayatray

unread,
Jan 14, 2015, 10:29:42 PM1/14/15
to gra...@googlegroups.com
Finally, the deployment worked with weblogic with properly navigating from one page to another. The issue was with naming convention for the view folders. Seems weblogic needs the view folder name exactly same (case sensitive) as the URL generated by framework.

log printed:<BR>
Forwarding to resource [/WEB-INF/grails-app/views/**myHome**/myhome.jsp]

So, weblogic was trying to find the 'myhome' GSP file inside the "my**H**ome" folder (with H in capital) but all my view folder names were in lower case. Hence, weblogic was not able to find the GSP in the URL. Even when I copied similar JSP to the required path still it failed to find it. Getting clue from the log, I changed my view folder names to exactly same cases as the URL and it worked fine. :)

Same is not the case with Tomcat. Tomcat does not use the URL as case sensitive. It is able to find the URL path in any case. That is why my application was working fine with tomcat even when URL was /my**H**ome/** but my view folder name was 'my**h**ome'. As tomcat was able to identify the URL path properly, hence it did not strike me that weblogic will be doing a case sensitive search of the URL path (until I ran out of all possible options to fix the issue :) ).
Reply all
Reply to author
Forward
0 new messages