It seems that it is forbidden to read files from an EJB as stated in this link:
http://java.sun.com/blueprints/qanda/ejb_tier/restrictions.html#file_access
Enterprise beans aren’t allowed to access files primarily because
files are not transactional resources. Allowing EJBs to access files
or directories in the filesystem, or to use file descriptors, would
compromise component distributability, and would be a security
hazard.
What does “compromise component distributability” ???
Excerpt from How to Be Distributable from Enterprise Servlets and J2EE:
File system could be different from machine to machine and file descriptors definitely are. Using them could prevent EJB migration and/or passivation.
See also