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]>

Reply via email to