javax.persistence.PersistenceException: java.lang.ClassCastException: java.lang.String

Hibernate JIRA | Max Rydahl Andersen | 1 decade ago
  1. 0

    Doing this: Map overrides = new HashMap(); overrides.put("javax.persistence.transactionType", "RESOURCE_LOCAL"); Ejb3Configuration ejb3cfg = new Ejb3Configuration(); ejb3cfg.createEntityManagerFactory(null, overrides); result in class cast exception: C:\work\os\hibernate\HibernateExt\tools\src\testsupport\anttest-build.xml:205: javax.persistence.PersistenceException: java.lang.ClassCastException: java.lang.String at org.hibernate.tool.ant.HibernateToolTask.reportException(HibernateToolTask.java:184) at org.hibernate.tool.ant.HibernateToolTask.execute(HibernateToolTask.java:154) at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:275) at org.apache.tools.ant.Task.perform(Task.java:364) at org.apache.tools.ant.Target.execute(Target.java:341) at org.apache.tools.ant.Target.performTasks(Target.java:369) at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1216) at org.apache.tools.ant.Project.executeTarget(Project.java:1185) at org.hibernate.tool.ant.BuildFileTestCase.executeTarget(BuildFileTestCase.java:241) at org.hibernate.tool.ant.HibernateToolTest.testEJB3ConfigurationFailureExpected(HibernateToolTest.java:65) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:585) at junit.framework.TestCase.runTest(TestCase.java:154) at junit.framework.TestCase.runBare(TestCase.java:127) at junit.framework.TestResult$1.protect(TestResult.java:106) at junit.framework.TestResult.runProtected(TestResult.java:124) at junit.framework.TestResult.run(TestResult.java:109) at junit.framework.TestCase.run(TestCase.java:118) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:478) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:344) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196) Caused by: javax.persistence.PersistenceException: java.lang.ClassCastException: java.lang.String at org.hibernate.ejb.Ejb3Configuration.createEntityManagerFactory(Ejb3Configuration.java:188) at org.hibernate.tool.ant.EJB3ConfigurationTask.createConfiguration(EJB3ConfigurationTask.java:23) at org.hibernate.tool.ant.ConfigurationTask.getConfiguration(ConfigurationTask.java:54) at org.hibernate.tool.ant.HibernateToolTask.getConfiguration(HibernateToolTask.java:216) at org.hibernate.tool.ant.Hbm2DDLExporterTask.execute(Hbm2DDLExporterTask.java:45) at org.hibernate.tool.ant.HibernateToolTask.execute(HibernateToolTask.java:151) ... 21 more Caused by: java.lang.ClassCastException: java.lang.String at org.hibernate.ejb.packaging.PersistenceXmlLoader.deploy(PersistenceXmlLoader.java:101) at org.hibernate.ejb.Ejb3Configuration.createEntityManagerFactory(Ejb3Configuration.java:150) ... 26 more --- Nested Exception --- javax.persistence.PersistenceException: java.lang.ClassCastException: java.lang.String at org.hibernate.ejb.Ejb3Configuration.createEntityManagerFactory(Ejb3Configuration.java:188) at org.hibernate.tool.ant.EJB3ConfigurationTask.createConfiguration(EJB3ConfigurationTask.java:23) at org.hibernate.tool.ant.ConfigurationTask.getConfiguration(ConfigurationTask.java:54) at org.hibernate.tool.ant.HibernateToolTask.getConfiguration(HibernateToolTask.java:216) at org.hibernate.tool.ant.Hbm2DDLExporterTask.execute(Hbm2DDLExporterTask.java:45) at org.hibernate.tool.ant.HibernateToolTask.execute(HibernateToolTask.java:151) at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:275) at org.apache.tools.ant.Task.perform(Task.java:364) at org.apache.tools.ant.Target.execute(Target.java:341) at org.apache.tools.ant.Target.performTasks(Target.java:369) at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1216) at org.apache.tools.ant.Project.executeTarget(Project.java:1185) at org.hibernate.tool.ant.BuildFileTestCase.executeTarget(BuildFileTestCase.java:241) at org.hibernate.tool.ant.HibernateToolTest.testEJB3ConfigurationFailureExpected(HibernateToolTest.java:65) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:585) at junit.framework.TestCase.runTest(TestCase.java:154) at junit.framework.TestCase.runBare(TestCase.java:127) at junit.framework.TestResult$1.protect(TestResult.java:106) at junit.framework.TestResult.runProtected(TestResult.java:124) at junit.framework.TestResult.run(TestResult.java:109) at junit.framework.TestCase.run(TestCase.java:118) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:478) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:344) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196) Caused by: java.lang.ClassCastException: java.lang.String at org.hibernate.ejb.packaging.PersistenceXmlLoader.deploy(PersistenceXmlLoader.java:101) at org.hibernate.ejb.Ejb3Configuration.createEntityManagerFactory(Ejb3Configuration.java:150) ... 26 more for some reason the for loop expects Map.Entry from a keyset ....?

    Hibernate JIRA | 1 decade ago | Max Rydahl Andersen
    javax.persistence.PersistenceException: java.lang.ClassCastException: java.lang.String
  2. 0

    Doing this: Map overrides = new HashMap(); overrides.put("javax.persistence.transactionType", "RESOURCE_LOCAL"); Ejb3Configuration ejb3cfg = new Ejb3Configuration(); ejb3cfg.createEntityManagerFactory(null, overrides); result in class cast exception: C:\work\os\hibernate\HibernateExt\tools\src\testsupport\anttest-build.xml:205: javax.persistence.PersistenceException: java.lang.ClassCastException: java.lang.String at org.hibernate.tool.ant.HibernateToolTask.reportException(HibernateToolTask.java:184) at org.hibernate.tool.ant.HibernateToolTask.execute(HibernateToolTask.java:154) at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:275) at org.apache.tools.ant.Task.perform(Task.java:364) at org.apache.tools.ant.Target.execute(Target.java:341) at org.apache.tools.ant.Target.performTasks(Target.java:369) at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1216) at org.apache.tools.ant.Project.executeTarget(Project.java:1185) at org.hibernate.tool.ant.BuildFileTestCase.executeTarget(BuildFileTestCase.java:241) at org.hibernate.tool.ant.HibernateToolTest.testEJB3ConfigurationFailureExpected(HibernateToolTest.java:65) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:585) at junit.framework.TestCase.runTest(TestCase.java:154) at junit.framework.TestCase.runBare(TestCase.java:127) at junit.framework.TestResult$1.protect(TestResult.java:106) at junit.framework.TestResult.runProtected(TestResult.java:124) at junit.framework.TestResult.run(TestResult.java:109) at junit.framework.TestCase.run(TestCase.java:118) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:478) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:344) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196) Caused by: javax.persistence.PersistenceException: java.lang.ClassCastException: java.lang.String at org.hibernate.ejb.Ejb3Configuration.createEntityManagerFactory(Ejb3Configuration.java:188) at org.hibernate.tool.ant.EJB3ConfigurationTask.createConfiguration(EJB3ConfigurationTask.java:23) at org.hibernate.tool.ant.ConfigurationTask.getConfiguration(ConfigurationTask.java:54) at org.hibernate.tool.ant.HibernateToolTask.getConfiguration(HibernateToolTask.java:216) at org.hibernate.tool.ant.Hbm2DDLExporterTask.execute(Hbm2DDLExporterTask.java:45) at org.hibernate.tool.ant.HibernateToolTask.execute(HibernateToolTask.java:151) ... 21 more Caused by: java.lang.ClassCastException: java.lang.String at org.hibernate.ejb.packaging.PersistenceXmlLoader.deploy(PersistenceXmlLoader.java:101) at org.hibernate.ejb.Ejb3Configuration.createEntityManagerFactory(Ejb3Configuration.java:150) ... 26 more --- Nested Exception --- javax.persistence.PersistenceException: java.lang.ClassCastException: java.lang.String at org.hibernate.ejb.Ejb3Configuration.createEntityManagerFactory(Ejb3Configuration.java:188) at org.hibernate.tool.ant.EJB3ConfigurationTask.createConfiguration(EJB3ConfigurationTask.java:23) at org.hibernate.tool.ant.ConfigurationTask.getConfiguration(ConfigurationTask.java:54) at org.hibernate.tool.ant.HibernateToolTask.getConfiguration(HibernateToolTask.java:216) at org.hibernate.tool.ant.Hbm2DDLExporterTask.execute(Hbm2DDLExporterTask.java:45) at org.hibernate.tool.ant.HibernateToolTask.execute(HibernateToolTask.java:151) at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:275) at org.apache.tools.ant.Task.perform(Task.java:364) at org.apache.tools.ant.Target.execute(Target.java:341) at org.apache.tools.ant.Target.performTasks(Target.java:369) at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1216) at org.apache.tools.ant.Project.executeTarget(Project.java:1185) at org.hibernate.tool.ant.BuildFileTestCase.executeTarget(BuildFileTestCase.java:241) at org.hibernate.tool.ant.HibernateToolTest.testEJB3ConfigurationFailureExpected(HibernateToolTest.java:65) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:585) at junit.framework.TestCase.runTest(TestCase.java:154) at junit.framework.TestCase.runBare(TestCase.java:127) at junit.framework.TestResult$1.protect(TestResult.java:106) at junit.framework.TestResult.runProtected(TestResult.java:124) at junit.framework.TestResult.run(TestResult.java:109) at junit.framework.TestCase.run(TestCase.java:118) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:478) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:344) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196) Caused by: java.lang.ClassCastException: java.lang.String at org.hibernate.ejb.packaging.PersistenceXmlLoader.deploy(PersistenceXmlLoader.java:101) at org.hibernate.ejb.Ejb3Configuration.createEntityManagerFactory(Ejb3Configuration.java:150) ... 26 more for some reason the for loop expects Map.Entry from a keyset ....?

    Hibernate JIRA | 1 decade ago | Max Rydahl Andersen
    javax.persistence.PersistenceException: java.lang.ClassCastException: java.lang.String
  3. 0

    Vector and AbstractTableModel

    Oracle Community | 1 decade ago | 843805
    java.lang.ClassCastException: java.lang.String
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0

    get the row id of an spinner item populated from database

    Stack Overflow | 4 years ago | user1381760
    java.lang.ClassCastException: java.lang.String
  6. 0

    How to upload Byte array (image) on facebook wall with android application?

    Stack Overflow | 4 years ago | TKumar
    java.lang.ClassCastException: java.lang.String

    Not finding the right solution?
    Take a tour to get the most out of Samebug.

    Tired of useless tips?

    Automated exception search integrated into your IDE

    Root Cause Analysis

    1. java.lang.ClassCastException

      java.lang.String

      at org.hibernate.ejb.packaging.PersistenceXmlLoader.deploy()
    2. Hibernate EJB
      Ejb3Configuration.createEntityManagerFactory
      1. org.hibernate.ejb.packaging.PersistenceXmlLoader.deploy(PersistenceXmlLoader.java:101)
      2. org.hibernate.ejb.Ejb3Configuration.createEntityManagerFactory(Ejb3Configuration.java:150)
      2 frames
    3. A Hibernate O/RM Module
      HibernateToolTask.execute
      1. org.hibernate.tool.ant.EJB3ConfigurationTask.createConfiguration(EJB3ConfigurationTask.java:23)
      2. org.hibernate.tool.ant.ConfigurationTask.getConfiguration(ConfigurationTask.java:54)
      3. org.hibernate.tool.ant.HibernateToolTask.getConfiguration(HibernateToolTask.java:216)
      4. org.hibernate.tool.ant.Hbm2DDLExporterTask.execute(Hbm2DDLExporterTask.java:45)
      5. org.hibernate.tool.ant.HibernateToolTask.execute(HibernateToolTask.java:151)
      5 frames
    4. Ant
      Project.executeTarget
      1. org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:275)
      2. org.apache.tools.ant.Task.perform(Task.java:364)
      3. org.apache.tools.ant.Target.execute(Target.java:341)
      4. org.apache.tools.ant.Target.performTasks(Target.java:369)
      5. org.apache.tools.ant.Project.executeSortedTargets(Project.java:1216)
      6. org.apache.tools.ant.Project.executeTarget(Project.java:1185)
      6 frames
    5. A Hibernate O/RM Module
      HibernateToolTest.testEJB3ConfigurationFailureExpected
      1. org.hibernate.tool.ant.BuildFileTestCase.executeTarget(BuildFileTestCase.java:241)
      2. org.hibernate.tool.ant.HibernateToolTest.testEJB3ConfigurationFailureExpected(HibernateToolTest.java:65)
      2 frames
    6. Java RT
      Method.invoke
      1. sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      2. sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      3. sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      4. java.lang.reflect.Method.invoke(Method.java:585)
      4 frames
    7. JUnit
      TestCase.run
      1. junit.framework.TestCase.runTest(TestCase.java:154)
      2. junit.framework.TestCase.runBare(TestCase.java:127)
      3. junit.framework.TestResult$1.protect(TestResult.java:106)
      4. junit.framework.TestResult.runProtected(TestResult.java:124)
      5. junit.framework.TestResult.run(TestResult.java:109)
      6. junit.framework.TestCase.run(TestCase.java:118)
      6 frames
    8. JUnit3 Runner
      RemoteTestRunner.main
      1. org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:478)
      2. org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:344)
      3. org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)
      3 frames