You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@geronimo.apache.org by David Blevins <da...@visi.com> on 2008/03/06 19:17:59 UTC

Re: Geronimo 2.0.2 - OpenEJB "Passivation Failed"

On Feb 24, 2008, at 1:27 PM, David Blevins wrote:

>
> On Feb 24, 2008, at 4:24 AM, the666pack wrote:
>
>>    [exec] 13:04:31,865 INFO  [OpenEJB] Passivation failed
>>    [exec] java.io.NotSerializableException:  
>> vt.bean.stateful.WriteDataBean
>>    [exec]     at
>> java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1156)
>
> This is an unimplemented feature:  http://issues.apache.org/jira/browse/OPENEJB-215
>
> The workaround is to add java.io.Serializable to your stateful bean  
> class.

FYI, this feature is now implemented and should show up in a release  
Real Soon Now.

-David


Re: Geronimo 2.0.2 - OpenEJB "Passivation Failed"

Posted by the666pack <ma...@gmail.com>.


David Blevins wrote:
> 
> 
> Nothing like that.  Best you can do is bump your poolSize up much  
> higher.  The settings we supply are very conservative and you could  
> likely have a much higher limit depending on the memory limits of your  
> vm.
> 
> -David
> 
> 
> 

ok, i overcame the issue now with editing /var/config/config.xml and setting
BulkPassivate to 0:

        <gbean name="DefaultStatefulContainer">
            <attribute name="properties">TimeOut=30
                PoolSize=100
                BulkPassivate=0</attribute>
        </gbean>

now the error is gone. i want to thank you for your help

greetings,

mario

-- 
View this message in context: http://www.nabble.com/Re%3A-Geronimo-2.0.2---OpenEJB-%22Passivation-Failed%22-tp15880469s134p16024338.html
Sent from the Apache Geronimo - Users mailing list archive at Nabble.com.


Re: Geronimo 2.0.2 - OpenEJB "Passivation Failed"

Posted by David Blevins <da...@visi.com>.
On Mar 10, 2008, at 4:38 AM, the666pack wrote:

>
>
>
> David Blevins wrote:
>>
>>
>> You could implement serializable on your Entity beans, but it's ill
>> advised in almost any situation to have the data passivated with your
>> bean as you wind up with a private, detached, copy of the data that
>> may be outdated.  The rare case may be that you're collecting data
>> that has yet to be persisted (never been attached) and therefore
>> doesn't live in the EntityManager's cache or database yet, but even
>> then you should really be using a transaction which would prevent  
>> your
>> bean from getting passivated at all so the issue should never arise.
>>
> so this means i have to manually "turn off" the passivation of my  
> SFSB via
> bean managed transactions. but i suppose this means a performance  
> loss :(.

A container or bean managed transaction will work, though a bean  
managed may be easier for long running transactions.

> is this problem another issue of the bug mentioned above and so the  
> only
> solution is turning off the passivation mechanism?

No, this is just a warning to be careful of *potential* complications  
serializing (which is storing) database data somewhere that is not the  
database for future use.  It is fine to do in the right  
circumstances.  Just wanted you to be aware there is an actively  
maintained cache of entities in the EntityManager itself which never  
leaves memory.  In terms of temporary storage, it's usually the far  
better place than a serialized stateful bean.

Also know that it is possible to implement serialization api methods  
in your stateful bean such as writeObject and readObject which gives  
you more control of what and how your bean is serialized/ 
deserialized.  It is possible to do things like write the primary key  
data of the entities you're holding during serialization, then in  
deserialization use the EntityManager and primary keys to grab the  
live entities again.

> further, til now whenever i tried to make some kind of manual  
> transaction in
> my beans i always got the error that the container is taking care of  
> the
> transactions and bean managed control (transactions) is not allowed.  
> maybe
> you can tell me what i have to change to be able to add transactions  
> to my
> bean.

You just have to add this to your bean:

@TransactionManagement(TransactionManagementType.BEAN)

The default is TransactionManagementType.CONTAINER as you've noticed.

Just another FYI on a good reference, here's a full list javax.ejb and  
javax.annotation annotations and their defaults when unspecified:  http://openejb.apache.org/3.0/annotations-xml-and-defaults.html

> and even further, is there the possibility to turn off the  
> passivation for
> SFSB at all in geronimo? like some entry in a deployment descriptor
> "passivation=false" ?

Nothing like that.  Best you can do is bump your poolSize up much  
higher.  The settings we supply are very conservative and you could  
likely have a much higher limit depending on the memory limits of your  
vm.

-David


Re: Geronimo 2.0.2 - OpenEJB "Passivation Failed"

Posted by the666pack <ma...@gmail.com>.


David Blevins wrote:
> 
> 
> You could implement serializable on your Entity beans, but it's ill  
> advised in almost any situation to have the data passivated with your  
> bean as you wind up with a private, detached, copy of the data that  
> may be outdated.  The rare case may be that you're collecting data  
> that has yet to be persisted (never been attached) and therefore  
> doesn't live in the EntityManager's cache or database yet, but even  
> then you should really be using a transaction which would prevent your  
> bean from getting passivated at all so the issue should never arise.
> 
> -David
> 
> 
> 
> 

so this means i have to manually "turn off" the passivation of my SFSB via
bean managed transactions. but i suppose this means a performance loss :(.
is this problem another issue of the bug mentioned above and so the only
solution is turning off the passivation mechanism?
 
further, til now whenever i tried to make some kind of manual transaction in
my beans i always got the error that the container is taking care of the
transactions and bean managed control (transactions) is not allowed. maybe
you can tell me what i have to change to be able to add transactions to my
bean.
 
and even further, is there the possibility to turn off the passivation for
SFSB at all in geronimo? like some entry in a deployment descriptor
"passivation=false" ?
 
thanks a lot for helping,
 
mario.



-- 
View this message in context: http://www.nabble.com/Re%3A-Geronimo-2.0.2---OpenEJB-%22Passivation-Failed%22-tp15880469s134p15950694.html
Sent from the Apache Geronimo - Users mailing list archive at Nabble.com.


Re: Geronimo 2.0.2 - OpenEJB "Passivation Failed"

Posted by Mario Kofler <ma...@gmail.com>.
2008/3/10, Mario Kofler <ma...@gmail.com>:
>
>
>
> 2008/3/10, David Blevins david.blevins@visi.com:
> >
> >
> >
> > You could implement serializable on your Entity beans, but it's ill
> > advised in almost any situation to have the data passivated with your
> > bean as you wind up with a private, detached, copy of the data that
> > may be outdated.  The rare case may be that you're collecting data
> > that has yet to be persisted (never been attached) and therefore
> > doesn't live in the EntityManager's cache or database yet, but even
> > then you should really be using a transaction which would prevent your
> > bean from getting passivated at all so the issue should never arise.
> >
> > -David
>
>
> so this means i have to manually "turn off" the passivation of my SFSB via
> bean managed transactions. but i suppose this means a performance loss :(.
> is this problem another issue of the bug mentioned above and so the only
> solution is turning off the passivation mechanism?
>
> further, til now whenever i tried to make some kind of manual transaction
> in my beans i always got the error that the container is taking care of the
> transactions and bean managed control (transactions) is not allowed. maybe
> you can tell me what i have to change to be able to add transactions to
> my bean.
>
> thanks, mario
>
>
>
>
and even further, is there the possibility to turn off the passivation for
SFSB at all in geronimo? like some entry in a deployment descriptor
"passivation=false" ?

thanks for helping,

mario.

Re: Geronimo 2.0.2 - OpenEJB "Passivation Failed"

Posted by Mario Kofler <ma...@gmail.com>.
2008/3/10, David Blevins david.blevins@visi.com:
>
>
>
> You could implement serializable on your Entity beans, but it's ill
> advised in almost any situation to have the data passivated with your
> bean as you wind up with a private, detached, copy of the data that
> may be outdated.  The rare case may be that you're collecting data
> that has yet to be persisted (never been attached) and therefore
> doesn't live in the EntityManager's cache or database yet, but even
> then you should really be using a transaction which would prevent your
> bean from getting passivated at all so the issue should never arise.
>
> -David


so this means i have to manually "turn off" the passivation of my SFSB via
bean managed transactions. but i suppose this means a performance loss :(.
is this problem another issue of the bug mentioned above and so the only
solution is turning off the passivation mechanism?

further, til now whenever i tried to make some kind of manual transaction in
my beans i always got the error that the container is taking care of the
transactions and bean managed control (transactions) is not allowed. maybe
you can tell me what i have to change to be able to add transactions to
my bean.

thanks, mario

Re: Geronimo 2.0.2 - OpenEJB "Passivation Failed"

Posted by David Blevins <da...@visi.com>.
On Mar 9, 2008, at 11:41 AM, Mario Kofler wrote:

> thanks!
>
> unfortunately i cannot wait til it is coming in a release. the  
> problem i have got now is that my SFSB implements Serializable but i  
> still keep getting the error!!! very unfortunate.
>
> i realized that the error is not coming after accessing the SFSB but  
> just after accessing the method that writes the beans to the database.
>
> Do also the Entity beans have to implement Serializable? or do i  
> have to do something for the entity manager which is created in this  
> function?
>

Holding the EntityManager itself is fine, it essentially stays in  
memory and only a reference to it is serialized.  With the Entities  
themselves an actual copy of the object is serialzied to disk.   
Optimally, you assume the EntityManager has good caching so you don't  
need to keep N copies in X numbers of stateful beans in serialized  
form on disk.  Just keep track of the minimal amount of information  
you need to grab your Entities again from the EntityManager (and it's  
live cache) when you activate.

You could implement serializable on your Entity beans, but it's ill  
advised in almost any situation to have the data passivated with your  
bean as you wind up with a private, detached, copy of the data that  
may be outdated.  The rare case may be that you're collecting data  
that has yet to be persisted (never been attached) and therefore  
doesn't live in the EntityManager's cache or database yet, but even  
then you should really be using a transaction which would prevent your  
bean from getting passivated at all so the issue should never arise.

-David



Re: Geronimo 2.0.2 - OpenEJB "Passivation Failed"

Posted by Mario Kofler <ma...@gmail.com>.
thanks!

unfortunately i cannot wait til it is coming in a release. the problem i
have got now is that my SFSB implements Serializable but i still keep
getting the error!!! very unfortunate.

i realized that the error is not coming after accessing the SFSB but just
after accessing the method that writes the beans to the database.

Do also the Entity beans have to implement Serializable? or do i have to do
something for the entity manager which is created in this function?

thanks for the help,

mario.

2008/3/6, David Blevins <da...@visi.com>:
>
>
> On Feb 24, 2008, at 1:27 PM, David Blevins wrote:
>
> >
> > On Feb 24, 2008, at 4:24 AM, the666pack wrote:
> >
> >>    [exec] 13:04:31,865 INFO  [OpenEJB] Passivation failed
> >>    [exec] java.io.NotSerializableException:
> >> vt.bean.stateful.WriteDataBean
> >>    [exec]     at
> >> java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1156)
> >
> > This is an unimplemented feature:
> http://issues.apache.org/jira/browse/OPENEJB-215
> >
> > The workaround is to add java.io.Serializable to your stateful bean
> > class.
>
>
> FYI, this feature is now implemented and should show up in a release
> Real Soon Now.
>
>
> -David
>
>