JavaBeans FAQ: Help with Common Problems


Why do I get a NullPointerException when loading a JAR file into the BeanBox?

Usually this is because of a mistake in the JAR file being loaded. In the meantime, typical errors include:

  • The MANIFEST file uses classes using the wrong file separator (" /" should be used in all platforms).
  • The MANIFEST file refers to classes in a package but the actual .class files are not really in that package.

Why do I get a duplicate name error when loading a JAR file?

The most common reason for a " java.lang.ClassFormatError: Duplicate name" error is that a .class file in the JAR contains a class whose class name is different from the expected name. So for example if you have a file called " a/B.class" and it contains a class called " B" or " a.X" instead of the class " a.B" then you will get this error.

The most common causes for this problem are either forgetting to include a " package a;" statement or having a " package" statement with the wrong name.

Why does my Beans.instantiate() fail?

Beans.instantiate() does two things: it loads a class and creates a Class object, and it then instantiates an object of that class. If the Bean name corresponds to a serialized Bean prototype, it uses that prototype. Otherwise the instantiation uses a zero-argument constructor. Several things may fail in these actions, including:

  • There may not be a class of the given name
  • The class may not be public
  • The class may be in a package that cannot be created given the existing Security Manager (for example, the Applet Security Manager typically will not let the applet instantiate " java.*" and " sun.*" classes)
  • There may not be any public zero-argument constructor for the class.
  • The serialized stream may contain a version of the class that is not compatible with the one loaded (or available through the classloader argument) in the JVM.

A typical idiom to use Beans.instantiate is Beans.instantiate(this.getClass().getClassLoader(), theBeanName)

Why nobody at Sun wants to read the messages sent to

Probably, because of the fact, that 99% of all messages is spam. It is recommended to post on JavaBeans forum, which is inspected by Sun engineers on a regular basis.

How can I subscribe/unsubscribe to the BEANS-INFO mailing list?

A discussion list, BEANS-INFO, has been set up for people interested in the JavaBeans API. It is a forum where users help users, but you'll see participation from Sun engineers, too. This is the primary forum for discussions pertaining to JavaBeans.

  • Subscribing to BEANS-INFO
  • To subscribe to the BEANS-INFO list, send email with


    in the message body to:
  • Sending Messages to BEANS-INFO
  • To send messages to the discussion list, send email to:

    Please help in keeping the list's atmosphere polite and reasonable. The people who answer your questions do it mostly in their free time and without obligations to do so. If you seek help, please follow these guide lines:

    1. First search the archive to find out if this problem has been discussed before.
    2. Including the following infos in your email will make it more likely to get a quick response:
      • short and precise problem description (i.e. expected vs. actual behavior)
      • output of the program and full exception trace
      • Java Version
      • the source code of a small program which reproduces the problem. Keep it as small as possible, but it should still be compilable.
    3. Please do not send large attachments (>50KB) to the list. Instead, make the file available via HTTP and FTP and send the link to the list.
  • Unsubscribing from BEANS-INFO
  • To unsubscribe from the BEANS-INFO list, send email with


    in the message body to: