wood burning stoves 2.0*
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 Android Security Essentials Live Lessons 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 java.io 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 foo.properties from the classpath? I didn't realize that and added my own foo.properties 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: http://aspose.com/file-tools
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 foo.properties file
Odd behavior when loading properties with ant