logging-log4j-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From DeMZed <dem...@gmail.com>
Subject Serialization issue (LOG4j attribute in a serialized Thread)
Date Thu, 08 Dec 2005 07:56:07 GMT

I've made a class ClientServer which extends Thread implements Remote,
Serializable to bind it with RMI.
Inside, i've got this attribute :

*private* *transient* *static* Logger LOG =

I've made another similar class ClientPartenaire which extends
UnicastRemoteObject implements Remote (not a thread)
Inside, i've got this attribute :

*private* *transient* *static* Logger LOG =

Then, I've generated stubs for both classes.

Thus, I try to serialize it while using RMI server.
When I do

Naming.rebind("server", *new* ClientPartenaire ())

everything works well

but when I do

Naming.rebind("server", *new* ClientServer("demeter"));

I get this stacktrace :

java.rmi.ServerError: Error occurred in server thread; nested exception is:
	java.lang.NoClassDefFoundError: Lorg/apache/log4j/Logger;
	at sun.rmi.server.UnicastServerRef.oldDispatch(UnicastServerRef.java:382)
	at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:240)
	at sun.rmi.transport.Transport$1.run(Transport.java:153)
	at java.security.AccessController.doPrivileged(Native Method)
	at sun.rmi.transport.Transport.serviceCall(Transport.java:149)
	at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:460)
	at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:701)
	at java.lang.Thread.run(Thread.java:595)
	at sun.rmi.transport.StreamRemoteCall.exceptionReceivedFromServer(Unknown
	at sun.rmi.transport.StreamRemoteCall.executeCall(Unknown Source)
	at sun.rmi.server.UnicastRef.invoke(Unknown Source)
	at sun.rmi.registry.RegistryImpl_Stub.bind(Unknown Source)
	at java.rmi.Naming.bind(Unknown Source)
	at i2.application.demeter.client.RunClient.main(RunClient.java:61)
Caused by: java.lang.NoClassDefFoundError: Lorg/apache/log4j/Logger;
	at java.lang.Class.getDeclaredFields0(Native Method)
	at java.lang.Class.privateGetDeclaredFields(Class.java:2232)
	at java.lang.Class.getDeclaredField(Class.java:1852)
	at java.io.ObjectStreamClass.getDeclaredSUID(ObjectStreamClass.java:1555)
	at java.io.ObjectStreamClass.access$600(ObjectStreamClass.java:47)
	at java.io.ObjectStreamClass$2.run(ObjectStreamClass.java:381)
	at java.security.AccessController.doPrivileged(Native Method)
	at java.io.ObjectStreamClass.<init>(ObjectStreamClass.java:373)
	at java.io.ObjectStreamClass.lookup(ObjectStreamClass.java:268)
	at java.io.ObjectStreamClass.initNonProxy(ObjectStreamClass.java:504)

If I comment all lines using attribute LOG and delete attribute LOG, keeping
the import for Logger class, I get this error again. Then, if I delete the
import, the error disapears !
Furthermore, if I use java.util.Logging, I do not have this error again.

Any idea why do I get this error ?

Thanks a lot for your help :)

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message