logging-log4j-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Paul Glezen" <pgle...@us.ibm.com>
Subject Re: Question about the properties file. Please Help.
Date Wed, 14 Nov 2001 22:35:11 GMT
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


qding@csc.com on 11/14/2001 02:14:36 PM

Please respond to "Log4J Developers List" <log4j-dev@jakarta.apache.org>

To:   Log4J Developers List <log4j-dev@jakarta.apache.org>
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:log4j-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:log4j-dev-help@jakarta.apache.org>




--
To unsubscribe, e-mail:   <mailto:log4j-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:log4j-dev-help@jakarta.apache.org>


Mime
View raw message