• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Working with file-system in EJBs

 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
My application requires a excel file to be saved on server hard disk. Later a user can view a file saved earlier.
To implement it I am using the classes provided in java.io package. <br>
The application is working fine on non-clustered environment. But the application is going to be deployed on clustered environment.<br>
I read somewhere that reading/writing a file from EJBs should be avoided especially on clustered environment.
This has raised some doubts in my mind:<br>
 (i)  Will the code fail on clustered environment?<br>
 (ii) What other alternatives are open to resolve the problem?<br>
 (iii) Will putting the IO code in simple java class & calling it from EJB solve the problem?
<br>
Please help. <br>
Thanks<br>
Praveen
 
Bartender
Posts: 10336
Hibernate Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
(i)The code is open to failure. Suppose you make a call in a Stateless Session bean to save a file, then make a seperate call in a Statless Session Bean to read it - what guarentees do you have that the beans have access to the same file systems, given they could be running on two different servers?
(ii)A Resource Adapter is the route you have round this problem. There are already opensource projects out there which do this (sorry, I can't remember any names right now - perhaps someone else will, or you can just search sourceforge etc. ), or you could write your own.
(iii)No. You still have the same problem as (i) - on which physical machine is the code running on?
 
praveenK soni
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Paul for your response.
But if we can not use java IO in any java class used in a web-application then do you want to say that java IO can not be used in a web based application not even in a servlet?
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic