You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomee.apache.org by dave <d....@alchemy.co.nz> on 2015/06/11 06:46:57 UTC

OpenJPA exception when running different versions of application under TomEE

Hi,

we are encountering an OpenJPA problem when running two different versions
of the same web application under one instance of TomEE (version 1.7.2). The
problem only occurs when persistent fields have been added to a JPA entity
class in one version of the application but not in the other. When
attempting to access the entity in the application instance that has the
additional fields we receive an error saying one of the fields cannot be
found.

The underlying exception is:

Caused by: java.lang.IllegalArgumentException: Attribute "referrerCellPhone"
of any not found in xxx.domain.Case
        at
org.apache.openjpa.persistence.meta.AbstractManagedType.notFoundException(AbstractManagedType.java:741)
        at
org.apache.openjpa.persistence.meta.AbstractManagedType.getAttribute(AbstractManagedType.java:244)
        at
org.apache.openjpa.persistence.meta.AbstractManagedType.getAttribute(AbstractManagedType.java:468)
        at
org.apache.openjpa.persistence.meta.MetamodelImpl.populate(MetamodelImpl.java:339)
        ... 84 more

The applications run fine individually and also when deploying the version
that has a superset of the fields prior to deploying the one with a subset
of fields. Deploying them in the reverse order causes the above exception
however.

We have traced this in a debugger and it seems to be related to the field
meta data classes being cached from the first deployed instance of the
application and these cached classes being used when attempting to get the
attribute in the other application instance. The entity classes themselves
seem to be correct, but not the meta data.

Are there any known issues with application isolation with OpenJPA under
TomEE?

Thanks,
Dave



--
View this message in context: http://tomee-openejb.979440.n4.nabble.com/OpenJPA-exception-when-running-different-versions-of-application-under-TomEE-tp4675258.html
Sent from the TomEE Users mailing list archive at Nabble.com.

Re: OpenJPA exception when running different versions of application under TomEE

Posted by dave <d....@alchemy.co.nz>.
Hi Romain,

I haven't succeeded in reproducing this bug in a standalone project yet - I
will keep trying to pin this down.

In the meantime we have switched to build time enhancement as you suggest
and no longer have the issue for our application.

Regards,
Dave



--
View this message in context: http://tomee-openejb.979440.n4.nabble.com/OpenJPA-exception-when-running-different-versions-of-application-under-TomEE-tp4675258p4675286.html
Sent from the TomEE Users mailing list archive at Nabble.com.

Re: OpenJPA exception when running different versions of application under TomEE

Posted by Romain Manni-Bucau <rm...@gmail.com>.
2015-06-11 7:38 GMT+02:00 dave <d....@alchemy.co.nz>:

> Hi Romain,
>
> thanks for the quick response! I'll need to set up a minimal sample
> application that I can share - will get one underway.
>
> Looks like it may be related to runtime enhancement - I tried running
> manually enhancing the classes for both applications via PCEnhancer and the
> error didn't occur when running TomEE.
>
>
yes build time enhancement is recommanded, runtime enhancement should work
as well if you dont use openjpa as javaagent but openejb-javaagent (our
default). If you share a project we can check what is happening.

Side note: putting persistence.xml in WEB-INF and not META-INF will make it
not visible from the javaagent, maybe something to quickly test.


> Regards,
> Dave
>
>
>
> --
> View this message in context:
> http://tomee-openejb.979440.n4.nabble.com/OpenJPA-exception-when-running-different-versions-of-application-under-TomEE-tp4675258p4675260.html
> Sent from the TomEE Users mailing list archive at Nabble.com.
>

Re: OpenJPA exception when running different versions of application under TomEE

Posted by dave <d....@alchemy.co.nz>.
Hi Romain,

thanks for the quick response! I'll need to set up a minimal sample
application that I can share - will get one underway.

Looks like it may be related to runtime enhancement - I tried running
manually enhancing the classes for both applications via PCEnhancer and the
error didn't occur when running TomEE.

Regards,
Dave



--
View this message in context: http://tomee-openejb.979440.n4.nabble.com/OpenJPA-exception-when-running-different-versions-of-application-under-TomEE-tp4675258p4675260.html
Sent from the TomEE Users mailing list archive at Nabble.com.

Re: OpenJPA exception when running different versions of application under TomEE

Posted by Romain Manni-Bucau <rm...@gmail.com>.
Hi

it shouldnt leak if you use 2 different EntityManagerFactories.

Can you share a project with tomee-maven-plugin sets up to reproduce it on
a public repository?


Romain Manni-Bucau
@rmannibucau <https://twitter.com/rmannibucau> |  Blog
<http://rmannibucau.wordpress.com> | Github <https://github.com/rmannibucau> |
LinkedIn <https://www.linkedin.com/in/rmannibucau> | Tomitriber
<http://www.tomitribe.com>

2015-06-11 6:46 GMT+02:00 dave <d....@alchemy.co.nz>:

> Hi,
>
> we are encountering an OpenJPA problem when running two different versions
> of the same web application under one instance of TomEE (version 1.7.2).
> The
> problem only occurs when persistent fields have been added to a JPA entity
> class in one version of the application but not in the other. When
> attempting to access the entity in the application instance that has the
> additional fields we receive an error saying one of the fields cannot be
> found.
>
> The underlying exception is:
>
> Caused by: java.lang.IllegalArgumentException: Attribute
> "referrerCellPhone"
> of any not found in xxx.domain.Case
>         at
>
> org.apache.openjpa.persistence.meta.AbstractManagedType.notFoundException(AbstractManagedType.java:741)
>         at
>
> org.apache.openjpa.persistence.meta.AbstractManagedType.getAttribute(AbstractManagedType.java:244)
>         at
>
> org.apache.openjpa.persistence.meta.AbstractManagedType.getAttribute(AbstractManagedType.java:468)
>         at
>
> org.apache.openjpa.persistence.meta.MetamodelImpl.populate(MetamodelImpl.java:339)
>         ... 84 more
>
> The applications run fine individually and also when deploying the version
> that has a superset of the fields prior to deploying the one with a subset
> of fields. Deploying them in the reverse order causes the above exception
> however.
>
> We have traced this in a debugger and it seems to be related to the field
> meta data classes being cached from the first deployed instance of the
> application and these cached classes being used when attempting to get the
> attribute in the other application instance. The entity classes themselves
> seem to be correct, but not the meta data.
>
> Are there any known issues with application isolation with OpenJPA under
> TomEE?
>
> Thanks,
> Dave
>
>
>
> --
> View this message in context:
> http://tomee-openejb.979440.n4.nabble.com/OpenJPA-exception-when-running-different-versions-of-application-under-TomEE-tp4675258.html
> Sent from the TomEE Users mailing list archive at Nabble.com.
>