Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / May 2006

Tip: Looking for answers? Try searching our database.

java.lang.VirtualMachineError: Illegal CONSTANT_Class reference

Thread view: 
Alex Hunsley - 25 May 2006 16:14 GMT
Going slightly nutso here...
I'm working on a MIDP Java project. It compiles fine, but at runtime I
get the following:

java.lang.VirtualMachineError: Illegal CONSTANT_Class reference

This happens when I assign a newly instantiated object to a private
class member. I've googled for this error, and found a few scant
references to it, but couldn't glean much about it.

If I use Antenna with ant to build the project it doesn't seem to have
this problem (not entirely surprisingly).
Does this ring any bells with anyone?

The nitty gritty details:
Using EclipseME plugin in Eclipse 3.1.2 with the Sun Wireless Toolkit 2.2.
(Project settings: compiler compliance level 1.4, .class file
compatabillity set to 1.1, source compatability is 1.3.)

cheers,
lex
Oliver Wong - 25 May 2006 16:37 GMT
> Going slightly nutso here...
> I'm working on a MIDP Java project. It compiles fine, but at runtime I get
[quoted text clipped - 14 lines]
> (Project settings: compiler compliance level 1.4, .class file
> compatabillity set to 1.1, source compatability is 1.3.)

   The Javadocs say: "VirtualMachineError: Thrown to indicate that the Java
Virtual Machine is broken or has run out of resources necessary for it to
continue operating."

   Could it be that you've found a bug in the JVM you're using?

   - Oliver
Alex Hunsley - 25 May 2006 17:23 GMT
>> Going slightly nutso here...
>> I'm working on a MIDP Java project. It compiles fine, but at runtime I
[quoted text clipped - 21 lines]
>
>    Could it be that you've found a bug in the JVM you're using?

Maybe! It's definitely very odd seeming.
I've just reduced the error down to the follow behaviour:
I've declared a class:

   class RandomClass {
    public RandomClass(int a) {
   
    }
   }

Then, from just before the point of failure in my code, I've added a
call to this class:

 RandomClass rc = new RandomClass(1);
 aMethodCallThatIsUsuallyThePointOfFailure(.. stuff ..);

The code above executes the instantiation of rc ok and dies at the
second line.
If, however, I add another parameter to RandomClass constructor and pass
that in:

 RandomClass rc = new RandomClass(1, 2);
 aMethodCallThatIsUsuallyThePointOfFailure(.. stuff ..);

.. it now dies horribly on the "new RandomClass(1, 2)" line. Seems the
stack is getting corrupted or overflowed and the point at which the
program dies is merely a symptom of the real resource/corruption problem!
Thing is, this was all working fine until I did a tiny bit of harmless
seeming refactoring (I moved a class). Hmmm...

thanks for your reply!
lex

>    - Oliver


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.