geronimo-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jacek Laskowski" <ja...@laskowski.net.pl>
Subject Re: Geronimo 2.0.2 - OpenEJB "Passivation Failed"
Date Mon, 25 Feb 2008 20:33:41 GMT
On Mon, Feb 25, 2008 at 12:20 PM, Mario Kofler <mario.kofler@gmail.com> wrote:

> so there is a simple reason why i  decided to close the entity manager
> explicitely: because i thought it is a good idea ;)

And you didn't get any exception?! It's disallowed to play with server
managed resources and close them just like you tried to do. The reason
people are still using EJB3 and all the Java EE 5 stack is their
simplicity (or attempt to be simple) as far as resources are
concerned. You just use them and don't have to worry about managing
them - that's the role of Geronimo or other less-feature-rich
application servers ;-) Use it and when you're done forget about them.
Geronimo takes care of them for you.

>                 em.flush();

Don't do that. Forget about managing resources by yourself and let
Geronimo do that for you. Besides, it's also not recommended unless
you're using RESOURCE_LOCAL PU which is not recommended in the managed
environment like Geronimo either.

> so my thought why to put the em.close() in the @PreDestroy was, because i
> leave the handle to the em open in this method after em.flush(). then to
> close it rightfully i  thought i'd put it into the @PreDestroy method. i
> cannot close the em right after em.flush because the SFSB lives longer than
> just one call to this particular write method, so if there is a call to
> another method, like "writeMovie" the em would be closed already and i get
> an exception.

Show us the persistence.xml. Let's make it better/simpler/shorter
(cross out or add any word you'd like to hear about your app ;-)). The
less you write it's better for your app. That's why Geronimo (or other
Java EE 5 app servers) are for.

Jacek

-- 
Jacek Laskowski
http://www.JacekLaskowski.pl

Mime
View raw message