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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T00:15:42+00:00 2026-06-15T00:15:42+00:00

When I put xml resources such as spring configuration files, logging … etc in

  • 0

When I put xml resources such as spring configuration files, logging … etc in the src/main/resources these files are not readable by my application when I run it in the embedded tomcat plugin. However moving these files into src/main/java fixes the problem.

Here is the plugin definition that I am using:

<plugin>
    <groupId>org.apache.tomcat.maven</groupId>
    <artifactId>tomcat7-maven-plugin</artifactId>
    <version>2.0</version>
    <configuration>
        <port>9090</port>
        <path>/</path>
            <contextFile>${basedir}/src/main/webapp/META-INF/context.xml</contextFile>
    </configuration>
    <dependencies>
        <dependency>
            <groupId>postgresql</groupId>
            <artifactId>postgresql</artifactId>
            <version>${postgres.version}</version>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-instrument-tomcat</artifactId>
            <version>${spring.framework.version}</version>
        </dependency>
        <dependency>
            <groupId>javax.mail</groupId>
            <artifactId>javax.mail-api</artifactId>
            <version>${javax.mail.version}</version>
            <exclusions>
                <exclusion>
                    <artifactId>activation</artifactId>
                    <groupId>javax.activation</groupId>
                </exclusion>
            </exclusions>
        </dependency>
    </dependencies>
    <executions>
        <execution>
            <id>default-cli</id>
            <goals>
                <goal>deploy</goal>
                <goal>run-war</goal>
            </goals>
            <phase>pre-integration-test</phase>
        </execution>
    </executions>
</plugin>

Why can the resources be found when I put them in src/main/java but not when I put them in src/main/resources when running mvn tomcat7:run

UPDATE: I am using eclipse with m2e I can run the application just fine using Run As > Run on Server which is pointed to a local tomcat server. The folder structure is correct, eclipse settings are coming from the pom.xml via m2e.

SEVERE: Exception sending context initialized event to listener instance of class org.springframework.web.util.Log4jConfigListener
java.lang.IllegalArgumentException: Invalid 'log4jConfigLocation' parameter: class path resource [log4j-config.xml] cannot be resolved to URL because it does not exist
    at org.springframework.web.util.Log4jWebConfigurer.initLogging(Log4jWebConfigurer.java:155)
    at org.springframework.web.util.Log4jConfigListener.contextInitialized(Log4jConfigListener.java:45)
    at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4791)
    at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5285)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
    at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1559)
    at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1549)
    at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
    at java.util.concurrent.FutureTask.run(FutureTask.java:166)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
    at java.lang.Thread.run(Thread.java:722)

in this case log4j-config.xml is in src/main/resources, there are few more exceptions like that saying that files on src/main/resources folder don’t exist.

Update 2: The problem turned out to be a <resources> element in the parent POM that was causing the .xml files to not be included in the generated output.

  • 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-15T00:15:44+00:00Added an answer on June 15, 2026 at 12:15 am

    Normally when eclipse try to find the files which are defined by your application..it links the src to src/main/java and src/main/resources..could you see the following entries in .class file of maven generated for eclipse..

    <classpath>
        <classpathentry including="**/*.java" kind="src" path="src/main/java"/>
        <classpathentry excluding="**/*.java" kind="src" path="src/main/resources"/>
    
    /**all repository entries are also here**/
    </classpath>
    

    then for the resources first the tomcat checks whether they are in the resources (and also checks them in the java folder)

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

Sidebar

Related Questions

I'm using maven and I put urlrewrite.xml under source folder src/main/resources/. Configure web.xml like
My organization wants to put configuration of the container (such as JMS resources and
I have a test project requiring some heavy jars which i put in ${M2_HOME}\test\src\main\resources\
My webapp has a non-empty production beans.xml under src/main/resources/META-INF . Now, for my tests,
when i put struts.xml in web-inf it is showing error......when i put in src
I wonder where to put data files (for example XML) to be loaded internally
I want the test-compile action to put the contents of src/test/resources into target/scala_2.8.1/test-classes. The
In the values/colors.xml, I put: <?xml version=1.0 encoding=utf-8?> <resources xmlns:android=http://schemas.android.com/apk/res/android> <color name=blank>#f0f0f0</color> </resources> In
I don't want to put my .properties and log4j files in my /resources folder
i take a string from my ressource strings.xml and put the string in a

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.