Bugs item #531524, was opened at 2002-03-18 12:28
You can respond by visiting: 
http://sourceforge.net/tracker/?func=detail&atid=376685&aid=531524&group_id=22866

Category: JBossMQ
Group: v3.0 Rabbit Hole
Status: Open
Resolution: None
>Priority: 8
Submitted By: Marius Kotsbak (mkotsbak)
Assigned to: Nobody/Anonymous (nobody)
Summary: Error in passivation of bean with JMS

Initial Comment:
I get this exception when using JMS as managed resource:

java.rmi.ServerException: Could not passivate; nested
exception is: 
        java.io.NotSerializableException:
org.jboss.resource.adapter.jms.JmsManagedConnectionFactory
java.io.NotSerializableException:
org.jboss.resource.adapter.jms.JmsManagedConnectionFactory
        at
java.io.ObjectOutputStream.outputObject(ObjectOutputStream.java:1161)
        at
java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java(Compiled
Code))
        at
java.io.ObjectOutputStream.outputClassFields(ObjectOutputStream.java(Compiled
Code))
        at
java.io.ObjectOutputStream.defaultWriteObject(ObjectOutputStream.java:486)
        at
java.io.ObjectOutputStream.outputObject(ObjectOutputStream.java:1227)
        at
java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java(Compiled
Code))
        at
java.io.ObjectOutputStream.outputClassFields(ObjectOutputStream.java(Compiled
Code))
        at
java.io.ObjectOutputStream.defaultWriteObject(ObjectOutputStream.java:486)
        at
java.io.ObjectOutputStream.outputObject(ObjectOutputStream.java:1227)
        at
java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java(Compiled
Code))
        at
org.jboss.ejb.plugins.StatefulSessionFilePersistenceManager.passivateSession(StatefulSessionFilePersistenceManager.java:287)
        at
org.jboss.ejb.plugins.StatefulSessionInstanceCache.passivate(StatefulSessionInstanceCache.java:65)
        at
org.jboss.ejb.plugins.AbstractInstanceCache$1.execute(AbstractInstanceCache.java:737)
        at
org.jboss.util.WorkerQueue$QueueLoop.run(WorkerQueue.java:206)
        at java.lang.Thread.run(Thread.java:498)

Is this a bug (the class should be serializable for
example), or have I done something wrong (then it is a
bg too, because the errormessage should be better!)

Marius K

----------------------------------------------------------------------

Comment By: Jason Dillon (user57)
Date: 2002-04-04 16:18

Message:
Logged In: YES 
user_id=15045

Hrm... do you have a TopicConnection or QueueConnection?

Perhaps this is a bug, but I am not sure exactly.  The 2.0 
specs says:

7.4.1 Instance passivation and conversational state
...
The Bean Provider is required to ensure that the 
ejbPassivate method leaves the instance fields
ready to be serialized by the Container. The objects that 
are assigned to the instance�s non-transient
fields after the ejbPassivate method completes must be one 
of the following:
...
 o A reference to a resource manager connection factory.

This means (as I read it) that if you have a 
ConnectionFactory as a field that the container should 
handle passivation, but if you have a Conection then you 
should stop/close/null it out in ejbPassivate().

I don't currently know if the container correctly handle 
this though... need to check.

--jason

----------------------------------------------------------------------

Comment By: Marius Kotsbak (mkotsbak)
Date: 2002-03-19 10:55

Message:
Logged In: YES 
user_id=366650

I am in fact not holding A ConnectionFactory in my bean!

The only attributes of the bean are Queue and
QueueConnection. I only use the QueueConnectionFactory as a
local variable in ejbCreate (like the example).

Have anyone else used managed JMS successfully?

----------------------------------------------------------------------

Comment By: Chris Harris (charris)
Date: 2002-03-19 08:29

Message:
Logged In: YES 
user_id=8915

The example code keeps a Topic and a TopicConnection around 
as instance variables of the bean. Presumably these are 
serialisable. Your problem is with keeping a 
TopicConnectionFactory around, which presumably is not 
serialisable. The example uses a local (method-level) 
TopicConnectionFactory which goes out of scope once that 
method finishes and is not subject to serialisation.

----------------------------------------------------------------------

Comment By: Marius Kotsbak (mkotsbak)
Date: 2002-03-19 07:56

Message:
Logged In: YES 
user_id=366650

I actually used to do it like you say before I changed to
managed JMS, and thought the example here was correct way to
do it:
http://jboss.org/online-manual/HTML/ch08s32.html

I followed this example and used as in this example these
two instance variables:
 "private Topic topic = null;
  private TopicConnection topicConnection = null;"
(I use Queue instead) 

and empty:
 "public void ejbActivate() {}
  public void ejbPassivate() {}"

If this isn't right, this example code should be updated!

Marius

----------------------------------------------------------------------

Comment By: Chris Harris (charris)
Date: 2002-03-19 00:17

Message:
Logged In: YES 
user_id=8915

This is most likely because whatever JMS resources you are 
keeping in your bean (probably as instance variables) are 
not serializable. You can either a) mark them as transient 
in your bean b) explicitly shut them down / set them to 
null in your ejbPassivate() method.

I prefer method b) simply because it's more explicit and 
makes you think about closing these objects.


----------------------------------------------------------------------

You can respond by visiting: 
http://sourceforge.net/tracker/?func=detail&atid=376685&aid=531524&group_id=22866

_______________________________________________
Jboss-development mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-development

Reply via email to