The EJB spec is firmly against file access from EJBs. For example, in v2.1 of the spec, pg 563, you will find:
An enterprise bean must not use the java.io package to attempt to access files and directories in the file system.
The file system APIs are not well-suited for business components to access data. Business components should use a resource manager API, such as JDBC, to store data.
In the real world, sometimes this is not strictly followed (such as for logging). Does anyone out there follow this guideline to the letter?
Also, if you are talking about the need to transfer/store/retrieve the data, perhaps using a database for persistence is a better solution. For example, if you ever move to a clustered environment, you will have problems if Machine A handles the store file operation, creating the file on Machine A, and then when Machine B picks up the retrieve request it would be unable to find the file. It is not impossible to make this work in a cluster (think about an exported drive or shared file system), but it does add complexity.
Of course, you still need to pass the actual data through from the servlet to the EJB, regardless of how you persist it. Maybe an array of bytes would work for you.
[ January 12, 2006: Message edited by: Don Morgan ]