Announcement Announcement Module
Collapse
No announcement yet.
Problem with ResourceBundleViewResolver Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Problem with ResourceBundleViewResolver

    I am getting an error when I try to use ResourceBundleViewResolver, and I'm not sure what I'm doing wrong. Any Ideas?

    In my Spring config I have:
    Code:
        <bean id="resourceBundleViewResolver"class="org.springframework.web.servlet.view.ResourceBundleViewResolver">
            <property name="order"><value>0</value></property>
        </bean>
    
        <bean id="viewResolver" class="org.springframework.web.servlet.view.InternalResourceViewResolver">
            <property name="viewClass"><value>org.springframework.web.servlet.view.JstlView</value></property>
            <property name="prefix"><value>/WEB-INF/jsp/</value></property>
            <property name="suffix"><value>.jsp</value></property>
        </bean>
    My views.properties file is:
    Code:
    logoff.class=org.springframework.web.servlet.view.RedirectView
    logoff.contextRelative=true
    logoff.url=/hello.htm
    My controller is:
    Code:
    public class SignOffController extends AbstractController &#123;
    
        protected ModelAndView handleRequestInternal&#40;HttpServletRequest request, HttpServletResponse response&#41; throws Exception &#123;
            WebUtils.signOff&#40;request&#41;;
            //todo&#58; url shouldn't be hardcoded here?
            //return new ModelAndView&#40;new RedirectView&#40;"hello.htm"&#41;&#41;;
            // can't get ResourceBundleViewResolver to work, so can't do&#58;
            return new ModelAndView&#40;"logoff"&#41;;
        &#125;
    &#125;
    I get the following in the appserver log:
    Code:
    2005-01-12 12&#58;59&#58;04,283 INFO  &#91;org.springframework.beans.factory.support.Default
    ListableBeanFactory&#93; Pre-instantiating singletons in factory &#91;org.springframewor
    k.beans.factory.support.DefaultListableBeanFactory defining beans &#91;logoff&#93;; pare
    nt&#58; org.springframework.web.context.support.XmlWebApplicationContext&#58; display na
    me &#91;org.springframework.web.context.support.XmlWebApplicationContext;hashCode=30
    362488&#93;; startup date &#91;Wed Jan 12 12&#58;58&#58;55 GMT 2005&#93;; child of &#91;org.springframew
    ork.context.support.ClassPathXmlApplicationContext&#58; display name &#91;org.springfram
    ework.context.support.ClassPathXmlApplicationContext;hashCode=9139106&#93;; startup
    date &#91;Wed Jan 12 12&#58;58&#58;19 GMT 2005&#93;; root of context hierarchy&#93;; config location
    s &#91;/WEB-INF/config/wo_web_config.xml&#93;&#93;
    2005-01-12 12&#58;59&#58;04,284 INFO  &#91;org.springframework.beans.factory.support.Default
    ListableBeanFactory&#93; Creating shared instance of singleton bean 'logoff'
    2005-01-12 12&#58;59&#58;16,635 INFO  &#91;org.springframework.ui.context.support.ResourceBu
    ndleThemeSource&#93; Theme created&#58; name 'theme', basename &#91;theme&#93;
    2005-01-12 12&#58;59&#58;44,058 ERROR &#91;org.apache.jk.common.MsgAjp&#93; Buffer overflow&#58; buf
    fer.len=8192 pos=42 data=69332
    2005-01-12 12&#58;59&#58;44,061 INFO  &#91;STDOUT&#93; 00 00 00 00 04 01 2e 00
            | ........
    2005-01-12 12&#58;59&#58;44,078 INFO  &#91;STDOUT&#93;
            |
    2005-01-12 12&#58;59&#58;44,078 INFO  &#91;STDOUT&#93;
            |
    2005-01-12 12&#58;59&#58;44,078 ERROR &#91;org.apache.jk.common.MsgAjp&#93; Overflow
    java.lang.Throwable
            at org.apache.jk.common.MsgAjp.cpBytes&#40;MsgAjp.java&#58;172&#41;
            at org.apache.jk.common.MsgAjp.appendByteChunk&#40;MsgAjp.java&#58;146&#41;
            at org.apache.jk.common.MsgAjp.appendBytes&#40;MsgAjp.java&#58;132&#41;
            at org.apache.jk.server.JkCoyoteHandler.appendHead&#40;JkCoyoteHandler.java&#58;
    394&#41;
            at org.apache.jk.server.JkCoyoteHandler.action&#40;JkCoyoteHandler.java&#58;412&#41;
            at org.apache.coyote.Response.action&#40;Response.java&#58;182&#41;
            at org.apache.coyote.Response.sendHeaders&#40;Response.java&#58;374&#41;
            at org.apache.coyote.tomcat5.OutputBuffer.doFlush&#40;OutputBuffer.java&#58;321&#41;
            at org.apache.coyote.tomcat5.OutputBuffer.close&#40;OutputBuffer.java&#58;282&#41;
            at org.apache.coyote.tomcat5.CoyoteResponse.finishResponse&#40;CoyoteRespons
    e.java&#58;476&#41;
            at org.apache.coyote.tomcat5.CoyoteAdapter.service&#40;CoyoteAdapter.java&#58;16
    3&#41;
            at org.apache.jk.server.JkCoyoteHandler.invoke&#40;JkCoyoteHandler.java&#58;297&#41;
            at org.apache.jk.common.HandlerRequest.invoke&#40;HandlerRequest.java&#58;371&#41;
            at org.apache.jk.common.ChannelSocket.invoke&#40;ChannelSocket.java&#58;731&#41;
            at org.apache.jk.common.ChannelSocket.processConnection&#40;ChannelSocket.ja
    va&#58;663&#41;
            at org.apache.jk.common.SocketConnection.runIt&#40;ChannelSocket.java&#58;859&#41;
            at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run&#40;ThreadP
    ool.java&#58;683&#41;
            at java.lang.Thread.run&#40;Thread.java&#58;534&#41;
    Thanks

  • #2
    Shouldnt you add a basename to your resourcebundle?
    e.g.:
    Code:
    <bean id="resourceBundleViewResolver"class="org.springframework.web.servlet.view.ResourceBundleViewResolver">
            <property name="order"><value>0</value></property>
            <property name="basename"><value>views</value></property>
        </bean>
    Gr
    Ronald

    Comment


    • #3
      Thanks for the suggestion.
      In fact 'views' is the default value for this property, so the line isn't necessary. I've just tried putting it in, to be sure, and it makes no difference.

      Comment


      • #4
        Were you sure it had anything with spring's framework?

        Comment


        • #5
          I'm not sure what is causing the error. That's what I was hoping to get some help with.

          Comment


          • #6
            Re: Problem with ResourceBundleViewResolver

            Originally posted by cmgharris
            Code:
            2005-01-12 12&#58;59&#58;16,635 INFO  &#91;org.springframework.ui.context.support.ResourceBu
            ndleThemeSource&#93; Theme created&#58; name 'theme', basename &#91;theme&#93;
            2005-01-12 12&#58;59&#58;44,058 ERROR &#91;org.apache.jk.common.MsgAjp&#93; Buffer overflow&#58; buf
            fer.len=8192 pos=42 data=69332
            There's a long gap (28sec) between those two log entries - do you get any additional info with trace/debug logging output?

            Comment


            • #7
              2005-01-12 12:59:44,058 ERROR [org.apache.jk.common.MsgAjp] Buffer overflow: buf
              fer.len=8192 pos=42 data=69332
              This error is comming from the JK Coyote connector. It looks totally un-related to the ResourceBundleViewResolver. What servlet container are you using? Is it necesary that you run the Coyote connector? If you're not dependent on it, try remving it from you're server's configuration.

              Comment


              • #8
                There's a long gap (28sec) between those two log entries - do you get any additional info with trace/debug logging output?
                Done that, thanks for the sugestion, and I'm pretty sure I now understand what's causing the problem. I'm not sure what the solution is.

                I have an interceptor with a postHandle method which adds certain model items that are required by all pages - unless it's a redirect, in which case they are not required.

                So the postHandle method tests the view of the incoming ModelAndView, and only adds the model items if it's not an instance of RedirectView.

                However, if the ModelAndView is constructed using a String, the getView() method returns null, and there is no obvious way in my interceptor to know if it's going to resolve to a RedirectView or an InternalResourceView. The model items are quite large, and I guess it's the adding of them as request parameters to the url that causes the overflow.

                So how can I decide in the interceptor whether to add these model items or not? In other words, how can I tell what class a view name is going to resolve to?

                Comment


                • #9
                  This is really now a new topic; so I have started a new thread at http://forum.springframework.org/showthread.php?t=12510
                  Last edited by robyn; May 14th, 2006, 12:31 PM.

                  Comment

                  Working...
                  X