Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

'Application context not configured for this file' error after moving and renaming the default application-config.xml of IntelliJ IDEA

I have created a Spring Mvc application using IntelliJ IDEA and then I moved and renamed the default application-config file to another directory. Now I am getting this error : 'Application context not configured for this file' The new place of the file is src/main/webapp/WEB-INF/spring/appServlet/servlet-context.xml

The file is this one:

<beans xmlns="http://www.springframework.org/schema/beans"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xmlns:context="http://www.springframework.org/schema/context"
       xmlns:mvc="http://www.springframework.org/schema/mvc"
       xsi:schemaLocation="http://www.springframework.org/schema/beans
        http://www.springframework.org/schema/beans/spring-beans.xsd
        http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc.xsd">

    <!-- Enables the Spring MVC @Controller programming model -->
    <mvc:annotation-driven/>

    <mvc:resources mapping="/resources/**" location="/"/>

    <bean class="org.springframework.web.servlet.view.InternalResourceViewResolver">
        <property name="prefix" value="/WEB-INF/pages/"/>
        <property name="suffix" value=".jspx"/>
    </bean>

    <context:component-scan base-package="com.apress.prospring3.ch17.web.controller"/>

</beans>

Any ideas? Thank you.

like image 436
skiabox Avatar asked Apr 27 '13 21:04

skiabox


1 Answers

Check the config of spring in the web.xml file.

<context-param>
    <param-name>contextConfigLocation</param-name>
    <param-value>
        classpath:applicationContext.xml
    </param-value>
</context-param>

The contextConfigLocation parameter config the xml location about spring, Check you web.xml is correct.

If you load the xml by java code,like @skiabox, you can ignore this warning.

like image 190
Satur6ay Avatar answered Sep 21 '22 11:09

Satur6ay