aspose file tools*
The moose likes EJB and other Java EE Technologies and the fly likes application-wide 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 "application-wide "env-entry" ??" Watch "application-wide "env-entry" ??" New topic
Author

application-wide "env-entry" ??

Terence Doyle
Ranch Hand

Joined: May 30, 2001
Posts: 328
Hi,
I'm creating a J2ee application using various EJB's and at least one WAR, all inside one single EAR file.
This app. is to be intalled at different clients. I'd like to be able to specify different properties ( server used, remote host addresses, etc.) in some part of the EAR that will be available using
(String)context.lookup("java:comp/env/" + name );
I have been able to customize individual EJB's using the <env-entry> tag in its DD but what about the being able to customize the whole application??
I'm been scouring docs and the net and I can't see any specific application.wide examples.
Many thanks for your help.

Terry Doyle


Raising Flares debut album 'Ignition' out now

http://www.raisingflares.com

Terry Doyle <br />SCPJ 1.4 , SCWCD , SCMAD(Beta)
Dave Landers
Ranch Hand

Joined: Jul 24, 2002
Posts: 401
This is, IMHO, one of the big weaknesses of J2EE. EJB and WebApps have lots of neat ways to do configuration (ejb-rev, env-entry, etc) but there is nothing at the application level.
There are lots of options, but if you want to stick with the spec, one thing you could do is to make a session bean that contains all the application-wide env-entry settings. Call something like getProperty(key) on that bean to retrieve the single env-entry from anywhere in the app. Not exactly pretty, but it works.
Blatant Advertisement:
Come to my Techniques for Building J2EE Applications talk at this year's Colorado Software Summit where we will discuss this and several other similar issues
Terence Doyle
Ranch Hand

Joined: May 30, 2001
Posts: 328
Hi Dave,
We've already got it working by placing the properties in one EJB DD and the WAR DD but I'm just not happy with that.
Too many chances of the application assembly getting more complicated than it should be.
You're the only one that answered - and with a confirmation of my worst fears - so I guess there's just nothing doing. If ANYONE has a way to do this please let me know, if not let's complain to SUN :-)
Suggestion to Sun for the next version of application.xml DTD .... How about allowing <env-entry> elements there that are placed in an application-wide jndi context ( java:comp/app for example )

Terry
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: application-wide "env-entry" ??
 
Similar Threads
ejb-ref to ejb in different app
Deploying EAR
Possible to set an env-entry to null in my web.xml file?
Properties file
Two session beans, one class, much confusion