• 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

EJB file trasnfer

 
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,all!
I have client-server application in local environment. The client (standalone application) has to copy log files to the server. I did it in the worst way - I read all files ( already archived in one zip file )in byte array and send them to the server, where they are written to a new File.
I would like to pass something like InputStream to the server , but InputStream is not serializable.
Does anyone have any idea how the wise people solve this kind of puzzles ?
 
author
Posts: 11962
5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Are you sending the byte array as a parameter to an EJB or using a socket connection? In either case, you can't pass an InputStream as such, but if you're using a socket connection, the socket itself if a kind of OutputStream to which you can write the byte array in smaller blocks.
 
High Plains Drifter
Posts: 7289
Netbeans IDE VI Editor
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The source of this question seems to be a more fundamental misunderstanding. I'm going to move this to Intermediate Java and see what happens to it.
 
Todor Mollov
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Michael Ernest:
The source of this question seems to be a more fundamental misunderstanding. I'm going to move this to Intermediate Java and see what happens to it.


Ok. I pass the byte array as a parameter to a Session bean. If the array is bigger than 15 MB an OutOfMemoryException is thrown. I could do it spliting the file in parts , but this is the same. I want another solution and I thougth that somebody else faced the same problem.
 
Ranch Hand
Posts: 1258
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Well, when you finally figure out all this, remember that EJB doesn't have access to the local filesystem (or at least shouldn't if you want your beans to be portable across all ejb containers).
It doesn't exactly seem like you really need ejb to do this. Ever heard about ftp? I've written utility programs that upload files to a remote ftp server in about 5 lines of code.
 
Todor Mollov
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I think you are not quite right. Where is said that EJB CAN'T access local 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.
"
EJB spec 494
I'm sure you don't understand my idea. I have client-server application in which clients are PC's that are connected via Intranet to a server machine on which is running application server. I want to collect all log files created by log4j debugging on the clients in one place - the server machine. This is programme's feature - clients press the button and all log files are zipped and transported to the server. The only connection with server is the RMI connection which clients make with the application server. I'm not supposed to have FTP or else.
So here is the problem. How can I transfer these zipped files to the server ?
[ January 18, 2004: Message edited by: Todor Mollov ]
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic