I am trying to build a Maven EAR project that has a WAR project as a module. When I try to add log4j to it, it is unable to find the log4j.properties file which is located in the src/main/java folder of the web project.
It gives the error below -
[6/12/15 12:43:26:786 IST] 0000009c SystemOut O log4j: Trying to find [log4j.properties] using ClassLoader.getSystemResource().
[6/12/15 12:43:26:786 IST] 0000009c SystemOut O log4j: Could not find resource: [null].
Below is my pom.xml file from the web project
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<artifactId>HR-PrepLoad-ui</artifactId>
<packaging>war</packaging>
<name>${project.artifactId}</name>
<url>http://maven.apache.org</url>
<dependencies>
<dependency>
<groupId>com.hemant.css.hr</groupId>
<artifactId>HR-PrepLoad</artifactId>
<version>0.0.1-SNAPSHOT</version>
<type>pom</type>
<scope>import</scope>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<version>2.5</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.servlet.jsp</groupId>
<artifactId>jsp-api</artifactId>
<version>2.1</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.hemant.css.hr</groupId>
<artifactId>HR-PrepLoad-core</artifactId>
<version>0.0.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.17</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.0.2</version>
</plugin>
<plugin>
<artifactId>maven-war-plugin</artifactId>
<version>2.2</version>
</plugin>
</plugins>
</build>
<parent>
<groupId>com.hemant.css.hr</groupId>
<artifactId>HR-PrepLoad</artifactId>
<version>0.0.1-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
</project>
Does anybody have any suggestions of what might be causing this?
your
log4j.properties
file should be in resource folder.Try putting it from
src/main/java
to resource folder