File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Servlets and the fly likes Using Application Property files in an EAR Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Reply locked New topic

Using Application Property files in an EAR

Obi Kenobi

Joined: Nov 02, 2005
Posts: 2
In my deployment set-up, I want to keep the application level

property files outside of the EAR file, so that if we ever need to

modify the contents of these files, we won't have to re-deploy the EAR


There are two ways (that I know) to do this. One is hardcode the

location of the property file on the server, but that bring up the

issue of having J2EE components accessing resources on the server , not
to mention a bunch of other issues if we have a clustered setup. The

2nd option is using a URL provider. I'm trying to set it up as per the

WAS documentation but get a wierd error.

The error I get is ..

Context: mhubDevCell2/nodes/sun522mhub-devn2_1/servers/server1, name:
url/PhoenixProperties: First component in name PhoenixProperties not

where "url/PhoenixProperties" is the JNDI name and "PhoenixProperties"

is the URL (resource) on the WAS instance.

Was wondering if anyone here has received this error and fixed it OR if
anyone here has a more graceful way to configure & deploy application
level property files
Scott Selikoff
Saloon Keeper

Joined: Oct 23, 2005
Posts: 3753

Why is this repeated here:

[OCA 8 Book] [Blog]
Rajesh Agarwal
Ranch Hand

Joined: Aug 01, 2005
Posts: 79
The best way to do this is to keep the file external to the ear file. Then
specify the path of the path in the -D parameter for java. In case you are using weblogic, you can specify -DKey=value where the java is started. Then in your code you could read the value of this key , load the file and parse it. Let me know if this solves your purpose
Paul Bourdeaux
Ranch Hand

Joined: May 24, 2004
Posts: 783
Master Kenobi...

First, please refrain from cross posting. Second, regardless of how strong you are in the ways of the force, I doubt your real name is Obi Kenobi. Please change it to adhere to the Java Ranck naming policy.

“Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning.” - Rich Cook
I agree. Here's the link:
subject: Using Application Property files in an EAR
jQuery in Action, 3rd edition