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 6566339
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T14:12:19+00:00 2026-05-25T14:12:19+00:00

I think I ran into an error with my classpath settings. I want to

  • 0

I think I ran into an error with my classpath settings.

I want to test an internationalized web-app which has the messagesource defined like this:

<bean id="messageSource"
  class="org.springframework.context.support.ReloadableResourceBundleMessageSource">
    <property name="basenames">
        <list>
            <value>/WEB-INF/i18n/errors</value>
            <value>/WEB-INF/i18n/messages</value>
            <value>/WEB-INF/i18n/links</value>
            <value>/WEB-INF/i18n/forms</value>
            <value>/WEB-INF/i18n/communication</value>
        </list>
    </property>
</bean>

Loading these values works perfectly in a production environment.
When running a Junit Test however, it can’t resolve those property files because they are not on the classpath.

However, I want them to be NOT on the classpath because then I can make use of the feature where I can change something in the property files and it’s reflected on the website immediately: Since application servers typically cache all files loaded from the classpath, it is necessary to store resources somewhere else (for example, in the "WEB-INF" directory of a web app). Otherwise changes of files in the classpath will not be reflected in the application.

The spring applicationContext is located there: /src/main/resources/spring/applicationContext.xml
and loaded into the Junit test with these annotations:

@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(locations = {"classpath:/spring/applicationContext.xml"})

How can I get Junit to pick up those non-classpath resources as well?
The property files are on /src/main/webapp/WEB-INF/i18n/*

Junit: 4.7.

Spring: 3.0.5.

  • 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-25T14:12:19+00:00Added an answer on May 25, 2026 at 2:12 pm

    I fixed my initial problem in the meantime.

    Matthew’s solution didn’t help me – still very good input.
    And he couldn’t know that I was using maven in my project since I never told.

    However, within maven, I found a solution to my problem:

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <configuration>
                    <skipTests>true</skipTests>
                    <additionalClasspathElements>
                        <additionalClasspathElement>src\main\webapp\</additionalClasspathElement>
                    </additionalClasspathElements>
                </configuration>
            </plugin>
    

    I configured the surefire-plugin to pickup additional elements for the classpath.

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

Sidebar

Related Questions

I have ran into a really annoying issue which gives me this error: The
Based on a simple test I ran, I don't think it's possible to put
I am updating our iPhone app to iOs4 and I ran into an issue
A co-worker ran into an interesting issue today, and while I think the actual,
I've ran into a strange situation. I'm writing some test cases for my program.
So we ran into an interesting issue today. We have a Java EE web
I just started working with Javascript and I ran into an error with Visual
I just ran into this situation and i thought it was a nice opportunity
I've ran into a really weird problem while working on a large project. I
I am learning mysql and ran into a problem with 'mysql.proc' missing when trying

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.