File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
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
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!