aspose file tools*
The moose likes EJB and other Java EE Technologies and the fly likes global EJB environment variables Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "global EJB environment variables" Watch "global EJB environment variables" New topic
Author

global EJB environment variables

Eric Lim
Greenhorn

Joined: Apr 01, 2002
Posts: 19
Hi
Does anybody know whether you can define a global environment entry (<env-entry> that can be accessed by all EJBs?
As far as I know, environment entries in ejb-jar.xml are EJB-specific but I need a facility to be able to store common EJB properties that are needed by all EJB's in the JNDI name space. Is this available via the standard J2EE EJB deployment descriptor?
If not, can anybody share his experience on how this (i.e. global EJB environment entries) is achieved by some other means? I want to stay away from Property files as much as possible because it could lead to some issues that violate the EJB specs (such as file system access).
thanks
eric
Snigdha Solanki
Ranch Hand

Joined: Sep 07, 2000
Posts: 128
Can you define all attributes in base class and let all EJBs extend this base class?


Snigdha<br />Sun Certified Programmer for the Java™ 2 Platform
Karthik Guru
Ranch Hand

Joined: Mar 06, 2001
Posts: 1209
is there somethign wrong with having a start up class that can read the properties file for you
and return the value when requested?
i mean the start up class is not a EJB.
Originally posted by Eric Lim:
Hi
Does anybody know whether you can define a global environment entry (<env-entry> that can be accessed by all EJBs?
As far as I know, environment entries in ejb-jar.xml are EJB-specific but I need a facility to be able to store common EJB properties that are needed by all EJB's in the JNDI name space. Is this available via the standard J2EE EJB deployment descriptor?
If not, can anybody share his experience on how this (i.e. global EJB environment entries) is achieved by some other means? I want to stay away from Property files as much as possible because it could lead to some issues that violate the EJB specs (such as file system access).
thanks
eric
Eric Lim
Greenhorn

Joined: Apr 01, 2002
Posts: 19
Hi karthik,
That is what we are currently doing. We have a servlet that is started automatically by the app server and then we piggy-back from that by loading the properties from the file system at that point. At the moment it works fine because the web and ejb containers run on the same JVM in our app server. But when you have a situation where the EJB container runs on a different JVM than the web, it's a problem.
How did you implement the start-up class in your case?
thanks
Eric
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 16142
    
  21

Y'know, actually, if you're going to be picking up properties for use by EJBs in a number of JVMs, I'd put them in an EJB!


Customer surveys are for companies who didn't pay proper attention to begin with.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: global EJB environment variables