Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8046225
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T05:44:06+00:00 2026-06-05T05:44:06+00:00

So this is my question. I have a client and a server java program.

  • 0

So this is my question.

I have a client and a server java program.
Each one establishes and manages a ObjectInputStream/ObjectOutputStream with the other.

I want to be able to send objects (Given all objects sent will extend a Packet class I made).
The issue is that even though the client and server may have the exact same code for the packet class, I am getting a error:

java.lang.ClassNotFoundException: shared.Packet0Connect
    at java.net.URLClassLoader$1.run(Unknown Source)
    at java.net.URLClassLoader$1.run(Unknown Source)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at java.lang.Class.forName0(Native Method)
    at java.lang.Class.forName(Unknown Source)
    at java.io.ObjectInputStream.resolveClass(Unknown Source)
    at java.io.ObjectInputStream.readNonProxyDesc(Unknown Source)
    at java.io.ObjectInputStream.readClassDesc(Unknown Source)
    at java.io.ObjectInputStream.readOrdinaryObject(Unknown Source)
    at java.io.ObjectInputStream.readObject0(Unknown Source)
    at java.io.ObjectInputStream.readObject(Unknown Source)
    at com.mooman219.gmail.server.ReceivePacketThread.run(ReceivePacketThread.java:19)

It appears that java thinks that the Packet class on the server is a different class on the client.

Is there a way I can fix this (Aside from having the same package names on both the client and server)?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T05:44:07+00:00Added an answer on June 5, 2026 at 5:44 am

    The data transport object classes must be the same class — they must have the same fully qualified class name (i.e. the same package name and the same classname), not just identical contents.

    The byte stream emitted by the serialisation process includes the fully qualified class name of the object (as well as the FQCN of the superclasses). It then also includes the serialised versions of the non-transient, non-static fields (unless you’ve customised the serialisation process using one of the hook methods).

    Here’s an example of the byte stream. Note that in the example, the class is in the default (empty) package which makes the illustration of what we’re discussing a bit less clear.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Exposition: I'm familiar with C/C++/Scheme & OpenGL. I have this client/server program written in
I have this code to create a configuration of a java client to connect
I have written a simple server - client program with Swing interface using singleton
I have a trivial secure socket server-client program. For the server certificates, I created
I have a client-server java application, where communication happens over SSL. Right now I
I have a client-server application written in Java using CORBA for the communication. The
I have a Java server application and a Flex client application. For my data
I have a question about the encryption of transmitted data. I have a client-server
If you have a Java client Socket connected to a Java server's ServerSocket, how
I have a client/server MMORPG I am working on and I want to do

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.