*
The moose likes EJB and other Java EE Technologies and the fly likes Putting properties files in the root of the .ear? 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 "Putting properties files in the root of the .ear?" Watch "Putting properties files in the root of the .ear?" New topic
Author

Putting properties files in the root of the .ear?

Peter Storch
Ranch Hand

Joined: Jun 12, 2003
Posts: 74
Hi,
we first had our properties packaged in a .jar file within the .ear. The ejb and war modules then referenced this .jar file in the Class-Path entry in the manifest.mf file. It worked so far.
During deployment we found that sometimes it's necessary to adjust a properties file due to a change in the environemnt. It was quite messy to unpack the .jar file, edit the .properties file and repackage again. And we didn't want to perform a whole redeployment.
Then we came up with the idea to have the .properties directly in the root of the .ear. This works in WebSphere 4.0.x but I don't know if this is a good approach (according to the J2EE spec).
Does someone know if this works generally? Are all files in the .ear root included in the classpath so they can be loaded by getResourceAsStream()?
Jeanne Boyarsky
internet detective
Marshal

Joined: May 26, 2003
Posts: 30116
    
150

Peter,
You definitely should keep the property files loose (in other words, not in a jar.) We keep ours under a directory (/config) under the root of the ear and set websphere's classpath to refer to it.


[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
Peter Storch
Ranch Hand

Joined: Jun 12, 2003
Posts: 74
Changing the WebSphere classpath is not appropriate for us. Because there are several applications deployed in this appserver with similar properties files (same name but different settings e.g. log4j.properties).
Frank Hefter
Greenhorn

Joined: Apr 14, 2004
Posts: 3
Originally posted by Peter Storch:
During deployment we found that sometimes it's necessary to adjust a properties file due to a change in the environemnt. It was quite messy to unpack the .jar file, edit the .properties file and repackage again. And we didn't want to perform a whole redeployment.

We put such properties into database. Protected by a installer role.
Is that possible in your case?
Frank
 
jQuery in Action, 2nd edition
 
subject: Putting properties files in the root of the .ear?
 
Similar Threads
JBoss class loader
Running from EAR
How to make utility JAR's in EAR's available to WAR's....
How to use CertRolesLoginModule
Properties file