You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@aries.apache.org by "Christian Schneider (JIRA)" <ji...@apache.org> on 2015/02/25 14:08:04 UTC

[jira] [Updated] (ARIES-1270) ClasscastException or incompatible type when persistence unit bundle is refreshed

     [ https://issues.apache.org/jira/browse/ARIES-1270?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Christian Schneider updated ARIES-1270:
---------------------------------------
    Description: 
How to reproduce:
Follow installation instructions of my tasklist-cdi tutorial
https://github.com/cschneider/Karaf-Tutorial/tree/master/tasklist-blueprint-cdi
- After installation the example works
- refresh net.lr.tasklist.cdi.tasklist-model
- When accessing http://localhost:8181/tasklist you get the exception below
- After a restart of karaf it works again

So the problem seems to be that with a refresh you get a new classloader for the model bundle but the persistence unit (EnityManagerFactory) is not renewed so it still uses the old classloader.

I am not yet sure if the problem is in jpa.container or jpa.container.context.

I will try to recreate this error in an itest for jpa so we can track it easily.

---
java.lang.IllegalArgumentException: Type specified for TypedQuery [net.lr.tasklist.model.Task] is incompatible with query return type [class net.lr.tasklist.model.Task]
	at org.hibernate.ejb.AbstractEntityManagerImpl.resultClassChecking(AbstractEntityManagerImpl.java:702)
	at org.hibernate.ejb.AbstractEntityManagerImpl.createQuery(AbstractEntityManagerImpl.java:303)
	at 


  was:
How to reproduce:
Follow installation instructions of my tasklist-cdi tutorial
https://github.com/cschneider/Karaf-Tutorial/tree/master/tasklist-cdi
- After installation the example work
- refresh net.lr.tasklist.cdi.tasklist-model
- When accessing http://localhost:8181/tasklist you get the exception below
- After a restart of karaf it works again

So the problem seems to be that with a refresh you get a new classloader for the model bundle but the persistence unit (EnityManagerFactory) is not renewed so it still uses the old classloader.

I am not yet sure if the problem is in jpa.container or jpa.container.context.

I will try to recreate this error in an itest for jpa so we can track it easily.

---
java.lang.IllegalArgumentException: Type specified for TypedQuery [net.lr.tasklist.model.Task] is incompatible with query return type [class net.lr.tasklist.model.Task]
	at org.hibernate.ejb.AbstractEntityManagerImpl.resultClassChecking(AbstractEntityManagerImpl.java:702)
	at org.hibernate.ejb.AbstractEntityManagerImpl.createQuery(AbstractEntityManagerImpl.java:303)
	at 



> ClasscastException or incompatible type when persistence unit bundle is refreshed
> ---------------------------------------------------------------------------------
>
>                 Key: ARIES-1270
>                 URL: https://issues.apache.org/jira/browse/ARIES-1270
>             Project: Aries
>          Issue Type: Bug
>          Components: JPA
>    Affects Versions: jpa-container-1.0.2, jpa-container-context-1.0.4, jpa-container-context-1.0.3
>            Reporter: Christian Schneider
>            Assignee: Christian Schneider
>            Priority: Critical
>             Fix For: jpa-container-1.0.3, jpa-container-context-1.0.5
>
>
> How to reproduce:
> Follow installation instructions of my tasklist-cdi tutorial
> https://github.com/cschneider/Karaf-Tutorial/tree/master/tasklist-blueprint-cdi
> - After installation the example works
> - refresh net.lr.tasklist.cdi.tasklist-model
> - When accessing http://localhost:8181/tasklist you get the exception below
> - After a restart of karaf it works again
> So the problem seems to be that with a refresh you get a new classloader for the model bundle but the persistence unit (EnityManagerFactory) is not renewed so it still uses the old classloader.
> I am not yet sure if the problem is in jpa.container or jpa.container.context.
> I will try to recreate this error in an itest for jpa so we can track it easily.
> ---
> java.lang.IllegalArgumentException: Type specified for TypedQuery [net.lr.tasklist.model.Task] is incompatible with query return type [class net.lr.tasklist.model.Task]
> 	at org.hibernate.ejb.AbstractEntityManagerImpl.resultClassChecking(AbstractEntityManagerImpl.java:702)
> 	at org.hibernate.ejb.AbstractEntityManagerImpl.createQuery(AbstractEntityManagerImpl.java:303)
> 	at 



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)