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 4034332
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T11:57:32+00:00 2026-05-20T11:57:32+00:00

I’ve the following scenario: I’ve a byte[] that contains the .class data of a

  • 0

I’ve the following scenario:

I’ve a byte[] that contains the .class data of a class (loaded from the file system)

And I have another byte[] of this some object of this class that was previously Serialized to some other stream.

First do load the byte[] of the .class file with my custom class loader which is:

public class MainSearchClassLoader extends ClassLoader
{

    public MainSearchClassLoader()
    {
        super(MainSearchClassLoader.class.getClassLoader());
    }

    public Class<?> findClass(String name) throws ClassNotFoundException
    {
        try
        {
            byte[] bytecode = FileUtil.readClassByteCode();
            return super.defineClass(ReflectionUtil.getStubBinaryClassName() , bytecode, 0, bytecode.length);
        } catch (IOException e)
        {
            e.printStackTrace();
        }
        return null;
    }
}

Then I am trying to de-serialize this instance using the following code:

public static Object getObjectFromBytes(final byte[] bytes)
    {
        Object object = null;
        try
        {
            object = new ObjectInputStream(new ByteArrayInputStream(bytes)).readObject();
        } catch (final Exception ioe)
        {
            ioe.printStackTrace();
        }
        return object;
    }

That takes the serialized bytes and supposed to return instance (of the pre-loaded class using my custom class loader) .. I got the following exception:

11/03/06 14:23:27 oracle.classloader.util.AnnotatedClassNotFoundException: 

      Missing class: mainSearchObjects.dc_index

    Dependent class: java.io.ObjectInputStream
             Loader: jre.bootstrap:1.5.0_06
        Code-Source: unknown
      Configuration: jre bootstrap

This load was initiated at MainSearch.web.MainSearch:0.0.0 using the Class.forName() method.

The missing class is not available from any code-source or loader in the system.
11/03/06 14:23:27   at oracle.classloader.PolicyClassLoader.handleClassNotFound (PolicyClassLoader.java:2068) [/D:/jdevstudio10134/j2ee/home/lib/pcl.jar (from system property java.class.path), by sun.misc.Launcher$AppClassLoader@14916158]
    at oracle.classloader.PolicyClassLoader.internalLoadClass (PolicyClassLoader.java:1679) [/D:/jdevstudio10134/j2ee/home/lib/pcl.jar (from system property java.class.path), by sun.misc.Launcher$AppClassLoader@14916158]
    at oracle.classloader.PolicyClassLoader.loadClass (PolicyClassLoader.java:1635) [/D:/jdevstudio10134/j2ee/home/lib/pcl.jar (from system property java.class.path), by sun.misc.Launcher$AppClassLoader@14916158]
    at oracle.classloader.PolicyClassLoader.loadClass (PolicyClassLoader.java:1620) [/D:/jdevstudio10134/j2ee/home/lib/pcl.jar (from system property java.class.path), by sun.misc.Launcher$AppClassLoader@14916158]
    at java.lang.ClassLoader.loadClassInternal (ClassLoader.java:319) [jre bootstrap, by jre.bootstrap:1.5.0_06]
    at java.lang.Class.forName0 (Native method) [unknown, by unknown]
    at java.lang.Class.forName (Class.java:242) [jre bootstrap, by jre.bootstrap:1.5.0_06]
    at java.io.ObjectInputStream.resolveClass (ObjectInputStream.java:574) [jre bootstrap, by jre.bootstrap:1.5.0_06]
    at java.io.ObjectInputStream.readNonProxyDesc (ObjectInputStream.java:1538) [jre bootstrap, by jre.bootstrap:1.5.0_06]
    at java.io.ObjectInputStream.readClassDesc (ObjectInputStream.java:1460) [jre bootstrap, by jre.bootstrap:1.5.0_06]
    at java.io.ObjectInputStream.readOrdinaryObject (ObjectInputStream.java:1693) [jre bootstrap, by jre.bootstrap:1.5.0_06]
    at java.io.ObjectInputStream.readObject0 (ObjectInputStream.java:1299) [jre bootstrap, by jre.bootstrap:1.5.0_06]
    at java.io.ObjectInputStream.readObject (ObjectInputStream.java:339) [jre bootstrap, by jre.bootstrap:1.5.0_06]
...........

I understood that.. The bootstrap class loader that is used by the de-serization code cannot see the class loaded by one of its children (my class loader) and I think this is a correct behaiour, isn’t it?

So, Isn’t a solution to this problem??

  • 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-05-20T11:57:32+00:00Added an answer on May 20, 2026 at 11:57 am

    https://bugs.java.com/bugdatabase/view_bug?bug_id=4340158

    You need your own ObjectInputStream.

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

Sidebar

Related Questions

I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I have a .ini file as follows: [playlist] numberofentries=2 File1=http://87.230.82.17:80 Title1=(#1 - 365/1400) Example
I have just tried to save a simple *.rtf file with some websites and
For some reason, after submitting a string like this Jack’s Spindle from a text
I have a small JavaScript validation script that validates inputs based on Regex. I
this is what i have right now Drawing an RSS feed into the php,
I have a French site that I want to parse, but am running into
I have this code to decode numeric html entities to the UTF8 equivalent character.
I am doing a simple coin flipping experiment for class that involves flipping a

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.