473,946 Members | 30,467 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

ClassNotFoundEx ception reading object from ObjectInputStre am

I have what I hope is a simple question:

I'm learning how to serialize objects. I create an ObjectOutputStr eam and
writeObject an object to it. I then create an ObjectInputStre am and try to
readObject the object from it. readObject is failing with a
ClassNotFoundEx ception. 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
ObjectOutputStr eam.

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 3540
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
3045
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 successfully, the client sends its first request and the server responds accordingly, the client receives the response and tries to send another request (the request Vector is created successfully) but something is wrong... The following line (located in a...
1
25473
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 I run the client using the -D parameters to specify the JNDI properties, it works fine. Example command line:
2
1941
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 FileInputStream(f)); this = (MyClass)s.readObject();
2
10469
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 that I can't do the opposite. I want the program to send an object-reply from the server to the client. But on this step boths sides throw a socket exception. From println's I have figured out that it can't set up on either side the...
1
4702
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 ClassLoader. For example: Class c1 = getClass().getClassLoader().loadClass( "com.acme.FooBar" ); Class c2 = CustomClassLoader.loadClass( "com.acme.FooBar" ); FooBar newC2 = (FooBar)c2; // This throws ClassCastException! You can not cast c2...
2
20621
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: com.informix.jdbc.IfxDriver" I suspect the problem is in my CLASSPATH system variable, but I don't know
0
2023
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 version of Windows. Any help you could offer would be GREATLY appreciated. I'm running on Windows XP Pro with 5.0 of the JDK. I've done my best to turn off any firewall, ani-virus, and Internet worm (Norton) checking. I've tried to reduce it a...
2
3503
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 am having a serious problem with the latest connector. During login, it seems to me that when validating the password, which is stored as a byte array in the database, the MySql connector is passing back the password info as a Byte. The...
1
2811
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 delegate: false repositories:
0
10162
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9981
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
11566
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
11153
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
10687
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9886
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
7424
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
6112
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
3
3541
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.