Application context not configured for this file как исправить

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...

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.

asked Apr 27, 2013 at 21:33

skiabox's user avatar

0

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.

answered Dec 12, 2017 at 3:18

Satur6ay's user avatar

Satur6aySatur6ay

1212 silver badges2 bronze badges

I’ve configured application context from code (a new feature of spring 3.1) so I believe that IntelliJ idea will keep complaining.
Here is the code.

package com.apress.prospring3.ch17.web.init;

import org.springframework.web.WebApplicationInitializer;
import org.springframework.web.context.support.XmlWebApplicationContext;
import org.springframework.web.servlet.DispatcherServlet;

import javax.servlet.MultipartConfigElement;
import javax.servlet.ServletContext;
import javax.servlet.ServletException;
import javax.servlet.ServletRegistration;


public class MyWebAppInitializer implements WebApplicationInitializer{

    @Override
    public void onStartup(ServletContext container) throws ServletException {
        XmlWebApplicationContext appContext = new XmlWebApplicationContext();

        appContext.setConfigLocation("/WEB-INF/spring/appServlet/servlet-context.xml");

        ServletRegistration.Dynamic dispatcher = container.addServlet("appServlet", new DispatcherServlet(appContext));

        MultipartConfigElement multipartConfigElement = new MultipartConfigElement(null, 5000000, 5000000, 0);
        dispatcher.setMultipartConfig(multipartConfigElement);

        dispatcher.setLoadOnStartup(1);
        dispatcher.addMapping("/");

    }
}

answered Apr 28, 2013 at 16:53

skiabox's user avatar

skiaboxskiabox

3,36912 gold badges63 silver badges95 bronze badges

Satur6ay’s comment helps me particularry.

But xml-file was coloured «red» by Idea.
I found thar resources folder had not «resource»-icon, but had standard gray folder icon.
So, I went to File -> Project Structure -> my module -> found there «resorces» folder -> «Mark as» -> Resources.

xml-reference in web.xml become valid and all other references in xml-spring-configs ()become green-valid

answered Nov 16, 2018 at 10:11

Андрей Костров's user avatar

Adding this worked for me!! thx to satur6ay

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

answered Jan 14, 2021 at 13:17

Dasari Swaroop Kumar's user avatar

score:0

I’ve configured application context from code (a new feature of spring 3.1) so I believe that IntelliJ idea will keep complaining.
Here is the code.

package com.apress.prospring3.ch17.web.init;

import org.springframework.web.WebApplicationInitializer;
import org.springframework.web.context.support.XmlWebApplicationContext;
import org.springframework.web.servlet.DispatcherServlet;

import javax.servlet.MultipartConfigElement;
import javax.servlet.ServletContext;
import javax.servlet.ServletException;
import javax.servlet.ServletRegistration;


public class MyWebAppInitializer implements WebApplicationInitializer{

    @Override
    public void onStartup(ServletContext container) throws ServletException {
        XmlWebApplicationContext appContext = new XmlWebApplicationContext();

        appContext.setConfigLocation("/WEB-INF/spring/appServlet/servlet-context.xml");

        ServletRegistration.Dynamic dispatcher = container.addServlet("appServlet", new DispatcherServlet(appContext));

        MultipartConfigElement multipartConfigElement = new MultipartConfigElement(null, 5000000, 5000000, 0);
        dispatcher.setMultipartConfig(multipartConfigElement);

        dispatcher.setLoadOnStartup(1);
        dispatcher.addMapping("/");

    }
}

score:0

Satur6ay’s comment helps me particularry.

But xml-file was coloured «red» by Idea.
I found thar resources folder had not «resource»-icon, but had standard gray folder icon.
So, I went to File -> Project Structure -> my module -> found there «resorces» folder -> «Mark as» -> Resources.

xml-reference in web.xml become valid and all other references in xml-spring-configs ()become green-valid

score:0

Adding this worked for me!! thx to satur6ay

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

score:1

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.

