io operations in ejb


EJB programming & troubleshooting: io operations in ejb

  1. io operations in ejb (6 messages)

    How can i do 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.

    Rakesh Girase

    Threaded Messages (6)

  2. io operations in ejb[ Go to top ]

    From section 24.1.2 in the EJB 2.0 spec:

    An enterprise bean must not use the package to attempt to access files and directo-ries
    in the file system.

  3. io operations in ejb[ Go to top ]

    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...
  4. io operations in ejb[ Go to top ]


    I would recommend you don't just blindy read the rules but understand why the are restrictions about using

    "• An enterprise bean must not use the 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.

  5. io operations in ejb[ Go to top ]


    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.

  6. io operations in ejb[ Go to top ]

    Hi David!

    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?

  7. io operations in ejb[ Go to top ]