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

  • Home
  • SEARCH
  • 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 6360783
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T23:41:34+00:00 2026-05-24T23:41:34+00:00

I use maven build in my application. I have package like: 1> src/test/java //

  • 0

I use maven build in my application. I have package like:

1> src/test/java   // for Test application
2> src/main/java   // code 
3> src/main/resource  // resource files

at 1> i have written a Test file as:

public void testLoginDetails() {
    new ClassPathXmlApplicationContext(
                new String[] { "/com/home/app/Home-ctx.xml" });

Home-ctx is available at 2> ie src/main/java/com/home/app/Home-ctx.xml

but when i run the application I am getting following common error:

Caused by: java.io.FileNotFoundException: class path resource [com/home/app/Home-ctx.xml] cannot be opened because it does not exist
    at org.springframework.core.io.ClassPathResource.getInputStream(ClassPathResource.java:158)

I know this is classpath problem for xml file loading. How can I solve this?

  • 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-05-24T23:41:35+00:00Added an answer on May 24, 2026 at 11:41 pm

    You need to move

    src/main/java/com/home/app/Home-ctx.xml

    to

    src/main/resources/com/home/app/Home-ctx.xml

    Classpath resources need to go in a resources folder – currently you’ve got them under a java folder, which is for sources, not resources.

    If the resource is used only for testing, it should live in src/test/resources. For production resources, they go under src/main/resources.

    References

    • Maven – introduction to the standard directory layout
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this .bat script which I use to maven package my application. Problem
I have a Flex/Java web application that uses Maven as a build tool. Currently,
I am trying to build a Java EE application using Maven. I have the
I'm using maven war plugin to build war package. Before package is build test
We use maven to build Flex SWF applications. These SWF artifacts have a couple
I am using Maven (3.x) to build an Android application within Hudson. I use
I am using Maven (3.x) to build an Android application within Hudson. I use
I am trying to use maven to build a project that depends on a
I use Eclipse, Maven, and Java in my development. I use Maven to download
Right now, I have two Eclipse projects - they both use Maven 2 for

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.