InvocationTargetException

Alexandre Oliva oliva at dcc.unicamp.br
Sat Oct 31 04:34:42 PST 1998


On Oct 20, 1998, Godmar Back <gback at cs.utah.edu> wrote:

>> [chris at phobos chris]$ kaffe examples.snmp.agent.Agent
>> java.lang.reflect.InvocationTargetException
>> at com/sun/jaw/reference/agent/cmf/Framework.initCmfInvoker(872)
>> at com/sun/jaw/reference/agent/cmf/Framework.newObject(2394)
>> at com/sun/jaw/reference/agent/cmf/Framework.newObject(466)
>> at com/sun/jaw/reference/agent/cmf/Framework.newObject(574)
>> at examples/snmp/agent/Agent.main(99)

> It means that an exception was thrown inside a Method.invoke().
> This exception is packaged inside a InvocationTargetExc.  If you had
> the source, (I assume you don't since it's a com.sun.  package,
> though I might be wrong), you could extract the exception and print
> its backtrace; then you'd know exactly where the actual failure
> occurred.

If you don't have the source but you still want to know what's going
on, you may use Guaraná (implemented as an extension of Kaffe) to
intercept the construction of InvocationTargetExceptions, and print
the contained exception.  The main class could be like this
(attached).  You'd compiled it with `guaranac DetailedException.java'
and run `guarana DetailedException'.  It prints:

Creating InvocationTargetException:
java.lang.RuntimeException: test
        at java/lang/Throwable.<init>(30)
        at java/lang/Exception.<init>(21)
        at java/lang/RuntimeException.<init>(21)
        at DetailedException.test(19)
        at DetailedException.main(14)
No detail messages supplied for the exception wrapper
java.lang.reflect.InvocationTargetException
        at DetailedException.main(14)

If you uncomment the lines of main as indicated in the sources, the
application `DetailedException' will start your application for you,
and you'll be informed of all InvocationTargetExceptions created.

Guaraná can be downloaded from http://www.dcc.unicamp.br/~oliva/guarana/

-- 
Alexandre Oliva
mailto:oliva at dcc.unicamp.br mailto:oliva at gnu.org mailto:aoliva at acm.org
http://www.dcc.unicamp.br/~oliva
Universidade Estadual de Campinas, SP, Brasil
-------------- next part --------------
A non-text attachment was scrubbed...
Name: DetailedException.java
Type: application/octet-stream
Size: 1955 bytes
Desc: not available
Url : http://kaffe.org/pipermail/kaffe/attachments/19981031/64b8d15c/attachment-0007.obj 


More information about the kaffe mailing list