Related Query

  • ‘Application context not configured for this file’ error after moving and renaming the default application-config.xml of IntelliJ IDEA
  • PUT and POST getting 405 Method Not Allowed Error for Restful Web Services
  • Getting this org.springframework.web.servlet.DispatcherServlet noHandlerFound error and WARNING: No mapping found for HTTP request URI in Spring MVC
  • JS and CSS file not found error in spring 3.0 web mvc
  • Why is it best to NOT load up the file system of your application with content in a production scenario for spring web apps?
  • Error in unit testing in Spring MVC: context configuration file not found
  • Spring boot application is not running after getting error Caused by: java.lang.NoClassDefFoundError: org/eclipse/jetty/server/RequestLog$Writer
  • Whitelabel Error Page This application has no explicit mapping for /error, so you are seeing this as a fallback
  • Error displaying jsp page and excel file ‘No mapping found for HTTP request with URI
  • How to configure log4j in a Spring Mvc application configured with Java Annotations and using a log4j.properties file
  • Error after moving <mvc:annotation-driven/>: no declaration can be found for element ‘mvc:annotation-driven’
  • context path for file upload without HttpRequest in REST application
  • tomcat 7 server will not start after deleting and reinstalling Spring PetClinic sample application
  • Why is this initialized and configured Dispatcher Servlet not processing any request?
  • Spring Application 404 for css file but not for html file
  • My Spring Application is not working. 404 error is coming instead of jsp file
  • Spring MVC- Internal Server Error + File Not Found Exception Servlet Context Resource
  • File and logger was not created for slf4j
  • spring MVC application is not working when using <context:component-scan> and throws 404 error
  • I have error after deploy WAR file to remote server(on local machine not error)
  • Not able to load image file in jsp of spring mvc and not getting alternate text for image
  • This application has no explicit mapping for /error
  • How to distinguish between null and not provided values for partial updates in Spring Rest Controller
  • Configure ViewResolver with Spring Boot and annotations gives No mapping found for HTTP request with URI error
  • What CMS to use for Spring MVC web application and device responsive web design?
  • applicationContext not finding Controllers for Servlet context
  • Spring Security logout does not work — does not clear security context and authenticated user still exists
  • Spring root application context and servlet context confusion
  • Meaning and solution for Spring 3 error message? «Using getResponseBodyAsStream instead is recommended»
  • How to Post multipart/form-data for a File Upload using SpringMVC and MockMVC

More Query from same tag

  • Spring MVC No mapping found for HTTP request with URI in DispatcherServlet
  • Solution for issue in Redirect or RedirectModel in SpringMVC
  • disable confirmation page in Spring OAuth2
  • org.springframework.beans.factory.BeanCreationException in SocialAuth (Spring)
  • RESTful web services and JSON document in GET request body
  • Spring — At least one JPA metamodel must be present
  • How to bind ENUM to radiobutton?
  • Spring MVC @EnableWebMvc Bean config
  • Spring mvc, how to bind a domain object that has a collection as its property
  • I have a parent class with an @ExceptionHandler and a subclass with it’s own version. I am getting an ambiguous method error
  • How to Access Additional Parameter in j_spring_security_check and access in AuthenticationProvider
  • How to call a non static method of controller in spring only once whenever my application gets started
  • Forcing FreeMarker to always print BigDecimal value with decimal point
  • Spring Integration: Intercept channels Asynchronuously
  • Different Thymeleaf layout decorators based on different Spring Securirty roles
  • Conditionally ignore primitive typed fields with Jackson
  • Spring MVC how to return to same view on login failed
  • 404 Error — Java Spring MVC using Maven in Eclipse from Tutorial
  • How to implement a DataList component in Spring MVC
  • Required String parameter ‘userName’ is not present
  • How do I add multiple Spring MVC controllers to my maven project
  • Spring MVC 3.0 Annotations — Conversation Forms — Beginner Questions
  • Spring AOP is not working in with MVC structure
  • FIlter data with Spring coming from request
  • Unable to download file in Spring MVC
  • Deploying a Spring application in a Tomcat server instance
  • The prefix «xmnls» for attribute «xmnls:mvc» associated with an element type «beans» is not bound
  • ‘Many To One’ attribute type should not be a container
  • High GC load using Hibernate
  • returning subset/subschema using spring data JPA

CREATING SPRING APPLICATION CONTEXT USING XML | DARIAWAN

2019-01-12 Creating a Spring Application Context from Multiple Files. A Spring application context can be configured from multiple files. We can partition (grouping) bean definitions into logical groups. The best practice is to separate out application beans from infrastructure beans. This is because infrastructure often changes between environments.
From dariawan.com


APPLICATION CONTEXT NOT CONFIGURED FOR THIS FILE于SPRING框架使用中 …

2020-08-15 application context not configured for this file于spring框架使用中的原因 The text was updated successfully, but these errors were encountered: All reactions
From github.com


NO FACTORIES CONFIGURED FOR THIS APPLICATION — ORACLE-TECH

2015-08-03 Aug 3, 2015 1:13AM edited Sep 3, 2015 10:28AM. No Factories configured for this Application. Hello, I need a help for migration project. Currently, we use S2JSF which is old framework. It uses «myfaces-1.0.9.jar» for JSF. When I deployed application on Glassfish v3, Exception is happened as below. I wrote about listener configuration in web.xml …
From community.oracle.com


SPRING BOOT APPLICATIONCONTEXT — USING APPLICATIONCONTEXT IN

2022-05-10 Spring ApplicationContext. ApplicationContext is a corner stone of a Spring Boot application. It represents the Spring IoC container and is responsible for instantiating, configuring, and assembling the beans. The container gets its instructions on what objects to instantiate, configure, and assemble by reading configuration metadata.
From zetcode.com


NO FACTORIES CONFIGURED FOR THIS APPLICATION WHY ,WHO CAN HELP …

