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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T23:29:27+00:00 2026-05-13T23:29:27+00:00

public static Reservation[] openBinaryFile( String fileName ) { Reservation [] objArray = null; try

  • 0
public static Reservation[] openBinaryFile( String fileName )
{
    Reservation [] objArray = null;

    try
    { 
        ObjectInputStream inStream = new ObjectInputStream(
            new FileInputStream( fileName ) );

        objArray = (Reservation[])inStream.readObject();

        inStream.close();
    }
    catch( ClassNotFoundException e )
    {
        System.out.println( "Exception: ClassNotFoundException." );
    }

I have the class included, but why do I get an exception? The class is in the same package as the others. Why am I getting this exception?

EDIT: Here is the stack trace
run:
java.lang.ClassNotFoundException: Reservation
at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
at java.lang.ClassLoader.loadClass(ClassLoader.java:252)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:247)
at java.io.ObjectInputStream.resolveClass(ObjectInputStream.java:604)
at java.io.ObjectInputStream.readNonProxyDesc(ObjectInputStream.java:1575)
at java.io.ObjectInputStream.readClassDesc(ObjectInputStream.java:1496)
at java.io.ObjectInputStream.readArray(ObjectInputStream.java:1624)
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1323)
at java.io.ObjectInputStream.readObject(ObjectInputStream.java:351)
at myViewer.DatabaseFile.openBinaryFile(DatabaseFile.java:42)
at myViewer.Viewer.(Viewer.java:175)
at myViewer.Viewer.main(Viewer.java:188)

  • 1 1 Answer
  • 1 View
  • 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-13T23:29:27+00:00Added an answer on May 13, 2026 at 11:29 pm

    Two things:

    • Make sure that you’re actually reading Reservation[]
      • If you’re reading a subtype of Reservation (e.g. VIPReservation) then you need the binary for that type
    • Make sure it’s the same exact version of Reservation

    Immediate actionable:

    • Diagnose the stack trace.

    Looking at the stack trace, it expects Reservation to be located in the default package. Make sure that this is the case.

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

Sidebar

Related Questions

public static void executeCommand(String cmd) { try { Process process = Runtime.getRuntime().exec(cmd, null, new
public static void main(String Data[]) { ConnectionPoolDataSource dps; try { cnt=new InitialContext(); cnt.rebind(java:comp/env/jdbc/pool/dragon, dps);
public static void main(String[] args) { staples[] stemp = new staples[8]; int j; try
public static List<Product> Load(string filename) { if (!File.Exists(filename)) { throw new FileNotFoundException(Data could not
public static void getMembers(WebDriver driver, String outname){ FileWriter outFile = null; try { outFile
public static void main(String[] args) { int [][]shatner = new int[1][1]; int []rat =
public static string GetUa(HttpRequest hr) { try { string visitorBrowser = hr.UserAgent.ToString(); string originalBrowser
public static void main(String [] a) { String s = new String(Hai); String s1=s;
public static final String readURL(String url)throws Throwable { try { InputStream in = (InputStream)
public static Node createNodeFromXMLString(String xml) throws SAXException, IOException { return builder.parse(new ByteArrayInputStream(xml.getBytes())) .getDocumentElement(); }

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.