• 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

pass the File INput Stream to the server

 
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Dear all:
I try to send over a file from the client GUI
to the server so it can upload the file from the client GUI to server local disk. However
it keep give me this error
wt.fc.fcResource/0) wt.util.WTException: The operation: "saveToServer" failed. Nested exception is:
wt.util.WTRemoteException: Unable to invoke remote method; nested exception is:
java.rmi.MarshalException: error marshalling arguments; nested exception is:
java.io.NotSerializableException: java.io.FileInputStream
java.io.NotSerializableException: java.io.FileInputStream
at java.io.ObjectOutputStream.outputObject(Unknown Source)
at java.io.ObjectOutputStream.writeObject(Unknown Source)
at wt.method.MethodArgs.writeExternal(MethodArgs.java:173)
at java.io.ObjectOutputStream.outputObject(Unknown Source)
at java.io.ObjectOutputStream.writeObject(Unknown Source)
at sun.rmi.server.UnicastRef.marshalValue(Unknown Source)
at sun.rmi.server.UnicastRef.invoke(Unknown Source)
at wt.method.MethodServerImpl_Stub.invoke(Unknown Source)
at wt.method.RemoteMethodServer.invoke(RemoteMethodServer.java:609)
at ext.bose.viewable.VisualUtilServiceFwd.saveToServer(VisualUtilServiceFwd.java:201)
at wt.clients.beans.contentholder.ViewablContentHolder.uploadContentItems(ViewablContentHolder.java:2433)
at wt.clients.beans.contentholder.ViewablContentHolder.persistContentChanges(ViewablContentHolder.java:1570)
at wt.clients.beans.contentholder.ViewablContentHolder.processSaveCommand(ViewablContentHolder.java:1988)
at wt.clients.beans.contentholder.ViewablContentHolder.access$700(ViewablContentHolder.java:43)
at wt.clients.beans.contentholder.ViewablContentHolder$ActionThread.run(ViewablContentHolder.java:298)
Can someone please give me a hand
ThaNKS
 
Sheriff
Posts: 7001
6
Eclipse IDE Python C++ Debian Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The error is because you are trying to send something over RMI which is not Serializable. This usually ocurrs for one of two reasons: either you have created a new class and forgot to mark it as Serializable, or you are trying to send some sort of system object which it doesn't make sense to send.
In this case. I think the reason is the second one I give. You seem confused about what an InputStream is. The best way I find to think of an input stream is as a small note of what the software would need to ask the operating system if it wanted to get more data.
Let's imagine that your client is running on a Windows machine and the user wants to send the file "c:\temp\whatever.txt" to the remote system. If the client opens a FileInputStream on the named file, nothing appears to happen immediately. What has happened is that the FileInputStream has asked the operating system where on the disk the file is, and how to read bytes from it. If the client asks to read bytes from the InputStream, each call actually asks the operating system for the next chunk of the file.
Now, if I were to send the InputStream itself to the remote system, all that would arrive is a note of how to ask a Windows to read the next few bytes from a local hard disk. Which would probably be useless even on another Windows machine, and completely pointless on a Unix machine.
If you want to send the content of a file over RMI, you need to load the file into some sort of ovbject (a String, a byte[], whatever), close the file, and send the loaded data.
Has this helped ?
 
Ranch Hand
Posts: 198
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Its really help me .. thanks a lot
 
Bartender
Posts: 1638
IntelliJ IDE MySQL Database Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Mohammed,

Its really not a good idea to WakeTheZombies just to say thanks!
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic