java - AbstractMethodError on calling Exception.printStackTrace -


inside catch clause want print strack trace of exception:

try {     ... } catch (exception exc) {     exc.printstacktrace();     ... } 

but in cases don't stack trace , instead see this:

exception in thread "pool-1-thread-2" java.lang.abstractmethoderror: java.lang.exception.printstacktrace()v     ... 

usually, exception should occur if library has not same version @ runtime @ compile time, in case work class java library. printstacktrace implemented in throwable, method can't abstract in exception or derived class. further, abstractmethoderror isn't thrown, there other exceptions @ specific catch clause (program flow depends on data file , current time, other stuff happens arrayindexoutofboundsexceptions or illegalstateexceptions thrown in own code , expect instead of strange error).

so, question is: how possible particular abstractmethoderror occur?

ps: using eclipse helios on linux , use jdk 1.6.0_24 runtime environment launch application.

edit: there typo (printstracktrace), corrected it. written out of mind , hasn't problem. (or should be) standalone application, no web-application, no eclipse rcp application, plain old java application (more or less). problem occur on computer, - eclipse helios, fedora linux, jdk 1.6.0_21.

to surprise indeed possible call getclass().getname() (but no other method tried), exception of type java.lang.arrayindexoutofboundsexception. tried use openjdk 1.6.0 (because installed on system) , got different results. instead of throwing abstractmethoderror, printstacktrace printed empty line , getmessage() returned null (instead of throwing error). don't know exception thrown, because try-catch-block high in hierarchy catches exception stop part of application gracefully. might catch exception type on points idea comes from. won't explain strange behavior of exception itself.

edit 2: tracked problem down. turned out exception occurred me yesterday @ exact same line, exception behaves strange. call get(int) on list (more precisely: arraylist wrapped using collections.unmodifiablelist(list)) index -1 (that initial value, inside loop index should changed, not whatever reason). @ least know fix arrayindexoutofboundsexception, still have no clue why exception behaves strange.

edit 3: tried throwable.class.getmethod("printstacktrace").invoke(exc); instead of exc.printstacktrace(); , got java.lang.nosuchmethoderror: java.lang.throwable.printstacktrace()v instead of java.lang.abstractmethoderror. tried compile java files shell using javac , jar (only 1 library exception coming from, because tedious manually compile jars). result same. if throw indexarrayoutofboundsexception myself @ line, stack trace printed fine. maybe have hope problem rare , never occur anywhere else.

as understand have launched application inside eclipse helios. may reason because of modularity of eclipse osgi , dedicated classloader: classloader hierarchy used run application may lead invalid linkage. depends on exception class concerned , jar files have included in application classpath - 1 of own jar may conflict jar file used in eclipse itself. may provide additional details ?

i guess launch "java application" run configuration. have checked 1 of checkboxes "include system libraries" or "included inherited main" or other options ?

by way, application run standalone java virtual machine , should run in context.

if not case, run java application -verbose:class command-line option , inspect latest line in output before crash, may clue conflictual libraries (different @ runtime compared compile-time).


Comments

Popular posts from this blog

linux - Using a Cron Job to check if my mod_wsgi / apache server is running and restart -

actionscript 3 - TweenLite does not work with object -

jQuery Ajax Render Fragments OR Whole Page -