No WebApplicationContext found: no ContextLoaderListener registered异常

来源:互联网 发布:阿里云服务器上传文件 编辑:程序博客网 时间:2024/05/16 17:00
No WebApplicationContext found: no ContextLoaderListener registered异常 通常为 配置文件找不到,
在src 目录下的配置文件, 编译部署后, 可能就在 部署后的项目的 /WEB-INF/classes 路径下, 所以  配置文件的 路径应该是
    <!-- 装载属性配置文件-->
    <bean id="propertyConfigurer"
        class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
        <property name="locations">
            <list>
                <value>WEB-INF/classes/config.properties</value>
            </list>
        </property>
    </bean>

web.xml文件中的路径是  (WEB-INF目录下有目录conf,TestServer.xml 在目录conf下)
    <context-param>
        <param-name>contextConfigLocation</param-name>
        <param-value>/WEB-INF/conf/TestServer.xml</param-value>
    </context-param>
原创粉丝点击