Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Strange error with java.lang.reflect.Method.invoke() and JDK 1.4

9 views
Skip to first unread message

Laurent Martelli

unread,
Feb 20, 2002, 6:29:20 PM2/20/02
to
Hi everybody,

I'm facing a strange error in a dynamic method invocation with Sun's
JDK 1.4. The exception is :

Exception in thread "main" java.lang.IllegalAccessError: class sun.reflect.GeneratedMethodAccessor1 cannot access its superclass sun.reflect.MethodAccessorImpl

The same code works with the JDK 1.3.

Here's the stack trace :

at sun.misc.Unsafe.defineClass(Native Method)
at sun.reflect.ClassDefiner.defineClass(ClassDefiner.java:45)
at sun.reflect.MethodAccessorGenerator$1.run(MethodAccessorGenerator.java:381)
at java.security.AccessController.doPrivileged(Native Method)
at sun.reflect.MethodAccessorGenerator.generate(MethodAccessorGenerator.java:377)
at sun.reflect.MethodAccessorGenerator.generateMethod(MethodAccessorGenerator.java:59)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:28)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at jac.core.JacObject.myNextWrapper(JacObject.java:1306)
at jac.util.Repository._added_m$8(Repository.java)
at jac.util.Repository.register(Repository.java)
at jac.util.OrderedRepository.register(OrderedRepository.java:90)
at jac.core.ACManager.register(ACManager.java:803)
at jac.core.ACManager.registerDeclaredAC(ACManager.java:138)
at jac.core.ACManager.main(ACManager.java:200)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at javassist.Loader.run(Loader.java:263)
at jac.core.Jac.main(Jac.java:240)


Basically, the inheritance tree looks like this :

JacObject <- Repository <- OrderedRepository <- ACManager

The method that is invoked by myNextWrapper happens to be
jac.util.Repository._org_register

Any idea about what's going on ?

--
Laurent Martelli
lau...@bearteam.org http://www.bearteam.org/~laurent/

Roedy Green

unread,
Feb 20, 2002, 7:05:45 PM2/20/02
to
On Thu, 21 Feb 2002 00:29:20 +0100, Laurent Martelli
<lau...@bearteam.org> wrote or quoted :

>java.lang.IllegalAccessError:

see "http://mindprod.com/errormessages.html


The java glossary is at
http://www.mindprod.com/gloss.html
or http://209.139.205.39

--
eagerly seeking telecommuting programming work.
canadian mind products, roedy green

Laurent Martelli

unread,
Feb 21, 2002, 10:41:07 AM2/21/02
to
>>>>> "Roedy" == Roedy Green <ro...@mindprod.com> writes:

Roedy> On Thu, 21 Feb 2002 00:29:20 +0100, Laurent Martelli
Roedy> <lau...@bearteam.org> wrote or quoted :

>> java.lang.IllegalAccessError:

Roedy> see "http://mindprod.com/errormessages.html

Thanks for the pointer, but it does not help me very much. The
strangest fact is that this invocation works once, but the second
times it fails (same object, same method).

Jon Skeet

unread,
Feb 21, 2002, 12:00:45 PM2/21/02
to
Laurent Martelli <lau...@bearteam.org> wrote:
> I'm facing a strange error in a dynamic method invocation with Sun's
> JDK 1.4. The exception is :

<snip>

Can you come up with a short but complete example program which
demonstrates the problem?

--
Jon Skeet - <sk...@pobox.com>
http://www.pobox.com/~skeet/
If replying to the group, please do not mail me too

Laurent Martelli

unread,
Feb 21, 2002, 5:49:55 PM2/21/02
to
>>>>> "Jon" == Jon Skeet <sk...@pobox.com> writes:

Jon> Laurent Martelli <lau...@bearteam.org> wrote:
>> I'm facing a strange error in a dynamic method invocation with
>> Sun's JDK 1.4. The exception is :

Jon> <snip>

Jon> Can you come up with a short but complete example program which
Jon> demonstrates the problem?

I'm afraid this is not going to be easy. It's not that I do not want
to show our code (it's available under the LGPL :
http://jac.aopsys.com/download/), but we are modifying the bytecode of
some classes at load time, so cutting things down will not be easy.

Maybe I could send the .class ?

Jon Skeet

unread,
Feb 21, 2002, 6:17:14 PM2/21/02
to
Laurent Martelli <lau...@bearteam.org> wrote:
> >>>>> "Jon" == Jon Skeet <sk...@pobox.com> writes:
>
> Jon> Laurent Martelli <lau...@bearteam.org> wrote:
> >> I'm facing a strange error in a dynamic method invocation with
> >> Sun's JDK 1.4. The exception is :
>
> Jon> <snip>
>
> Jon> Can you come up with a short but complete example program which
> Jon> demonstrates the problem?
>
> I'm afraid this is not going to be easy. It's not that I do not want
> to show our code (it's available under the LGPL :
> http://jac.aopsys.com/download/), but we are modifying the bytecode of
> some classes at load time, so cutting things down will not be easy.
>
> Maybe I could send the .class ?

Sure - although I have to say, that makes it sound like it could be
something to do with the problem :)

Mail me the class and I'll see what I can find out.

Roedy Green

unread,
Feb 21, 2002, 11:03:00 PM2/21/02
to
On Thu, 21 Feb 2002 16:41:07 +0100, Laurent Martelli
<lau...@bearteam.org> wrote or quoted :

> >> java.lang.IllegalAccessError:
>
> Roedy> see "http://mindprod.com/errormessages.html
>
>Thanks for the pointer, but it does not help me very much. The
>strangest fact is that this invocation works once, but the second
>times it fails (same object, same method).

That is bizarre. If you do figure it out, please let me know so I can
add the cause to the errormessage.html file.

0 new messages