EJB allow access on I/O Function locally?

Discussions

EJB programming & troubleshooting: EJB allow access on I/O Function locally?

  1. EJB allow access on I/O Function locally? (3 messages)

    Is it possible to read write files locally for an EJB ???
    thnx for help
  2. Hi,

    the specifications says no, but in EJB1.0 (at least with Websphere 3.0.2)it was possible, although the application was terrible slow while reading informations from local filesystem. But as I've mentioned already, I'm almost 100% sure that the spec. doesn't advice that.

    Michael
  3. NO and even if it is possible (in Websphere), we should not think in that direction as it defeats the purpose of having a distributed component (EJB).

    -Chetan
  4. my take on this issue (based on the JBoss User & Dev mailing lists and Scott Stark) is that accessing files from an EJB is OK as long as you do not want the file access to be part of the bean transaction. otherwise it is probably better to rethink your approach.

    personally, i would wrap file access into a helper class that suppresses any errors occuring from file access -> this way the bean has no idea if something goes wrong and the transaction remains intact (log4j uses this approach in logging). this will also make the system slightly more portable as you're IO code will exist in one point and can be adapted to the particularly circumstances of platform and app server...use a factory method pattern and you will really be flexible.