2005-12-23 java.lang.IllegalStateException: No Factories configured for this Application — typically this is because a context listener is not setup in your web.xml. A typical config looks like this; <listener>. <listener-class>org.apache.myfaces.webapp.StartupServletContextListener</listener-class>. </listener>.
From community.oracle.com


APPLICATION CONTEXT NOT CONFIGURED FOR THIS FILE IN THE USE OF THE …

2019-12-31 This prompt often appears in the spring configuration file, which means that the file is not configured in the project. Then enter into the Project Structure to view It can be clearly seen that there is an exclamation mark below, probably meaning that the files below do not match Knowing the reason is very easy to solve the problem, just add it to the project problem solved …
From itworkman.com


TESTING THAT YOUR SPRING BOOT APPLICATION CONTEXT IS CORRECTLY …

2021-06-25 This validates that Spring’s context is configured correctly for our application, and makes sure we’ve got things like bean/property definitions. However, this test isn’t perfect! Although, yes, the test will fail before it executes if the context isn’t set, we can get the test passing incorrectly by putting it into the wrong package, or …
From jvt.me


C# — SESSION HAS NOT BEEN CONFIGURED FOR THIS APPLICATION …

2021-12-25 Thanks for contributing an answer to Stack Overflow! Please be sure to answer the question.Provide details and share your research! But avoid …. Asking for help, clarification, or responding to other answers.
From stackoverflow.com


INTELLIJ SPRING APPLICATION CONTEXT NOT CONFIGURED FOR THIS FILE

2021-09-09 Creating a Multi Module Project. (i.e. a jar file that is not an application). so that is configured using the spring-boot-starter-parent from Spring Boot as Flavors of Spring Application Context This article aims at listing the different ways a Spring application context can be configured so as I’m not a Groovy
From wineriesorangecounty.com


[SOLVED] SESSION HAS NOT BEEN CONFIGURED FOR THIS APPLICATION OR …

2021-11-18 Setting the Session Timeout. Inside this method, you will have to call the AddSession method of the services object. The AddSession can be called directly without any parameters and it can also be used to set the IdleTimeout property which sets the Session Timeout duration. Note: The default Session Timeout in ASP.Net Core is 20 minutes.
From aspsnippets.com


SESSION HAS NOT BEEN CONFIGURED FOR THIS APPLICATION OR …

Since, I’m not using app.UseMvc() the proposed answer could not work for me. So, for anyone landing here having the same problem in .NET Core 3.0, here’s what I …
From stackoverflow.com


THE SPRING APPLICATIONCONTEXT | BAELDUNG

2022-02-11 The Spring IoC container is responsible for managing the objects of an application. It uses dependency injection to achieve inversion of control. The interfaces BeanFactory and ApplicationContext represent the Spring IoC container. Here, BeanFactory is the root interface for accessing the Spring container. It provides basic functionalities for …
From baeldung.com


SPRING: FIX ‘APPLICATION CONTEXT IS NOT CONFIGURED FOR THIS …

{{ (>_<) }}This version of your browser is not supported. Try upgrading to the latest stable version. Something went seriously wrong.
From youtrack.jetbrains.com


APPLICATION CONTEXT NOT CONFIGURED FOR THIS FILE #35 — GITHUB

2020-05-08 Application context not configured for this file #35. Open hyeoy opened this issue May 8, 2020 · 0 comments Open Application context not configured for this file #35. hyeoy opened this issue May 8, 2020 · 0 comments Labels. IDEA Spring. Comments. Copy link Owner hyeoy commented May 8, 2020. 提示. 解决. The text was updated successfully, but these …
From github.com


RUN CONFIGURATION — APPLICATION CONTEXT – IDES SUPPORT (INTELLIJ …

2019-04-10 There is a setting for context, you may need to scroll down the dialog:
From intellij-support.jetbrains.com


APPLICATION-CONTEXT SPRING CONFIGURATION FILE NOT FOUND

2014-07-21 Stack Overflow Public questions & answers; Stack Overflow for Teams Where developers & technologists share private knowledge with coworkers; Talent Build your employer brand ; Advertising Reach developers & technologists worldwide; About the company
From stackoverflow.com


SPRING — APPLICATIONCONTEXT — GEEKSFORGEEKS

2021-07-11 Step 1: Creating a Spring Project using Spring Initializer as pictorially depicted below. Step 2: Create Student class under com.gfg.demo.domain and AppConfig class under com.gfg.demo.config packages. The AppConfig is the configuration class that contains all the Java beans configured using Java Based Configuration.
From geeksforgeeks.org


‘APPLICATION CONTEXT NOT CONFIGURED FOR THIS FILE’ ERROR AFTER …

2013-04-26 Satur6ay’s comment helps me particularry. But xml-file was coloured «red» by Idea. I found thar resources folder had not «resource»-icon, but had standard gray folder icon.
From stackoverflow.com


Понравилась статья? Поделить с друзьями:
  • B2424 ошибка lexus
  • App ication error
  • B2418 ошибка lexus
  • Api call to drive files insert failed with error file not found
  • B2109 ошибка infiniti