How can i do java.io operations using ejb.Like if ejb client would like to read/write files which is there on server,how can the ejb will get access to those local/server files to do read and write operations.
can the file operation is possible in ejb if yes plz let me know.
From section 24.1.2 in the EJB 2.0 spec:
An enterprise bean must not use the java.io package to attempt to access files and directo-ries
in the file system.
i did similiar things ... but i wrap the work within another java class to do it ... and make sure you set a timeout if it takes too long...
I would recommend you don't just blindy read the rules but understand why the are restrictions about using java.io
"• 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."
To me this reads that if you are just reading a properties from the file system you should be ok. Obviously the file system does not support transactions, security etc so don't expect it to.
Also don't think just because you wrap something in a java class makes it any better than doing it directly in an EJB. Your java classes are running inside the container and although not managed directly by the container they are subject to the same distributed environment.
With regards timeouts. I work with weblogic and one word of warning with timeouts is don't expect to much from the containers transaction timeout when it comes to blocking calls. The containers timeout value will only be checked when a transaction is committed/rollbacked or propegated to a transaction aware component.
If one is available always set a blocking calls timeout. If you don't you could hang the containers worker thread.
I think you are correct when you say "don't just blindy read the rules" in your comment on the EJB programming restrictions. However, programmers breaking the rules should really know what they are doing. (Plus communicate this to their technical lead and chief architect...)
Sorry for being a bit religious when referring to the spec.
When it comes to code referred by the EJB implementation class, I think it is clear that such classes are under the EJB programming restriction too! The important thing is the context where the code is executed (an EJB), and not the physical class file keeping the code. Maybe a good idea to make this more clear in the spec?