File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
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
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
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Adding properties files to EAR classpath (Bonus points for including maven!)
 
Similar Threads
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
"NoClassDefFound Error" deploying EAR file
add manifest.mf to jar file using maven