2 Replies Latest reply on Jul 26, 2002 7:25 AM by nhebert

    if I use jboss, Can I use java.io package?

    homekeeper

      HI~~
      As you know, EJB can't import java.io package.
      But Someone Say, Sometimes it's ignored.
      he uses WebSphere.
      So If I use jboss, can I use java.io package?
      plz reply

      Although I use jboss, I can't import java.io package...
      How can I save file?
      do you know?

        • 1. Re: if I use jboss, Can I use java.io package?
          sharkman

          You cannot access the file system from an ejb.
          But you could write an mbean which does the i/o stuff and call it from the ejb.
          See the Documentation for how to write an mbean.

          - Stefan

          • 2. Re: if I use jboss, Can I use java.io package?
            nhebert

            HomeKeeper,

            Yes, you can use the java.io package! Just not for
            file or directory access to a local filesystem.

            The points are made in (EJB 1.1) 18.1.2 are
            very clear about this. Files in and of themselves are
            not well suited to a distributed, transactional
            environment.

            But...

            The next point that EJBs can be socket clients. This
            means they must be able to import java.net.* AND
            java.io.*. This works for me in JBoss 3.0.0. After all,
            how can we call out to Web Services (hint, hint) from
            EJBs which the draft J2EE 1.4 (EJB 2.1) says that we
            can and should.

            Bottom line, using java.io.* for file I/O is a definite
            no-no as per the spec.

            Since you mention WebSphere, I can say that WAS 4.0.1
            happily writes to the local filesystem which it should
            not, without a whinge. Go figure. So much for
            J2EE certification...

            Cheers,

            Noel.