Jimmy's Blog

NetBeans 6 Bug – ConfigurationException Class in Apache Common Configuration is not Throwable?

by jimmy on Dec.12, 2007, under English, Java, Programming

When I using Netbeans 6 (final released) and using Apache Common Configuration library, I encounter this bug.
Here’s how I found the bug :

  • Create a java application project
  • Add the library, I create a library name ‘Apache_Common_Configuration’ and add commons-configuration-1.5.jar to that library
  • Then I wrote the code

public static void main(String[] args) {
try {
INIConfiguration ini = new INIConfiguration("sample.ini");
} catch (ConfigurationException ex) {
ex.printStackTrace();
}
}

  • But the editor showing error on ‘ConfigurationException ex’ saying that ConfigurationException is not subclass of Throwable Class (I’ve upload the screenshot)

NetBeans 6 Bug - ConfigurationException Class

  • When I try to build it’s showing different error “class file for org.apache.commons.lang.exception.NestableException not found”
  • It’s look like Apache Common Configuration is using Apache Common Lang library (I also look to the source-code ‘ConfigurationException extends NestableException’). Error when compile showing me more help than error in editor.
  • So I create a library name ‘Apache_Common_Lang’ and add commons-lang-2.3.jar to that library
  • After add the library the editor still showing the same error : “ConfigurationException is not subclass of Throwable Class”
  • But when I run build, it run successful . No error at all. (Now I confused)
  • It’s look like there’s a bug in the Editor. And that red line & error icon in project window really bugging me, although I know it’s the editor bug not my code error.
  • So to make this ‘red-line’ disappeared, I combined commons-configuration-1.5.jar & commons-lang-2.3.jar into 1 jar file. And set a library to this jar (instead using 2 library or 2 jar file).
  • After this combined the editor not showing the error again.

Anyone having this problem too?

You can vote for this bug on : http://www.netbeans.org/issues/show_bug.cgi?id=124241

Related posts:

  1. Netbeans 6 – Configure which editor (representative class) for new type extension
  2. Change junit & run file (main class) working directory at Netbeans 5.5 Web Project
  3. Simple Log4J implementation
  4. Java – Adding new Classpath at Runtime
  5. Using svn+ssh with Netbeans 5.5 + Windows

:, , , , ,

7 Comments for this entry

  • Jiri Prox

    I can reproduce it as well, the suitable workaround should be either add both jars as single jars (not as libraries) or to create one library containing both jars

  • jimlife

    Create 1 library consisting commons-configuration-x.jar & commons-lang-x.jar and add it to the project won’t make the editor stop showing the error.
    Maybe the editor cannot recognize a Throwable class whose parent-class in different jar?

  • jimlife

    After several tries I found out that if commons-configuration-x.jar & commons-lang-x.jar are in 1 directory the editor won’t showing error.
    It doesn’t matter whether they are on 1 or 2 libraries.
    So the editor bug only happens if the jars on different directory.

  • Avi

    I am having the same problem. Did you file a bug report? If you did please let me know the bug number so I can vote for it.

  • Rajath

    Hi,

    I tried keeping both commons-configuration and commons-lang in same directory, but still no success.
    The only change is i am working on Eclipse (Hope IDE wont matter for this problem).

    Any other solution rather than creating new jar containing both?

    Thanks in advance.

  • jimmy

    @Rajath: this bug should be only on Netbeans 6. And it already resolved.
    Maybe your issue is different.

Leave a Reply

Spam Protection by WP-SpamFree

Looking for something?

Use the form below to search the site:

Still not finding what you're looking for? Drop a comment on a post or contact us so we can take care of it!

Visit our friends!

A few highly recommended friends...