Uploaded image for project: 'Aries'
  1. Aries
  2. ARIES-1270

ClasscastException or incompatible type when persistence unit bundle is refreshed

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Critical
    • Resolution: Fixed
    • jpa-container-1.0.2, jpa-container-context-1.0.4, jpa-container-context-1.0.3
    • jpa-2.0.0
    • JPA
    • None

    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

      Attachments

        Activity

          People

            cschneider Christian Schneider
            cschneider Christian Schneider
            Votes:
            2 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: