Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

global EJB environment variables

 
Eric Lim
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 128
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can you define all attributes in base class and let all EJBs extend this base class?
 
Karthik Guru
Ranch Hand
Posts: 1209
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 18214
53
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic