The problem with the shortcomings of performing IO from EJB is that there is nothing you can do to solve them - since the container manages the bean. There are routes round this, specifically JCA. You will need a JCA Adapter to give you access to the file systems in a way which is safe for EJB.
the shortcomings of session beans for I/O operations may be -
1. timeout factor - after which the bean is reclaimed by the container. 2. for stateless session beans, the state is not preserved between diff. method calls. So the handle to I/O operations can't be maintained across diff. method calls i.e. can't be maintained as class variables. This I/O operations will have to be opened and closed in same method. 3. In stateless session bean- subsequent call to same method can be processed by any instance of session bean that is available in instance pool.
I am not quite sure about the alternative - One way to solve above 3 points may be to use BMP beans create method for I/O operations instead of some sql insert statements. As BMP beans maintain state and the same instance serves a client request.
I have similar situation. Can we use JMS to solve this? I may post message when I need to read file. Listner could then read the file and send me back as message. Has anybody actually tried out some solution for i/o problem? Using JCA just for file read seems to be too much of work.
The first issue I can see with that approach is since JMS is asynchronous you might be waiting a looong time for the "here's the file contents" message. JMS is asynchronous therefore how your app uses IO would need to be too.
Yes, I've tried JMS for flatfile and XML transmission and it works fine. It is asynchronous, but why exactly would a message take a "looong time" to get to its consumer under normal conditions?
Hoo hoo hoo! Looks like we got a live one! Here, wave this tiny ad at it: