Based on the stack trace, what he has does seem to be a DataSource, not 
a connection. Managing that instance variable in 
ejbActivate/ejbPassivate would be a fix.

-danch

David Jencks wrote:

> Actually for jboss you should not keep a reference to a connection across
> transaction boundaries, it will break the connection.  OK to keep a
> reference to a DataSource, which you should have transient or set to null
> on passivate.
> 
> david jencks
> 
> On 2001.09.28 06:13:40 -0400 Joost v.d. Wijgerd wrote:
> 
>>Hi,
>>
>>You have a reference to a connection in your Stateful session bean. When
>>the been is passivated it is basically serialized to a persistent store
>>(e.g. disk). Obviously it tries to serialize all you fields. What you
>>should do is drop the reference to the connection (or make the field
>>trainsient) and reinitialize when ejbActivate is called (or in
>>setEntityContext() ).
>>
>>cheers,
>>
>>Joost.
>>
>>-----Original Message-----
>>From: Jarecsni Janos [mailto:[EMAIL PROTECTED]]
>>Sent: Friday, September 28, 2001 11:47 AM
>>To: JBoss-List
>>Subject: [JBoss-user] Passivating EJBs
>>
>>
>>
>>Hi,
>>
>>thanks for your answers to my previous question ("Performance..."). I
>>got "a
>>bit" more confident that this project will finally succeed - thanks to
>>JBoss
>>:)
>>
>>Now we got a little problem, which I'm sure is a consequence of our
>>misunderstanding of some basic rules... When JBoss tries to passivate
>>some
>>EJBs, we get the following exception:
>>
>>[Container factory] java.rmi.ServerException: Could not passivate;
>>nested
>>exception is:
>>[Container factory] java.io.NotSerializableException:
>>org.jboss.pool.jdbc.xa.XAPoolDataSource
>>[Container factory] java.io.NotSerializableException:
>>org.jboss.pool.jdbc.xa.XAPoolDataSource
>>[Container factory]     at
>>java.io.ObjectOutputStream.outputObject(ObjectOutputStream.java:1148)
>>[Container factory]     at
>>java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:366)
>>[Container factory]     at
>>java.io.ObjectOutputStream.outputClassFields(ObjectOutputStream.java:182
>>7)
>>[Container factory]     at
>>java.io.ObjectOutputStream.defaultWriteObject(ObjectOutputStream.java:48
>>0)
>>[Container factory]     at
>>java.io.ObjectOutputStream.outputObject(ObjectOutputStream.java:1214)
>>[Container factory]     at
>>java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:366)
>>[Container factory]     at
>>org.jboss.ejb.plugins.StatefulSessionFilePersistenceManager.passivateSes
>>sion
>>(StatefulSessionFilePersistenceManager.java:285)
>>[Container factory]     at
>>org.jboss.ejb.plugins.StatefulSessionInstanceCache.passivate(StatefulSes
>>sion
>>InstanceCache.java:67)
>>[Container factory]     at
>>org.jboss.ejb.plugins.AbstractInstanceCache$1.execute(AbstractInstanceCa
>>che.
>>java:709)
>>[Container factory]     at
>>org.jboss.util.WorkerQueue$QueueLoop.run(WorkerQueue.java:199)
>>[Container factory]     at java.lang.Thread.run(Thread.java:484)
>>
>>We - following the Petstore example - have a member variable of a
>>javax.sql.DataSource in each of our beans that will want to access the
>>database. In each method we ask for a connection from this datasource.
>>Now
>>it's obvious that this object is not serializable. My question is how to
>>work this problem around? I mean if I ask for a DataSource in each
>>method
>>(so that no such member variable exist) won't it slow down these methods
>>a
>>lot (JNDI lookups...). Or is there any other ways to do it?
>>
>>Thanks very much in advance.
>>
>>Cheers,
>>
>>Janos
>>Budapest, Hungary.




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

Reply via email to