wood burning stoves*
The moose likes EJB and other Java EE Technologies and the fly likes Adding properties files to EAR classpath (Bonus points for including maven!) Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "Adding properties files to EAR classpath (Bonus points for including maven!)" Watch "Adding properties files to EAR classpath (Bonus points for including maven!)" New topic
Author

Adding properties files to EAR classpath (Bonus points for including maven!)

Phil Potter
Greenhorn

Joined: Sep 11, 2009
Posts: 3
Greetings all,

My google-fu has failed, so I thought I'd ask around and see if anyone would be kind enough to offer any helpful advice.

I'm struggling to add a properties file to my EAR's classpath.

I have (for the sake of argument) a log4j.xml which lives @ META-INF/log4j.xml.

I create a META-INF/MANIFEST.MF file inside my EAR with the following contents:

Manifest-Version: 1.0

Archiver-Version: Plexus Archiver

Created-By: Apache Maven

Built-By: catch

Build-Jdk: 1.6.0_20

Class-Path: META-INf/log4j.xml

However, I still can't access the properties file. If I move the file to the root of the EAR (and remove the contents of the Class-Path entry) I can access the EAR.

For extra points, what's the magic setting to get the maven-ear-plugin to pick this up and add it to the classpath? Or do I need to manually specify my MANIFEST.MF and not rely on maven to generate it?

Any tips or tricks greatly appreciated.
Amol Nayak
Ranch Hand

Joined: Oct 26, 2006
Posts: 218
Hi Catch Try, Please change your name according to the Naming Policy
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: Adding properties files to EAR classpath (Bonus points for including maven!)
 
Similar Threads
"NoClassDefFound Error" deploying EAR file
Classloader problem while accesing a resource within an EAR
Problem making a class in another jar visiable to a ejb in its ejb jar
log4j.properties
add manifest.mf to jar file using maven