You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@aries.apache.org by "Ioannis Canellos (JIRA)" <ji...@apache.org> on 2012/10/05 11:43:03 UTC

[jira] [Created] (ARIES-933) IllegalStateException when the peristence bundle gets resolved.

Ioannis Canellos created ARIES-933:
--------------------------------------

             Summary: IllegalStateException when the peristence bundle gets resolved.
                 Key: ARIES-933
                 URL: https://issues.apache.org/jira/browse/ARIES-933
             Project: Aries
          Issue Type: Bug
          Components: JPA
    Affects Versions: 0.3, 1.0
            Reporter: Ioannis Canellos


Aries JPA tries to create the entity manager factories when the persistence bundle gets in resolved state.

With some persistence providers this can cause issues. For example Hibernate will try to access the datasource via jndi when creating the EMF, causing the IllegalStateException due to the fact that the persistnce bundle still has not context (is in resolved state).

Even worse it will leave the EntityManagerFactoryManager is a wrong state, preventing it to create the EMF when the bundle is created.

There are two ways of approaching this issue:
i) Don't try to create EMF when the persistence bundle gets resolved.
ii) Catch possible errors and cleanup, so that EMF can be created when the bundle gets started.

I am going to attach a patch for the first appraoch, unless there is a good way for creating EMF when the bundle gets resolved.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

RE: [jira] [Created] (ARIES-933) IllegalStateException when the peristence bundle gets resolved.

Posted by Timothy Ward <ti...@apache.org>.
Emily,

It's possible that Ioannis doesn't follow these lists - have you been cross-posting in the JIRA comments?

Tim

> Date: Fri, 5 Oct 2012 13:54:36 +0100
> Subject: Re: [jira] [Created] (ARIES-933) IllegalStateException when the peristence bundle gets resolved.
> From: emijiang6@googlemail.com
> To: dev@aries.apache.org
> 
> Ignore my comments regarding 1.0.1. My memory tricked me to think a fix was
> committed. Apparently not. Please see the comments from jira 832 to see
> whether you can work around this problem.
> 
> On Fri, Oct 5, 2012 at 11:54 AM, Emily Jiang <em...@googlemail.com>wrote:
> 
> > By the way, the 1.0.1 jpa bundle should work for you. I am not sure
> > whether it is released or not. You can see the code changes from trunk.
> >
> >
> > On Fri, Oct 5, 2012 at 11:07 AM, Emily Jiang <em...@googlemail.com>wrote:
> >
> >> Hi Ioannis,
> >> We have attempted this before. However, this will cause some other app
> >> server to fail as they need EMF to perform entity enhancement using a
> >> mechanism other than using ByteCodeWeaving.
> >> See jira https://issues.apache.org/jira/browse/ARIES-832 for more
> >> details.
> >> Thanks
> >> Emily
> >>
> >>
> >> On Fri, Oct 5, 2012 at 10:43 AM, Ioannis Canellos (JIRA) <jira@apache.org
> >> > wrote:
> >>
> >>> Ioannis Canellos created ARIES-933:
> >>> --------------------------------------
> >>>
> >>>              Summary: IllegalStateException when the peristence bundle
> >>> gets resolved.
> >>>                  Key: ARIES-933
> >>>                  URL: https://issues.apache.org/jira/browse/ARIES-933
> >>>              Project: Aries
> >>>           Issue Type: Bug
> >>>           Components: JPA
> >>>     Affects Versions: 0.3, 1.0
> >>>             Reporter: Ioannis Canellos
> >>>
> >>>
> >>> Aries JPA tries to create the entity manager factories when the
> >>> persistence bundle gets in resolved state.
> >>>
> >>> With some persistence providers this can cause issues. For example
> >>> Hibernate will try to access the datasource via jndi when creating the EMF,
> >>> causing the IllegalStateException due to the fact that the persistnce
> >>> bundle still has not context (is in resolved state).
> >>>
> >>> Even worse it will leave the EntityManagerFactoryManager is a wrong
> >>> state, preventing it to create the EMF when the bundle is created.
> >>>
> >>> There are two ways of approaching this issue:
> >>> i) Don't try to create EMF when the persistence bundle gets resolved.
> >>> ii) Catch possible errors and cleanup, so that EMF can be created when
> >>> the bundle gets started.
> >>>
> >>> I am going to attach a patch for the first appraoch, unless there is a
> >>> good way for creating EMF when the bundle gets resolved.
> >>>
> >>> --
> >>> This message is automatically generated by JIRA.
> >>> If you think it was sent incorrectly, please contact your JIRA
> >>> administrators
> >>> For more information on JIRA, see:
> >>> http://www.atlassian.com/software/jira
> >>>
> >>
> >>
> >>
> >> --
> >> Thanks
> >> Emily
> >> =================
> >> Emily Jiang
> >> ejiang@apache.org
> >>
> >>
> >
> >
> > --
> > Thanks
> > Emily
> > =================
> > Emily Jiang
> > ejiang@apache.org
> >
> >
> 
> 
> -- 
> Thanks
> Emily
> =================
> Emily Jiang
> ejiang@apache.org
 		 	   		  

Re: [jira] [Created] (ARIES-933) IllegalStateException when the peristence bundle gets resolved.

Posted by Emily Jiang <em...@googlemail.com>.
Ignore my comments regarding 1.0.1. My memory tricked me to think a fix was
committed. Apparently not. Please see the comments from jira 832 to see
whether you can work around this problem.

On Fri, Oct 5, 2012 at 11:54 AM, Emily Jiang <em...@googlemail.com>wrote:

> By the way, the 1.0.1 jpa bundle should work for you. I am not sure
> whether it is released or not. You can see the code changes from trunk.
>
>
> On Fri, Oct 5, 2012 at 11:07 AM, Emily Jiang <em...@googlemail.com>wrote:
>
>> Hi Ioannis,
>> We have attempted this before. However, this will cause some other app
>> server to fail as they need EMF to perform entity enhancement using a
>> mechanism other than using ByteCodeWeaving.
>> See jira https://issues.apache.org/jira/browse/ARIES-832 for more
>> details.
>> Thanks
>> Emily
>>
>>
>> On Fri, Oct 5, 2012 at 10:43 AM, Ioannis Canellos (JIRA) <jira@apache.org
>> > wrote:
>>
>>> Ioannis Canellos created ARIES-933:
>>> --------------------------------------
>>>
>>>              Summary: IllegalStateException when the peristence bundle
>>> gets resolved.
>>>                  Key: ARIES-933
>>>                  URL: https://issues.apache.org/jira/browse/ARIES-933
>>>              Project: Aries
>>>           Issue Type: Bug
>>>           Components: JPA
>>>     Affects Versions: 0.3, 1.0
>>>             Reporter: Ioannis Canellos
>>>
>>>
>>> Aries JPA tries to create the entity manager factories when the
>>> persistence bundle gets in resolved state.
>>>
>>> With some persistence providers this can cause issues. For example
>>> Hibernate will try to access the datasource via jndi when creating the EMF,
>>> causing the IllegalStateException due to the fact that the persistnce
>>> bundle still has not context (is in resolved state).
>>>
>>> Even worse it will leave the EntityManagerFactoryManager is a wrong
>>> state, preventing it to create the EMF when the bundle is created.
>>>
>>> There are two ways of approaching this issue:
>>> i) Don't try to create EMF when the persistence bundle gets resolved.
>>> ii) Catch possible errors and cleanup, so that EMF can be created when
>>> the bundle gets started.
>>>
>>> I am going to attach a patch for the first appraoch, unless there is a
>>> good way for creating EMF when the bundle gets resolved.
>>>
>>> --
>>> This message is automatically generated by JIRA.
>>> If you think it was sent incorrectly, please contact your JIRA
>>> administrators
>>> For more information on JIRA, see:
>>> http://www.atlassian.com/software/jira
>>>
>>
>>
>>
>> --
>> Thanks
>> Emily
>> =================
>> Emily Jiang
>> ejiang@apache.org
>>
>>
>
>
> --
> Thanks
> Emily
> =================
> Emily Jiang
> ejiang@apache.org
>
>


-- 
Thanks
Emily
=================
Emily Jiang
ejiang@apache.org

Re: [jira] [Created] (ARIES-933) IllegalStateException when the peristence bundle gets resolved.

Posted by Emily Jiang <em...@googlemail.com>.
By the way, the 1.0.1 jpa bundle should work for you. I am not sure whether
it is released or not. You can see the code changes from trunk.

On Fri, Oct 5, 2012 at 11:07 AM, Emily Jiang <em...@googlemail.com>wrote:

> Hi Ioannis,
> We have attempted this before. However, this will cause some other app
> server to fail as they need EMF to perform entity enhancement using a
> mechanism other than using ByteCodeWeaving.
> See jira https://issues.apache.org/jira/browse/ARIES-832 for more details.
> Thanks
> Emily
>
>
> On Fri, Oct 5, 2012 at 10:43 AM, Ioannis Canellos (JIRA) <ji...@apache.org>wrote:
>
>> Ioannis Canellos created ARIES-933:
>> --------------------------------------
>>
>>              Summary: IllegalStateException when the peristence bundle
>> gets resolved.
>>                  Key: ARIES-933
>>                  URL: https://issues.apache.org/jira/browse/ARIES-933
>>              Project: Aries
>>           Issue Type: Bug
>>           Components: JPA
>>     Affects Versions: 0.3, 1.0
>>             Reporter: Ioannis Canellos
>>
>>
>> Aries JPA tries to create the entity manager factories when the
>> persistence bundle gets in resolved state.
>>
>> With some persistence providers this can cause issues. For example
>> Hibernate will try to access the datasource via jndi when creating the EMF,
>> causing the IllegalStateException due to the fact that the persistnce
>> bundle still has not context (is in resolved state).
>>
>> Even worse it will leave the EntityManagerFactoryManager is a wrong
>> state, preventing it to create the EMF when the bundle is created.
>>
>> There are two ways of approaching this issue:
>> i) Don't try to create EMF when the persistence bundle gets resolved.
>> ii) Catch possible errors and cleanup, so that EMF can be created when
>> the bundle gets started.
>>
>> I am going to attach a patch for the first appraoch, unless there is a
>> good way for creating EMF when the bundle gets resolved.
>>
>> --
>> This message is automatically generated by JIRA.
>> If you think it was sent incorrectly, please contact your JIRA
>> administrators
>> For more information on JIRA, see: http://www.atlassian.com/software/jira
>>
>
>
>
> --
> Thanks
> Emily
> =================
> Emily Jiang
> ejiang@apache.org
>
>


-- 
Thanks
Emily
=================
Emily Jiang
ejiang@apache.org

Re: [jira] [Created] (ARIES-933) IllegalStateException when the peristence bundle gets resolved.

Posted by Emily Jiang <em...@googlemail.com>.
Hi Ioannis,
We have attempted this before. However, this will cause some other app
server to fail as they need EMF to perform entity enhancement using a
mechanism other than using ByteCodeWeaving.
See jira https://issues.apache.org/jira/browse/ARIES-832 for more details.
Thanks
Emily

On Fri, Oct 5, 2012 at 10:43 AM, Ioannis Canellos (JIRA) <ji...@apache.org>wrote:

> Ioannis Canellos created ARIES-933:
> --------------------------------------
>
>              Summary: IllegalStateException when the peristence bundle
> gets resolved.
>                  Key: ARIES-933
>                  URL: https://issues.apache.org/jira/browse/ARIES-933
>              Project: Aries
>           Issue Type: Bug
>           Components: JPA
>     Affects Versions: 0.3, 1.0
>             Reporter: Ioannis Canellos
>
>
> Aries JPA tries to create the entity manager factories when the
> persistence bundle gets in resolved state.
>
> With some persistence providers this can cause issues. For example
> Hibernate will try to access the datasource via jndi when creating the EMF,
> causing the IllegalStateException due to the fact that the persistnce
> bundle still has not context (is in resolved state).
>
> Even worse it will leave the EntityManagerFactoryManager is a wrong state,
> preventing it to create the EMF when the bundle is created.
>
> There are two ways of approaching this issue:
> i) Don't try to create EMF when the persistence bundle gets resolved.
> ii) Catch possible errors and cleanup, so that EMF can be created when the
> bundle gets started.
>
> I am going to attach a patch for the first appraoch, unless there is a
> good way for creating EMF when the bundle gets resolved.
>
> --
> This message is automatically generated by JIRA.
> If you think it was sent incorrectly, please contact your JIRA
> administrators
> For more information on JIRA, see: http://www.atlassian.com/software/jira
>



-- 
Thanks
Emily
=================
Emily Jiang
ejiang@apache.org

[jira] [Commented] (ARIES-933) IllegalStateException when the peristence bundle gets resolved.

Posted by "Ioannis Canellos (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/ARIES-933?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13470320#comment-13470320 ] 

Ioannis Canellos commented on ARIES-933:
----------------------------------------

With approach (i) there are test failures, so I'll try the approach (ii).
                
> IllegalStateException when the peristence bundle gets resolved.
> ---------------------------------------------------------------
>
>                 Key: ARIES-933
>                 URL: https://issues.apache.org/jira/browse/ARIES-933
>             Project: Aries
>          Issue Type: Bug
>          Components: JPA
>    Affects Versions: 0.3, 1.0
>            Reporter: Ioannis Canellos
>
> Aries JPA tries to create the entity manager factories when the persistence bundle gets in resolved state.
> With some persistence providers this can cause issues. For example Hibernate will try to access the datasource via jndi when creating the EMF, causing the IllegalStateException due to the fact that the persistnce bundle still has not context (is in resolved state).
> Even worse it will leave the EntityManagerFactoryManager is a wrong state, preventing it to create the EMF when the bundle is created.
> There are two ways of approaching this issue:
> i) Don't try to create EMF when the persistence bundle gets resolved.
> ii) Catch possible errors and cleanup, so that EMF can be created when the bundle gets started.
> I am going to attach a patch for the first appraoch, unless there is a good way for creating EMF when the bundle gets resolved.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Commented] (ARIES-933) IllegalStateException when the peristence bundle gets resolved.

Posted by "Emily Jiang (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/ARIES-933?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13475381#comment-13475381 ] 

Emily Jiang commented on ARIES-933:
-----------------------------------

I posted in the forum for this jira, but it looks like you did not follow up that thread. 

Hi Ioannis,
We have attempted this before. However, this will cause some other app server to fail as they need EMF to perform entity enhancement using a mechanism other than using ByteCodeWeaving.
See jira https://issues.apache.org/jira/browse/ARIES-832 for more details.
Thanks
Emily

                
> IllegalStateException when the peristence bundle gets resolved.
> ---------------------------------------------------------------
>
>                 Key: ARIES-933
>                 URL: https://issues.apache.org/jira/browse/ARIES-933
>             Project: Aries
>          Issue Type: Bug
>          Components: JPA
>    Affects Versions: 0.3, 1.0
>            Reporter: Ioannis Canellos
>         Attachments: ARIES-933.patch
>
>
> Aries JPA tries to create the entity manager factories when the persistence bundle gets in resolved state.
> With some persistence providers this can cause issues. For example Hibernate will try to access the datasource via jndi when creating the EMF, causing the IllegalStateException due to the fact that the persistnce bundle still has not context (is in resolved state).
> Even worse it will leave the EntityManagerFactoryManager is a wrong state, preventing it to create the EMF when the bundle is created.
> There are two ways of approaching this issue:
> i) Don't try to create EMF when the persistence bundle gets resolved.
> ii) Catch possible errors and cleanup, so that EMF can be created when the bundle gets started.
> I am going to attach a patch for the first appraoch, unless there is a good way for creating EMF when the bundle gets resolved.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Updated] (ARIES-933) IllegalStateException when the peristence bundle gets resolved.

Posted by "Ioannis Canellos (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/ARIES-933?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Ioannis Canellos updated ARIES-933:
-----------------------------------

    Attachment: ARIES-933.patch

I am attaching a patch which catch exception and cleans up emfs, when an error occurs during creation of emfs in the resolved bundle state.
                
> IllegalStateException when the peristence bundle gets resolved.
> ---------------------------------------------------------------
>
>                 Key: ARIES-933
>                 URL: https://issues.apache.org/jira/browse/ARIES-933
>             Project: Aries
>          Issue Type: Bug
>          Components: JPA
>    Affects Versions: 0.3, 1.0
>            Reporter: Ioannis Canellos
>         Attachments: ARIES-933.patch
>
>
> Aries JPA tries to create the entity manager factories when the persistence bundle gets in resolved state.
> With some persistence providers this can cause issues. For example Hibernate will try to access the datasource via jndi when creating the EMF, causing the IllegalStateException due to the fact that the persistnce bundle still has not context (is in resolved state).
> Even worse it will leave the EntityManagerFactoryManager is a wrong state, preventing it to create the EMF when the bundle is created.
> There are two ways of approaching this issue:
> i) Don't try to create EMF when the persistence bundle gets resolved.
> ii) Catch possible errors and cleanup, so that EMF can be created when the bundle gets started.
> I am going to attach a patch for the first appraoch, unless there is a good way for creating EMF when the bundle gets resolved.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Commented] (ARIES-933) IllegalStateException when the peristence bundle gets resolved.

Posted by "Ioannis Canellos (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/ARIES-933?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13475563#comment-13475563 ] 

Ioannis Canellos commented on ARIES-933:
----------------------------------------

Hi Emily,

Thanks for the response. 

I read the comments on ARIES-832 about having a less eager way of looking up the datasource and it may help (if its something we can control. I was under the impression that this had to do with the persistence provider).

In any case, I feel that if for any reason, we fail to create emf when reaching resolved state, we should do a clean up, so that the creation can be also attempted when the bundle gets started. This is what the patch actually does and maybe its a good idea to apply it anyway.

Thoughts?


                
> IllegalStateException when the peristence bundle gets resolved.
> ---------------------------------------------------------------
>
>                 Key: ARIES-933
>                 URL: https://issues.apache.org/jira/browse/ARIES-933
>             Project: Aries
>          Issue Type: Bug
>          Components: JPA
>    Affects Versions: 0.3, 1.0
>            Reporter: Ioannis Canellos
>         Attachments: ARIES-933.patch
>
>
> Aries JPA tries to create the entity manager factories when the persistence bundle gets in resolved state.
> With some persistence providers this can cause issues. For example Hibernate will try to access the datasource via jndi when creating the EMF, causing the IllegalStateException due to the fact that the persistnce bundle still has not context (is in resolved state).
> Even worse it will leave the EntityManagerFactoryManager is a wrong state, preventing it to create the EMF when the bundle is created.
> There are two ways of approaching this issue:
> i) Don't try to create EMF when the persistence bundle gets resolved.
> ii) Catch possible errors and cleanup, so that EMF can be created when the bundle gets started.
> I am going to attach a patch for the first appraoch, unless there is a good way for creating EMF when the bundle gets resolved.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira