Qin,

Sometimes serialization problems can occur if the classloader doing the
serializing has a different version of the class than the one doing the
deserializing.  I don't know if this is the situation you have or not.  If
two log4j.jar files are involved and they are not the same version, it is
possible for this to happen.

Paul Glezen
Consulting IT Specialist
IBM Software Services for WebSphere
818 539 3321


[EMAIL PROTECTED] on 11/14/2001 02:14:36 PM

Please respond to "Log4J Developers List" <[EMAIL PROTECTED]>

To:   Log4J Developers List <[EMAIL PROTECTED]>
cc:
Subject:  Re: Question about the properties file. Please Help.



Hi, Ceki:

I wrap the  log4j  into an EJB and config it  to use JMSAppender to publish
logging message to the JMS server on Weblogic 6.1.  And I wrote a
MessageDrivenBean (MDB) to consume the message by writing the msg to our
database.

When the JMS server receives Message with ObjectMessage in it, it delivers
the Message to my MDB by calling the MDB's onMessage method. When I tried
to retrieve the the LoggingEvent from the ObjectMessage, I receive an error
message stating "Error: deserializing object".

This is what I try to do:

try {
  ObjectMessage om = (ObjectMessage)message;       ------------ successful
  LoggingEvent msg = (LoggingEvent) om.getObject();  ------------ failed
  String strTokens = (String) msg.getMessage();              -------------
never get in here
}
catch(JMSException jmse)
{
  jmse.printStackTrace();
}

I checked the MDB spec, that ObjectMessage's getObject() returns
java.io.Serializable. LogggingEvent is Serializable class.  I don't know
why it can't be casted to LoggingEvent.

I wonder is it because LoggingEvent constructor carries a param message
which is the type of Object.  Object itself is not Serializable. Also, an
instance variable of LoggingEvent is transient Object message. So, this
message cannot be serialized due to the key word trancient.  getMessage()
method returns Object message instead of Serializable.  Do you think these
may cause the deserialization problem I have experienced?  If yes, how can
I work around this?  If I change Object to Serializable, then I have to
change not only LoggingEvent class but Category class as well?  Please
advise. Thank you very much.

Qin


--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>




--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to