This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes EJB and other Java EE Technologies and the fly likes Accessing files from EJB Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "Accessing files from EJB" Watch "Accessing files from EJB" New topic

Accessing files from EJB

John Lindwall
Ranch Hand

Joined: May 29, 2002
Posts: 31
I'd like to have some property files available from an EJB. The EJB spec says not to access files using from an EJB. Um ... OK.
What are some practical solutions to this issue?
I dislike user getResource() because (being classpath-based) it opens the door to configuration errors. "Oh you mean we're loading from the classpath? I didn't realize that and added my own to the classpath and it was loaded instead of the expected one". I like something more explicit.
Lilac Ezer

Joined: Apr 08, 2003
Posts: 8
I think the preferred solution is to declare your properties in the EJB deployment descriptors in <env-entry> elements.
I think if you called getResource or used the Preferences API in jdk1.4, that is still 'cheating' because I/O calls may still take place, even if you are not calling a file directly.
wood burning stoves
subject: Accessing files from EJB
Similar Threads
Oh classpath, why do you hate me?
JDK and J2sdkee required when i have websphere?
property files in ejb tier
where to place file
Odd behavior when loading properties with ant