You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by Cagatay Civici <ca...@gmail.com> on 2008/05/21 15:28:40 UTC

[Orchestra] Session is closed

Hi,

I'm trying to convert an existing application to use Orchestra. Followed the
installation documentation but I'm getting org.hibernate.SessionException:
Session is closed! exception after I add Orchestra. Just cant make it work
so far.

Here is web.xml: http://pastebin.com/m2c4c16b1
And spring config: http://pastebin.com/m12f01042

Also I'm using backing beans with annotations like;
@Component("createMovie")
@Scope("conversation.access")
public class CreateMovie {...}

I'll appreciate any help;)

Cheers,

Cagatay

Re: [Orchestra] Session is closed

Posted by Dan Tran <da...@gmail.com>.

I ran into entity close due to this problem

https://issues.apache.org/jira/browse/ORCHESTRA-23

-D



Cagatay Civici wrote:
> 
> After switching to toplink I got;
> 
> Caused by: java.lang.NullPointerException
> 	at
> oracle.toplink.essentials.internal.ejb.cmp3.base.EntityManagerImpl.getActivePersistenceContext(EntityManagerImpl.java:522)
> 	at
> oracle.toplink.essentials.internal.ejb.cmp3.base.EntityManagerImpl.getActiveSession(EntityManagerImpl.java:378)
> 	at
> oracle.toplink.essentials.internal.ejb.cmp3.base.EJBQueryImpl.getActiveSession(EJBQueryImpl.java:640)
> 	at
> oracle.toplink.essentials.internal.ejb.cmp3.base.EJBQueryImpl.executeReadQuery(EJBQueryImpl.java:343)
> 	at
> oracle.toplink.essentials.internal.ejb.cmp3.base.EJBQueryImpl.getResultList(EJBQueryImpl.java:438)
> 
> Definitely sth I use messes with Orchestra:)
> 
> On Wed, May 21, 2008 at 4:53 PM, Cagatay Civici <ca...@gmail.com>
> wrote:
> 
>> Hi Mario,
>>
>> Thanks a lot for looking into it.
>>
>> The session is closed in the first request so I cannot open a page that
>> uses a jpa dao to read some data to display for the initial request.
>>
>> Once I have the openentitymanagerinviewfilter of spring but I removed it
>> after migrating to orchestra.
>>
>> I'll dig this more, change the jpa implementation(using hibernate now)
>> maybe, if nothing helps I'll send you the small app Mario:)
>>
>> Thanks a lot again,
>>
>> Ciao,
>>
>> Cagatay
>>
> 
> 

-- 
View this message in context: http://www.nabble.com/-Orchestra--Session-is-closed-tp17367957p17397463.html
Sent from the MyFaces - Users mailing list archive at Nabble.com.


Re: [Orchestra] Session is closed

Posted by Cagatay Civici <ca...@gmail.com>.
After switching to toplink I got;

Caused by: java.lang.NullPointerException
	at oracle.toplink.essentials.internal.ejb.cmp3.base.EntityManagerImpl.getActivePersistenceContext(EntityManagerImpl.java:522)
	at oracle.toplink.essentials.internal.ejb.cmp3.base.EntityManagerImpl.getActiveSession(EntityManagerImpl.java:378)
	at oracle.toplink.essentials.internal.ejb.cmp3.base.EJBQueryImpl.getActiveSession(EJBQueryImpl.java:640)
	at oracle.toplink.essentials.internal.ejb.cmp3.base.EJBQueryImpl.executeReadQuery(EJBQueryImpl.java:343)
	at oracle.toplink.essentials.internal.ejb.cmp3.base.EJBQueryImpl.getResultList(EJBQueryImpl.java:438)

Definitely sth I use messes with Orchestra:)

On Wed, May 21, 2008 at 4:53 PM, Cagatay Civici <ca...@gmail.com>
wrote:

> Hi Mario,
>
> Thanks a lot for looking into it.
>
> The session is closed in the first request so I cannot open a page that
> uses a jpa dao to read some data to display for the initial request.
>
> Once I have the openentitymanagerinviewfilter of spring but I removed it
> after migrating to orchestra.
>
> I'll dig this more, change the jpa implementation(using hibernate now)
> maybe, if nothing helps I'll send you the small app Mario:)
>
> Thanks a lot again,
>
> Ciao,
>
> Cagatay
>

Re: [Orchestra] Session is closed

Posted by Cagatay Civici <ca...@gmail.com>.
Hi Mario,

Thanks a lot for looking into it.

The session is closed in the first request so I cannot open a page that uses
a jpa dao to read some data to display for the initial request.

Once I have the openentitymanagerinviewfilter of spring but I removed it
after migrating to orchestra.

I'll dig this more, change the jpa implementation(using hibernate now)
maybe, if nothing helps I'll send you the small app Mario:)

Thanks a lot again,

Ciao,

Cagatay

Re: [Orchestra] Session is closed

Posted by Dan Tran <da...@gmail.com>.

My wild guess here is that your entity was not created by your conversion by
any chance,
specially where your is in access scope.

I never encounter this problem since I only remove entity using its key.



Cagatay Civici wrote:
> 
> Yeah, I wasn't using transactions when reading data in service methods,
> using read-only transactions fixed my problem.
> 
> Now I can make most of the Orchestra features work with an exception.
> 
> Whenever I try to remove an entity, I get message: "the detached instance
> cant be removed, try to merge it first". But that doesn't make sense
> because
> the backing bean that loads and tries to delete the entity is in
> conversation access scope, it is in the same unit of work so it's supposed
> to be the same entity manager.
> 
> Cagatay
> 
> On Thu, May 22, 2008 at 10:11 AM, Dan Tran <da...@gmail.com> wrote:
> 
>>
>>
>> Also, the most common problem with entity close is your service bean is
>> not
>> marked as Transational.
>>
>> -D
>>
>>
>> Mario Ivankovits wrote:
>> >
>> > Hi Cagatay!
>> >> I'm trying to convert an existing application to use Orchestra.
>> >> Followed the installation documentation but I'm getting
>> >> org.hibernate.SessionException: Session is closed! exception after I
>> >> add Orchestra. Just cant make it work so far.
>> > Unfortunately I can't see anything obviously wrong in your
>> configuration
>> > file.
>> >
>> > Is the Session closed issued after the first request or after an
>> > exception?
>> >
>> > Normally I'd think that there is some filter active which will close
>> the
>> > session and that your application do not really use the Orchestra
>> > provided persistence context.
>> > No clue why this can happen.
>> >
>> > Probably debugging into Orchestra's JpaPersistenceContextFactory and
>> see
>> > if the created PersistenceContext is the same you'll use in your method
>> > then will help.
>> >
>> > If you can't solve your problem and nobody else has a better idea we
>> > need to get in touch with your application, I think :-(
>> >
>> >
>> > Ciao,
>> > Mario
>> >
>> >
>> >
>>
>> --
>> View this message in context:
>> http://www.nabble.com/-Orchestra--Session-is-closed-tp17367957p17398627.html
>> Sent from the MyFaces - Users mailing list archive at Nabble.com.
>>
>>
> 
> 

-- 
View this message in context: http://www.nabble.com/-Orchestra--Session-is-closed-tp17367957p17408572.html
Sent from the MyFaces - Users mailing list archive at Nabble.com.


Re: [Orchestra] Session is closed

Posted by Cagatay Civici <ca...@gmail.com>.
Yeah, I wasn't using transactions when reading data in service methods,
using read-only transactions fixed my problem.

Now I can make most of the Orchestra features work with an exception.

Whenever I try to remove an entity, I get message: "the detached instance
cant be removed, try to merge it first". But that doesn't make sense because
the backing bean that loads and tries to delete the entity is in
conversation access scope, it is in the same unit of work so it's supposed
to be the same entity manager.

Cagatay

On Thu, May 22, 2008 at 10:11 AM, Dan Tran <da...@gmail.com> wrote:

>
>
> Also, the most common problem with entity close is your service bean is not
> marked as Transational.
>
> -D
>
>
> Mario Ivankovits wrote:
> >
> > Hi Cagatay!
> >> I'm trying to convert an existing application to use Orchestra.
> >> Followed the installation documentation but I'm getting
> >> org.hibernate.SessionException: Session is closed! exception after I
> >> add Orchestra. Just cant make it work so far.
> > Unfortunately I can't see anything obviously wrong in your configuration
> > file.
> >
> > Is the Session closed issued after the first request or after an
> > exception?
> >
> > Normally I'd think that there is some filter active which will close the
> > session and that your application do not really use the Orchestra
> > provided persistence context.
> > No clue why this can happen.
> >
> > Probably debugging into Orchestra's JpaPersistenceContextFactory and see
> > if the created PersistenceContext is the same you'll use in your method
> > then will help.
> >
> > If you can't solve your problem and nobody else has a better idea we
> > need to get in touch with your application, I think :-(
> >
> >
> > Ciao,
> > Mario
> >
> >
> >
>
> --
> View this message in context:
> http://www.nabble.com/-Orchestra--Session-is-closed-tp17367957p17398627.html
> Sent from the MyFaces - Users mailing list archive at Nabble.com.
>
>

Re: [Orchestra] Session is closed

Posted by Dan Tran <da...@gmail.com>.

Also, the most common problem with entity close is your service bean is not
marked as Transational.

-D


Mario Ivankovits wrote:
> 
> Hi Cagatay!
>> I'm trying to convert an existing application to use Orchestra.
>> Followed the installation documentation but I'm getting
>> org.hibernate.SessionException: Session is closed! exception after I
>> add Orchestra. Just cant make it work so far.
> Unfortunately I can't see anything obviously wrong in your configuration
> file.
> 
> Is the Session closed issued after the first request or after an
> exception?
> 
> Normally I'd think that there is some filter active which will close the
> session and that your application do not really use the Orchestra
> provided persistence context.
> No clue why this can happen.
> 
> Probably debugging into Orchestra's JpaPersistenceContextFactory and see
> if the created PersistenceContext is the same you'll use in your method
> then will help.
> 
> If you can't solve your problem and nobody else has a better idea we
> need to get in touch with your application, I think :-(
> 
> 
> Ciao,
> Mario
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/-Orchestra--Session-is-closed-tp17367957p17398627.html
Sent from the MyFaces - Users mailing list archive at Nabble.com.


Re: [Orchestra] Session is closed

Posted by Mario Ivankovits <ma...@ops.co.at>.
Hi Cagatay!
> I'm trying to convert an existing application to use Orchestra.
> Followed the installation documentation but I'm getting
> org.hibernate.SessionException: Session is closed! exception after I
> add Orchestra. Just cant make it work so far.
Unfortunately I can't see anything obviously wrong in your configuration
file.

Is the Session closed issued after the first request or after an exception?

Normally I'd think that there is some filter active which will close the
session and that your application do not really use the Orchestra
provided persistence context.
No clue why this can happen.

Probably debugging into Orchestra's JpaPersistenceContextFactory and see
if the created PersistenceContext is the same you'll use in your method
then will help.

If you can't solve your problem and nobody else has a better idea we
need to get in touch with your application, I think :-(


Ciao,
Mario