First, you only need to post once, and certainly not under two different
threads. Be patient.
It seems to me that you don't have Log4j.jar on both the client and server. You
also should define your logger without "transient". static's aren't subject to
serialization in the first place. So, change you statement to be...
private static final Logger LOG = Logger.getLogger(ClientServer.class);
...and make sure that log4j.jar is in the classpath of both the client and the
server.
Jake
Quoting DeMZed <[EMAIL PROTECTED]>:
> Hi,
>
> 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 = Logger.getLogger(ClientServer.class);
>
>
> 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 =
> Logger.getLogger(ClientPartenaire.class);
>
>
> 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
> Source)
> 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 :)
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]