dcsimg
Reading serialized objects in UNIX
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Bulent_Ugurlu
Posted On:   Thursday, August 2, 2001 01:41 PM

I try to read serialized objects in UNIX from a java application in NT and use the following code. However, ClassNotFoundException (detail:object not visible from this context) is thrown when I use the readObject method. I keep all the serialized files in a folder in UNIX and I would like to read these files from client application. But I do not know how? I appreciate your help. Thanks, Bulent Ugurlu email: bugurlu@uhc.com // Declare the local variables java.net.URL url =null; java.net.URLConnection connection = null; ObjectInputStream inObject =null; java.io.DataInputStream inStream = null; java.io.InputStream in =null;    More>>


I try to read serialized objects in UNIX from a java application in NT and use the following code. However, ClassNotFoundException (detail:object not visible from this context) is thrown when I use the readObject method. I keep all the serialized files in a folder in UNIX and I would like to read these files from client application. But I do not know how?
I appreciate your help.



Thanks,
Bulent Ugurlu


email: bugurlu@uhc.com



			
// Declare the local variables
java.net.URL url =null;
java.net.URLConnection connection = null;
ObjectInputStream inObject =null;
java.io.DataInputStream inStream = null;
java.io.InputStream in =null;
Object obj = null;

try {
url = new java.net.URL("http://test.com/project/ser/Test.ser");
connection = url.openConnection();
connection .connect();

in = connection.getInputStream();
inObject = new ObjectInputStream(in);
//Error occurs at the readObject method. Class not found exception
//detail of the error is Object is not visible at this context
obj= (Object)inObject.readObject();



StreamCopier.copy(in,System.out);
in.close();

}
catch (java.net.MalformedURLException mfurle)
{ mfurle.printStackTrace(); }
catch(java.io.IOException io)
{ io.printStackTrace(); }
catch(ClassNotFoundException cnfe)
{ cnfe.printStackTrace(); }

   <<Less

Re: Reading serialized objects in UNIX

Posted By:   Christopher_Schultz  
Posted On:   Friday, August 3, 2001 12:41 PM

What type of object are you trying to read from that URL? Do you have the class definition for that class in your classpath? Remember, serialized objects don't contain class information, only the values for the various fields in an object.



-chris
About | Sitemap | Contact