File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Testing and the fly likes ClassNotLoadedException in Eclipse debugger Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » Testing
Bookmark "ClassNotLoadedException in Eclipse debugger" Watch "ClassNotLoadedException in Eclipse debugger" New topic

ClassNotLoadedException in Eclipse debugger

Russell Bateman
Ranch Hand

Joined: Feb 26, 2008
Posts: 69
This only happens when I attempt to run my JUnit test in the debugger. It does not happen when I run my JUnit test without debugger nor does it happen in a production run of my greater product.

org.eclipse.debug.core.DebugException: com.sun.jdi.ClassNotLoadedException: Type has not been loaded occurred while retrieving component type of array.

As the first line of my test (not in setUp(), but in the first line of "real" code), I have:

GQUser is a class in another of the five smallish projects that make up my application. In the project of which my JUnit test is a part of, I get it via a JAR. Once I step past that statement, however, and I click on smacko in the (debugger) Variables pane to see its value, the value appears as (the exception) noted above.

This happens regardless of whether I put this code in my test method or in setUp().

I've Googled this and found 9 results--several people have seen this, some in exactly my same circumstances. Only 2 of them are interesting in that they have answers and neither shows any real explanation or an encouraging solution. One answer is by someone who completely gives up. The other one waffles. I've also asked around a bit here, but none of my acquaintances have ever seen it.

This mess absolutely destroys any chance I have of being able to step through my application as this class is used all over. While this situation is created to simplify what's happening (which it does very nicely), I have a class, ProgGlobals, that must instantiate several pieces of static final data of this class in order to function. I am unable to see a way to program around it.

Thanks for reading this and for any comments made.

Russ Bateman
Jeanne Boyarsky
author & internet detective

Joined: May 26, 2003
Posts: 33124

This questions sounds IDE related. I'm going to move it to our IDEs forum in case someone more expert in Eclipse knows.

[OCA 8 book] [Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Other Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, TOGAF part 1 and part 2
Ilja Preuss

Joined: Jul 11, 2001
Posts: 14112
Having read the JavaDoc for the exception, this sounds like an Eclipse bug to me. You might want to file it to the Eclipse bug database.

The soul is dyed the color of its thoughts. Think only on those things that are in line with your principles and can bear the light of day. The content of your character is your choice. Day by day, what you do is who you become. Your integrity is your destiny - it is the light that guides your way. - Heraclitus
Russell Bateman
Ranch Hand

Joined: Feb 26, 2008
Posts: 69
Thanks, I couldn't decide which forum of two and that was the other forum. When I submitted this, I was still thinking that it might be something I don't know about JARs. Later, after working some more with it, I decided I had made a mistake submitting to JavaRanch and then submitted it to an Eclipse forum.

To update this issue, I have discovered that the class is indeed loaded and functioning. It's just the Eclipse debugger that does not somehow have access to it. What's going on underneath, however, is fine and working as expected: I just can't look directly at it in the debugger. A print statement in the code, even when running the debugger, demonstrates that all is well. Go figure.

Ilja Preuss

Joined: Jul 11, 2001
Posts: 14112
Yes. The problem is that the Eclipse debugger is trying to fetch information for a class that the application hasn't loaded yet. Or so it seems.
Russell Bateman
Ranch Hand

Joined: Feb 26, 2008
Posts: 69
And, once it has determined that the class hasn't been loaded (maybe it has, maybe it hasn't), it persists in that observation thereafter. No instance of GQUser ever shows anything else.
Franz Mayer

Joined: Apr 14, 2009
Posts: 3

I have the same problem with eclipse J2EE Version: 3.4.0. Have you solved it with a newer eclipse version?

Gretchen Moran

Joined: Apr 27, 2009
Posts: 1
The problem still exists in 3.4.2.

Mahalakshmi YagnaSankar

Joined: Jun 28, 2005
Posts: 6
Is there any solution arrived at this? Am facing the same problem.
Tony Evans
Ranch Hand

Joined: Jun 29, 2002
Posts: 595
Carry out the following checks.

1)What is your JAVA_HOME version in your command prompt type echo %path%

2)In your eclipse IDE go to Windows Preferences, select java then complier that is where your JDK is, make sure its the same as your java home

3) At bottom of the preferences window if you are not using a compatiable jre it will prompt you, make sure its using the same version as your JDK in my case 1.6
I agree. Here's the link:
subject: ClassNotLoadedException in Eclipse debugger
jQuery in Action, 3rd edition