1 Reply Latest reply on May 23, 2003 3:30 AM by frito

    Can I use session (or entity) beans to access the filesystem

    fburough

      I am attempting to implement the Lucene indexing system (which uses file-based indexes) as a service and was thinking of using EJBs to do so. Is this a reasonable thing to do with EJB or should I look to other approaches? I am new to EJBs so forgive me if this is a foolish question.

      Thanks for your help!

        • 1. Re: Can I use session (or entity) beans to access the filesy
          frito

          The spec clearly says you must not access file system:

          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 praxis JBoss will let you use the file system (other application servers may forbid this via the SecurityManager).
          But you have to be careful at all. Think of passivation, transactions and platform dependent issues.

          What about using a MBean to wrap the work Lucene is doing?

          Greetings,
          Frito