Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9166117
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T15:05:04+00:00 2026-06-17T15:05:04+00:00

My controller class is in com.tps.sphbIntegration.controllers package My applicationContext.xml file is in WEB-INF/spring/applicationContext.xml In

  • 0

My controller class is in com.tps.sphbIntegration.controllers package

My applicationContext.xml file is in WEB-INF/spring/applicationContext.xml

In the controller class:

@Controller
@RequestMapping("jsp")
public class SpringController {

@RequestMapping(value="register.html" , method = RequestMethod.POST)
public String enterSucess(@Valid Login login , BindingResult result , Map model,HttpSession session){

    if(result.hasErrors()){
        System.out.println("Error happened...");
        return "register";
    }else{

    System.out.println("I am an controller for get method of jsp/success.html ");
    login = (Login) model.get("login");
    session.setAttribute("empId", login.getEmpId()) ;
    session.setAttribute("empName", login.getEmpName()) ;
    session.setAttribute("empPassword", login.getEmpPassword()) ;
    //session.setAttribute("empGender", login.getGender()) ;
    //session.setAttribute("empType", login.getEmpType()) ;

    ApplicationContext factory = new ClassPathXmlApplicationContext("spring/applicationContext.xml");
    EmployeeDao dao=(EmployeeDao)factory.getBean("d");
    dao.saveEmployee(login);

    return "registerCheck";
    }

  }
}

When execution I got the exception as

java.io.FileNotFoundException: class path resource [spring/applicationContext.xml] cannot be opened because it does not exist

Please help me to set the path of applicationContext.xml in the controller or give some example that how to access the applicationContext.xml in controller.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T15:05:05+00:00Added an answer on June 17, 2026 at 3:05 pm

    You have to tell the servlet context loader listener where to find your Spring application context XML files in the web.xml. Your error suggests to me that you didn’t do that.

    If you do have it in your web.xml, check the paths to see if they’re correct.

    If the paths are correct, open the WAR file and see if the XML is missing. Perhaps you have a deployment and packaging issue.

    A web app should NOT be calling this:

    ApplicationContext factory = new ClassPathXmlApplicationContext("spring/applicationContext.xml");
    

    This will work if there’s a spring/applicationContext.xml in your WEB-INF/classes directory, but the preferred idiom is to use the ContextLoaderListener:

    Use a ContextLoaderListener in accordance with DispatchServlet

    You ought to be loading the application context for your entire app on startup, not for one controller and certainly not every time this URL is called by clients. Load it once on startup.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

My default package name is com.xont.controller (R file contain that package.Eclipse generated one) .
I used this tutorial to rename a view controller http://iosdeveloperzone.com/2011/05/14/how-to-rename-a-class-using-refactoring-in-xcode-4/ Basically just switch to
My base controller class, BaseController , is inherited by public-facing controllers to access a
I am using Spring MVC with annotation configuration. I have a controller class for
I tried this from my browser: http://example.com/contact But then I get Controller class ContactController
I have a controller class with a RequestMapping method. This method is not being
I have included the primefaces-3.4RC1.jar in the WEB-INF/lib directory. In my controller im autowiring
code is like this: @Controller public class TestController { @RequestMapping(value = /testerror, method =
I have been going through the tutorials of Spring 3 at http://www.vaannila.com/spring/spring-annotation-controller-1.html But i
I've currently got a BaseController class that inherits from System.Web.Mvc.Controller . On that class

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.