java.lang.ClassCastException: com.example.dao.settings.SystemSettingEntity cannot be cast to com.example.dao.settings.SystemSettingEntity 2) If I remove Spring's entityManagerFactory bean from the applicationContext.xml configuration file, and change my DAO to load the entity manager itself, then I don't have any problems: entityManagerFactory = Persistence.createEntityManagerFactory("TestPU"); entityManager = entityManagerFactory.createEntityManager(); 3) If I put the code and config file back to the way it was, and change the Load Time Weaver to the one designed for GlassFish, then GlassFish's EJBClassLoader gets involved and throws an exception stating that it can't find the entity class specified in my persistence.xml Caused by: java.lang.ClassNotFoundException: com.example.dao.SystemSettingEntity

Oracle Community | 392 Guest | 9 years ago
tip
Your exception is missing from the Samebug knowledge base.
Here are the best solutions we found on the Internet.
Click on the to mark the helpful solution and get rewards for you help.
  1. 0

    ClassCastException when using JPA result

    Oracle Community | 9 years ago | 392 Guest
    java.lang.ClassCastException: com.example.dao.settings.SystemSettingEntity cannot be cast to com.example.dao.settings.SystemSettingEntity 2) If I remove Spring's entityManagerFactory bean from the applicationContext.xml configuration file, and change my DAO to load the entity manager itself, then I don't have any problems: entityManagerFactory = Persistence.createEntityManagerFactory("TestPU"); entityManager = entityManagerFactory.createEntityManager(); 3) If I put the code and config file back to the way it was, and change the Load Time Weaver to the one designed for GlassFish, then GlassFish's EJBClassLoader gets involved and throws an exception stating that it can't find the entity class specified in my persistence.xml Caused by: java.lang.ClassNotFoundException: com.example.dao.SystemSettingEntity

    Root Cause Analysis

    1. java.lang.ClassCastException

      com.example.dao.settings.SystemSettingEntity cannot be cast to com.example.dao.settings.SystemSettingEntity 2) If I remove Spring's entityManagerFactory bean from the applicationContext.xml configuration file, and change my DAO to load the entity manager itself, then I don't have any problems: entityManagerFactory = Persistence.createEntityManagerFactory("TestPU"); entityManager = entityManagerFactory.createEntityManager(); 3) If I put the code and config file back to the way it was, and change the Load Time Weaver to the one designed for GlassFish, then GlassFish's EJBClassLoader gets involved and throws an exception stating that it can't find the entity class specified in my persistence.xml Caused by: java.lang.ClassNotFoundException: com.example.dao.SystemSettingEntity

      at com.sun.enterprise.loader.EJBClassLoader.findClassData()
    2. Common Utilities
      EJBClassLoader.findClassData
      1. com.sun.enterprise.loader.EJBClassLoader.findClassData(EJBClassLoader.java:718)
      1 frame