Results 1 to 6 of 6

Thread: Error using

  1. #1
    Join Date
    Sep 2004
    Location
    Sydney
    Posts
    27

    Default Error using
    I have this:
    Code:
    [12:06:36.970] Note: C:\code\subscriptions-trunk\war\WEB-INF\work\_jsp\_web_22dinf\_jsp\_welcome__jsp.java uses unchecked or unsafe operations.
    [12:06:36.970] Note: Recompile with -Xlint:unchecked for details.
    2004-10-29 12&#58;06&#58;37,211 ERROR &#91;org.springframework.web.servlet.tags.MessageTag&#93; - <Exception in RequestContextAwareTag>
    java.lang.IllegalStateException&#58; No WebApplicationContext found&#58; not in a DispatcherServlet request?
            at org.springframework.web.servlet.support.RequestContextUtils.getWebApplicationContext&#40;RequestContextUtils.java&#58;79&#41;
            at org.springframework.web.servlet.support.RequestContextUtils.getWebApplicationContext&#40;RequestContextUtils.java&#58;56&#41;
            at org.springframework.web.servlet.support.RequestContext.<init>&#40;RequestContext.java&#58;93&#41;
            at org.springframework.web.servlet.support.RequestContext.<init>&#40;RequestContext.java&#58;79&#41;
            at org.springframework.web.servlet.tags.RequestContextAwareTag.doStartTag&#40;RequestContextAwareTag.java&#58;67&#41;
            at _jsp._web_22dinf._jsp._statics._footer__jsp._jspService&#40;_footer__jsp.java&#58;37&#41;
            at com.caucho.jsp.JavaPage.service&#40;JavaPage.java&#58;75&#41;
            at com.caucho.jsp.Page.pageservice&#40;Page.java&#58;571&#41;
            at com.caucho.server.dispatch.PageFilterChain.doFilter&#40;PageFilterChain.java&#58;155&#41;
            at com.caucho.server.webapp.DispatchFilterChain.doFilter&#40;DispatchFilterChain.java&#58;129&#41;
            at com.caucho.server.cache.CacheFilterChain.doFilter&#40;CacheFilterChain.java&#58;177&#41;
            at com.caucho.server.dispatch.ServletInvocation.service&#40;ServletInvocation.java&#58;221&#41;
            at com.caucho.server.webapp.RequestDispatcherImpl.include&#40;RequestDispatcherImpl.java&#58;476&#41;
            at com.caucho.server.webapp.RequestDispatcherImpl.include&#40;RequestDispatcherImpl.java&#58;345&#41;
            at com.caucho.jsp.PageContextImpl.include&#40;PageContextImpl.java&#58;807&#41;
            at _jsp._web_22dinf._jsp._nofile__jsp._jspService&#40;_nofile__jsp.java&#58;42&#41;
            at com.caucho.jsp.JavaPage.service&#40;JavaPage.java&#58;75&#41;
            at com.caucho.jsp.Page.pageservice&#40;Page.java&#58;571&#41;
            at com.caucho.server.dispatch.PageFilterChain.doFilter&#40;PageFilterChain.java&#58;155&#41;
            at com.caucho.server.webapp.DispatchFilterChain.doFilter&#40;DispatchFilterChain.java&#58;129&#41;
            at com.caucho.server.dispatch.ServletInvocation.service&#40;ServletInvocation.java&#58;221&#41;
            at com.caucho.server.webapp.RequestDispatcherImpl.forward&#40;RequestDispatcherImpl.java&#58;272&#41;
            at com.caucho.server.webapp.RequestDispatcherImpl.error&#40;RequestDispatcherImpl.java&#58;119&#41;
            at com.caucho.server.webapp.ErrorPageManager.handleErrorStatus&#40;ErrorPageManager.java&#58;548&#41;
            at com.caucho.server.webapp.ErrorPageManager.sendError&#40;ErrorPageManager.java&#58;446&#41;
            at com.caucho.server.connection.AbstractHttpResponse.sendError&#40;AbstractHttpResponse.java&#58;475&#41;
            at com.caucho.server.connection.AbstractHttpResponse.sendError&#40;AbstractHttpResponse.java&#58;433&#41;
            at com.caucho.servlets.FileServlet.service&#40;FileServlet.java&#58;247&#41;
            at com.caucho.server.dispatch.ServletFilterChain.doFilter&#40;ServletFilterChain.java&#58;113&#41;
            at com.caucho.server.cache.CacheFilterChain.doFilter&#40;CacheFilterChain.java&#58;211&#41;
            at com.caucho.server.webapp.WebAppFilterChain.doFilter&#40;WebAppFilterChain.java&#58;177&#41;
            at com.caucho.server.dispatch.ServletInvocation.service&#40;ServletInvocation.java&#58;221&#41;
            at com.caucho.server.http.HttpRequest.handleRequest&#40;HttpRequest.java&#58;263&#41;
            at com.caucho.server.port.TcpConnection.run&#40;TcpConnection.java&#58;331&#41;
            at com.caucho.util.ThreadPool.runTasks&#40;ThreadPool.java&#58;464&#41;
            at com.caucho.util.ThreadPool.run&#40;ThreadPool.java&#58;408&#41;
            at java.lang.Thread.run&#40;Thread.java&#58;595&#41;
    So, in my welcome.jsp I have
    Code:
    <%@ include file="statics/footer.jsp"%>
    And in my footer.jsp I have:
    Code:
    <spring&#58;message code="footer.text"/>
    So I am not sure what the problem is, only that when I take the <spring:message> out of the footer, it works.
    Any ideas?


  2. #2
    Join Date
    Aug 2004
    Location
    Melbourne, Australia
    Posts
    1,104

    Default

    Code:
    No WebApplicationContext found&#58; not in a DispatcherServlet request?
    The page has to come via your DispatcherServlet. Looks like you hit the JSP directly. Take a look at Petclinic index.jsp:
    Code:
    <c&#58;redirect url="/welcome.htm"/>
    This will be handled by the DispatcherServlet and dispatched to the JSP.

  3. #3
    Join Date
    Sep 2004
    Location
    Sydney
    Posts
    27

    Default

    I think it has something to do with the footer spring:message though, since when I take that out, it works fine. I don't know what effect the include is having on spring being able to get the message, but there is obviously something wrong there.

  4. #4
    Join Date
    Aug 2004
    Location
    Melbourne, Australia
    Posts
    1,104

    Default

    I think it has something to do with the footer spring:message though
    Yes, that's exactly the problem I describe above. Even if you move the spring:message from the footer to the main page you'll probably get the same error.

    Make sure you display the JSP via your DispatcherServlet.

  5. #5
    Join Date
    Sep 2004
    Location
    Sydney
    Posts
    27

    Default

    I have an index.jsp page, which simply does what you say:
    <c:redirect url="/welcome.html"/>

    The welcome.jsp page is generated via a controller which is a dispatcher in web.xml.

    I have other pages that are generated via controllers which aren't dispatchers in web.xml - however the error occurs even with the welcome.jsp page.
    If I put a spring:message tag in my welcome.jsp then it works without error and the message is displayed. However, when welcome.jsp includes other jsp pages, and those pages have spring:message tags, errors are produced, but the message is still displayed.

  6. #6
    Join Date
    Aug 2004
    Location
    Melbourne, Australia
    Posts
    1,104

    Default

    If I put a spring:message tag in my welcome.jsp then it works without error and the message is displayed
    The <%@ include file="statics/footer.jsp"%> code should be included in the welcome.jsp compilation verbatim, so swapping the TAG from footer.jsp to welcome.jsp shouldn't make a difference. :?

    The stack trace has:
    at _jsp._web_22dinf._jsp._statics._footer__jsp._jspSe rvice(_footer__jsp.java:37)
    This seems to indicate the footer is hit separately. I would have expected the entry to have something like _welcome__jsp.java. Can you verify if your welcome.jsp to Java transalation is working OK?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •