Jump to content

NoClassDefFoundError: JRClassLoader bug?

Recommended Posts

By: Andrew Matthews - namxat

NoClassDefFoundError: JRClassLoader bug?

2003-06-10 07:06

Hello. I am having extreme difficulty loading classes that are most definitely in the classpath. Consider the following code snippet, taken from a larger block

of code that creates a JasperDesign, compiles it, and then fills it:


int imgID = mypackage.ImageRegistry.add( image );

JRDesignExpression expression = new JRDesignExpression();

expression.setText("mypackage.ImageRegistry.get(" + imgID + ", true)");


Also consider that I am developing in a Windows 2000 environment, and am not using Tomcat, so I don't have any of those hangups to worry about (yet).


One can tell from looking at this code that I have created a ImageRegistry class in the package named 'mypackage'. One can also tell that I have defined a public static 'get' method that is capable of taking an int input and returning a java.awt.Image.


One should also be able to tell that the system classloader has no trouble finding mypackage.ImageRegistry, since the call to 'ImageRegistry.add(image)' succeeds.


Now it just so happens that the file 'ImageRegistry.class' is located in the 'mypackage' directory, which is itself located in our 'classes' directory. I have also explicitly set the classpath via the -classpath flag to include our 'c:projectsclasses' directory. We reference the classes in this classpath, as opposed to the archived copy, for development purposes. It is much less time consuming to point to a classes directory then it is to recreate a .jar archive every time we change one or two lines of code. But I digress.


When I make a call to




I find 'c:projectsclasses' in the string returned, as expected.


I should also make a note that I add the '-Djava.ext.dirs=.....' flag when I invoke the JVM, as opposed to explicitly adding every single .jar archive to the classpath ( there are about thirty, all with really long file paths ). This has always worked for me.


Nevertheless, when I try to fill this report, I invariably get the following output:


java.lang.NoClassDefFoundError: mypackage/ImageRegistry

at Chart.evaluate(Chart.java:106)

at ......

......and so on, and so forth; you get the idea.


Now I have read a lot of posts in this discussion forum regarding NoClassDefFoundError issues, and most of them boil down to the classloader ( whether we're talking about JRClassLoader or the system classloader ) failing to load classes that are very much present in the system classpath.


Now here is my question: given the sheer volume of confusion regarding NoClassDefFoundError issues, might it be appropriate to rethink the implementation of JRClassLoader?


And in the meantime, what do I have to do to ensure that the JasperReports API loads my classes?





By: Teodor Danciu - teodord

RE: NoClassDefFoundError: JRClassLoader bug?

2003-07-07 12:36




This has been solved in the new 0.5.0 version.


Thank you,








By: Edivaldo - emarques

RE: NoClassDefFoundError: JRClassLoader bug?

2003-07-15 11:29

I still continue with the error java.lang.NoClassDefFoundError, in spite of having installed the 0.5.0 that this available one for download.

I work with 3 different OC4J (Container Oracle):

---> Windows2000;

---> Unix (Digital Unix 5.1) and

---> Linux (SuSe 7.2).

This error only happening in Container that's Linux

(my production), in the others already were

working correctly, besides in the previous version 4.6.

I thank any for information.

Edivaldo Marques





By: Edivaldo - emarques

RE: NoClassDefFoundError --> Linux

2003-07-15 12:57

I include in the. jsp and in the class. java the instruction:

System.setProperty("java.awt.headless", "true");

and I made deploy with:

javaw.exe -Djava.awt.headless=true ...admin.jar ormi://myserver admin **** -deploy -file D:...reptst.ear -deploymentName reptst

According to answer to a question here in the forum, but it didn't also work.


* Excuse for my english, it is terrible.

Link to comment
Share on other sites

  • Replies 0
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Create New...