libgcj failure: Duplicate class registration
Hannes Wallnoefer
hannes@helma.at
Thu Mar 18 17:20:00 GMT 2004
Tom Tromey wrote:
>>>>>>">" == hannes wallnoefer <hannes@helma.at> writes:
>>>>>>>>>>>>>>>I'm getting the following error message when adding a java class to a
>>>dynamically linked Apache module:
>>>libgcj failure: Duplicate class registration: GcjTest
>>>>>>>>With the current gcj, a given compiled class can only be loaded once
>by the system class loader. If you try to link in a class more than
>once, you get this failure.
>>This choice was the result of a lot of discussion a few years ago, see
>the list archives for the details. (I don't have a ready pointer to
>the thread, sorry.)
>>>>>>#19 0x401576ed in apr_dso_load () from /usr/lib/libapr-0.so.0
>>>#20 0x08066c5d in load_module ()
>>>>>>>>>Any idea what might be wrong?
>>>>>>>>Offhand it is hard to say. I've run into this problem by accidentally
>pulling in a second (different) copy of libgcj.so. I worked around
>it by setting the system property
>gnu.gcj.runtime.VMClassLoader.library_control to `never'.
>This disables the automatic loading of .so files.
>>>
I found that the problem is Apache is calling dlopen() twice for each
shared module. This is done on purpose to let modules set up their logs
files or whatever. So I guess the only solution is to put the Java
classes in a separate library and load that manually from my module.
Unless there is a way to "forget" about the classes loaded in the first
dlopen() pass, but I somehow doubt this.
Hannes
More information about the Java
mailing list