This week's book giveaway is in the Android forum.
We're giving away four copies of Head First Android and have Dawn & David Griffiths 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 Head First Android this week in the Android 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.
I agree. Here's the link:
subject: Accessing files from EJB
It's not a secret anymore!