Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>You are starting two different spring application contexts. The first, the built-in <a href="http://static.springsource.org/spring/docs/3.1.x/javadoc-api/org/springframework/web/context/ContextLoaderListener.html" rel="nofollow">ContextLoaderListener</a>, is likely picking up your springapp-servlet.xml configuration from default locations. (You didn't say if you are specifying a contextConfigLocation.)</p> <p>In your custom listener, you then construct a new application context using ClassPathXmlApplicationContext with an explicit path. Of the three lines you've shown, only the one with ""WEB-INF/springapp-servlet.xml" looks like a possible candidate for classpath resolution, although it really depends on how you've configured and startup your Tomcat instance. (i.e. What is the classpath from Tomcat's point-of-view?)</p> <p>Regardless, there are better ways to get the Spring application context in to a servlet/listener. A direct approach is to use the ContextLoaderListener as you have done, but then in your custom servlet/listener, make use of Spring's <a href="http://static.springsource.org/spring/docs/3.1.x/javadoc-api/org/springframework/web/context/support/WebApplicationContextUtils.html#getWebApplicationContext%28javax.servlet.ServletContext%29" rel="nofollow">WebApplicationContextUtils.getWebApplicationContext</a>.</p> <p>Spring has direct support for servlets as well, including configuration via annotations, the <a href="http://static.springsource.org/spring/docs/3.2.x/javadoc-api/org/springframework/web/servlet/HttpServletBean.html" rel="nofollow">HttpServletBean</a> class, or even using <a href="http://static.springsource.org/spring/docs/3.2.x/javadoc-api/org/springframework/web/servlet/FrameworkServlet.html" rel="nofollow">FrameworkServlet</a> directly.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload