Christian Schneider created ARIES-1270:
------------------------------------------
Summary: 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-context-1.0.3, jpa-container-1.0.2,
jpa-container-context-1.0.4
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-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
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)