Win a copy of Spring Boot in Practice this week in the Spring forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Liutauras Vilda
  • Henry Wong
  • Devaka Cooray
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Al Hobbs
  • Carey Brown
Bartenders:
  • Piet Souris
  • Mikalai Zaikin
  • Himai Minh

global EJB environment variables

 
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Ranch Hand
Posts: 128
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Can you define all attributes in base class and let all EJBs extend this base class?
 
Ranch Hand
Posts: 1209
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Saloon Keeper
Posts: 25846
184
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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!
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic