473,383 Members | 1,795 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,383 software developers and data experts.

ClassNotFoundException reading object from ObjectInputStream

I have what I hope is a simple question:

I'm learning how to serialize objects. I create an ObjectOutputStream and
writeObject an object to it. I then create an ObjectInputStream and try to
readObject the object from it. readObject is failing with a
ClassNotFoundException. The class mentioned in the exception description is
in a JAR file listed in CLASSPATH. I know the class can be found because I
successfully create an object from the class and wrote it to the
ObjectOutputStream.

Can anyone suggest why readObject can not find my class?

Thanks a lot.

David Liebtag
IBM APL Products and Services
Jul 17 '05 #1
1 3491
More information:

My sequence of method calls works if I run it in a Java class. It does not
work if I call the sequence of methods through JNI.

I suspect that when a class is referenced in Java code, the JVM loads the
class and makes it available to the readObject deserialization process.
When I use the JNI FindClass API, the class is not made available to
readObject.

Can anyone confirm this is true and perhaps suggest a work-around?

Is it not possible to deserialize objects from JNI code?

David Liebtag
IBM APL Products and Services
Jul 17 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Offer | last post by:
Hi, I create a TCP connection between client & server and I need to send vectors via ObjectInputStreams back and forth (the client initiates the protocol). The connection is established...
1
by: Kent | last post by:
I'm running on Win2000 and JRE 1.4.1.... I've got a small client trying to do get an InitialContext() and talk to the local JBoss server running on same machine (different VM of course). When...
2
by: Murat Tasan | last post by:
i'd like to have a constructor that loads an object from disk and returns it... kinda like: class MyClass { MyClass(File f) { ObjectInputStream s = new ObjectInputStream(new...
2
by: Maria Gaitani | last post by:
Hi! I have made a client and a server which are supposed to communicate by sending java objects. They don't. I have managed to send an object from the client to the server. But continuing after...
1
by: John Davison | last post by:
I have an Object that was created in a custom class loader. Since a Class is defined as the class name plus the class loader, a Class from one ClassLoader is not equivalent to a Class from another...
2
by: Jorge Cecílio | last post by:
Hi all I'm having no "luck" trying my first-time connect to an I-SE server from a Java application, using JDBC. I'm always getting then error: "Error: java.lang.ClassNotFoundException:...
0
by: schwarcz | last post by:
I'm trying to resurrect some of my old RMI code and running into problems where the bind() throws a ClassNotFoundException for the remote interface. The old code ran on a older JDK and an older...
2
by: Dan | last post by:
Hello. I have recently tried upgrading the MySql connector for my servlet from 2.0.4 to 3.0.9. I have found a minor limitation in 2.0.4 and was hoping that 3.0.9 would fix it. However, now I...
1
by: nithiya sri | last post by:
i am new to struts.I try running struts application in Eclipse with the tomcat plug in .. it shows the following error:; please help me in this... SEVERE: Error loading WebappClassLoader ...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.