java.lang.ClassCastException

Hibernate JIRA | Henri ter Steeg | 1 decade ago
tip
Click on the to mark the solution that helps you, Samebug will learn from it.
As a community member, you’ll be rewarded for you help.
  1. 0

    In one of my entity classes, I defined a String field 'aangesloten', together with a getter and a setter. Since this field represents a dutch type of yes/no field (Ja/Nee), I also added public boolean isAangesloten() This resulted in the stack trace below in Hibernate 2.1.2. I tried 2.1.4 as well and got the same error. I used a workaround, and renamed the boolean function to: public boolean aangesloten() BTW: I really like your Hibernate! Here's the stacktrace: org.springframework.beans.FatalBeanException: Could not instantiate class [nl.linkit.projects.sfdc.td.swing.ApparatuurOverzichtPanel]; constructor threw exception; nested exception is java.lang.ClassCastException: null java.lang.ClassCastException at net.sf.hibernate.type.StringType.toString(StringType.java:47) at net.sf.hibernate.type.NullableType.toString(NullableType.java:78) at net.sf.hibernate.impl.Printer.toString(Printer.java:49) at net.sf.hibernate.impl.Printer.toString(Printer.java:82) at net.sf.hibernate.impl.SessionImpl.flushEverything(SessionImpl.java:2245) at net.sf.hibernate.impl.SessionImpl.autoFlushIfRequired(SessionImpl.java:1769) at net.sf.hibernate.impl.SessionImpl.getQueries(SessionImpl.java:1536) at net.sf.hibernate.impl.SessionImpl.find(SessionImpl.java:1501) at net.sf.hibernate.impl.SessionImpl.find(SessionImpl.java:1491) at nl.linkit.projects.sfdc.db2.SynchronizedSession.find(SynchronizedSession.java:66) at nl.linkit.projects.sfdc.db2.ApparaatDaoHib.findStoringen(ApparaatDaoHib.java:44) at nl.linkit.projects.sfdc.manager2.ApparaatManager.findRecenteStoringen(ApparaatManager.java:58) at nl.linkit.projects.sfdc.manager2.ApparaatManager.refreshStoringen(ApparaatManager.java:62) at nl.linkit.projects.sfdc.manager2.ApparaatManager.<init>(ApparaatManager.java:43) at nl.linkit.projects.sfdc.manager2.ApparaatManagerFactory.getApparaatManager(ApparaatManagerFactory.java:31) at nl.linkit.projects.sfdc.td.swing.ApparaatStatusPanelFactory.getApparaatStatusPanel(ApparaatStatusPanelFactory.java:24) at nl.linkit.projects.sfdc.td.swing.ApparatuurOverzichtPanel.<init>(ApparatuurOverzichtPanel.java:65) at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source) at java.lang.reflect.Constructor.newInstance(Unknown Source) at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:66) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireConstructor(AbstractAutowireCapableBeanFactory.java:395) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:214) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:177) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:159) at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:183) at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:268) at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:58) at nl.linkit.projects.sfdc.td.TdConsole.main(TdConsole.java:16) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at com.sun.javaws.Launcher.executeApplication(Unknown Source) at com.sun.javaws.Launcher.executeMainClass(Unknown Source) at com.sun.javaws.Launcher.continueLaunch(Unknown Source) at com.sun.javaws.Launcher.handleApplicationDesc(Unknown Source) at com.sun.javaws.Launcher.handleLaunchFile(Unknown Source) at com.sun.javaws.Launcher.run(Unknown Source) at java.lang.Thread.run(Unknown Source)

    Hibernate JIRA | 1 decade ago | Henri ter Steeg
    java.lang.ClassCastException
  2. 0

    In one of my entity classes, I defined a String field 'aangesloten', together with a getter and a setter. Since this field represents a dutch type of yes/no field (Ja/Nee), I also added public boolean isAangesloten() This resulted in the stack trace below in Hibernate 2.1.2. I tried 2.1.4 as well and got the same error. I used a workaround, and renamed the boolean function to: public boolean aangesloten() BTW: I really like your Hibernate! Here's the stacktrace: org.springframework.beans.FatalBeanException: Could not instantiate class [nl.linkit.projects.sfdc.td.swing.ApparatuurOverzichtPanel]; constructor threw exception; nested exception is java.lang.ClassCastException: null java.lang.ClassCastException at net.sf.hibernate.type.StringType.toString(StringType.java:47) at net.sf.hibernate.type.NullableType.toString(NullableType.java:78) at net.sf.hibernate.impl.Printer.toString(Printer.java:49) at net.sf.hibernate.impl.Printer.toString(Printer.java:82) at net.sf.hibernate.impl.SessionImpl.flushEverything(SessionImpl.java:2245) at net.sf.hibernate.impl.SessionImpl.autoFlushIfRequired(SessionImpl.java:1769) at net.sf.hibernate.impl.SessionImpl.getQueries(SessionImpl.java:1536) at net.sf.hibernate.impl.SessionImpl.find(SessionImpl.java:1501) at net.sf.hibernate.impl.SessionImpl.find(SessionImpl.java:1491) at nl.linkit.projects.sfdc.db2.SynchronizedSession.find(SynchronizedSession.java:66) at nl.linkit.projects.sfdc.db2.ApparaatDaoHib.findStoringen(ApparaatDaoHib.java:44) at nl.linkit.projects.sfdc.manager2.ApparaatManager.findRecenteStoringen(ApparaatManager.java:58) at nl.linkit.projects.sfdc.manager2.ApparaatManager.refreshStoringen(ApparaatManager.java:62) at nl.linkit.projects.sfdc.manager2.ApparaatManager.<init>(ApparaatManager.java:43) at nl.linkit.projects.sfdc.manager2.ApparaatManagerFactory.getApparaatManager(ApparaatManagerFactory.java:31) at nl.linkit.projects.sfdc.td.swing.ApparaatStatusPanelFactory.getApparaatStatusPanel(ApparaatStatusPanelFactory.java:24) at nl.linkit.projects.sfdc.td.swing.ApparatuurOverzichtPanel.<init>(ApparatuurOverzichtPanel.java:65) at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source) at java.lang.reflect.Constructor.newInstance(Unknown Source) at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:66) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireConstructor(AbstractAutowireCapableBeanFactory.java:395) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:214) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:177) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:159) at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:183) at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:268) at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:58) at nl.linkit.projects.sfdc.td.TdConsole.main(TdConsole.java:16) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at com.sun.javaws.Launcher.executeApplication(Unknown Source) at com.sun.javaws.Launcher.executeMainClass(Unknown Source) at com.sun.javaws.Launcher.continueLaunch(Unknown Source) at com.sun.javaws.Launcher.handleApplicationDesc(Unknown Source) at com.sun.javaws.Launcher.handleLaunchFile(Unknown Source) at com.sun.javaws.Launcher.run(Unknown Source) at java.lang.Thread.run(Unknown Source)

    Hibernate JIRA | 1 decade ago | Henri ter Steeg
    java.lang.ClassCastException

    Root Cause Analysis

    1. java.lang.ClassCastException

      No message provided

      at net.sf.hibernate.type.StringType.toString()
    2. net.sf.hibernate
      SessionImpl.find
      1. net.sf.hibernate.type.StringType.toString(StringType.java:47)
      2. net.sf.hibernate.type.NullableType.toString(NullableType.java:78)
      3. net.sf.hibernate.impl.Printer.toString(Printer.java:49)
      4. net.sf.hibernate.impl.Printer.toString(Printer.java:82)
      5. net.sf.hibernate.impl.SessionImpl.flushEverything(SessionImpl.java:2245)
      6. net.sf.hibernate.impl.SessionImpl.autoFlushIfRequired(SessionImpl.java:1769)
      7. net.sf.hibernate.impl.SessionImpl.getQueries(SessionImpl.java:1536)
      8. net.sf.hibernate.impl.SessionImpl.find(SessionImpl.java:1501)
      9. net.sf.hibernate.impl.SessionImpl.find(SessionImpl.java:1491)
      9 frames
    3. nl.linkit.projects
      ApparatuurOverzichtPanel.<init>
      1. nl.linkit.projects.sfdc.db2.SynchronizedSession.find(SynchronizedSession.java:66)
      2. nl.linkit.projects.sfdc.db2.ApparaatDaoHib.findStoringen(ApparaatDaoHib.java:44)
      3. nl.linkit.projects.sfdc.manager2.ApparaatManager.findRecenteStoringen(ApparaatManager.java:58)
      4. nl.linkit.projects.sfdc.manager2.ApparaatManager.refreshStoringen(ApparaatManager.java:62)
      5. nl.linkit.projects.sfdc.manager2.ApparaatManager.<init>(ApparaatManager.java:43)
      6. nl.linkit.projects.sfdc.manager2.ApparaatManagerFactory.getApparaatManager(ApparaatManagerFactory.java:31)
      7. nl.linkit.projects.sfdc.td.swing.ApparaatStatusPanelFactory.getApparaatStatusPanel(ApparaatStatusPanelFactory.java:24)
      8. nl.linkit.projects.sfdc.td.swing.ApparatuurOverzichtPanel.<init>(ApparatuurOverzichtPanel.java:65)
      8 frames
    4. Java RT
      Constructor.newInstance
      1. sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
      2. sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
      3. sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
      4. java.lang.reflect.Constructor.newInstance(Unknown Source)
      4 frames
    5. Spring Beans
      DefaultListableBeanFactory.preInstantiateSingletons
      1. org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:66)
      2. org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireConstructor(AbstractAutowireCapableBeanFactory.java:395)
      3. org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:214)
      4. org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:177)
      5. org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:159)
      6. org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:183)
      6 frames
    6. Spring Context
      ClassPathXmlApplicationContext.<init>
      1. org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:268)
      2. org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:58)
      2 frames
    7. nl.linkit.projects
      TdConsole.main
      1. nl.linkit.projects.sfdc.td.TdConsole.main(TdConsole.java:16)
      1 frame
    8. Java RT
      Method.invoke
      1. sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      2. sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
      3. sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
      4. java.lang.reflect.Method.invoke(Unknown Source)
      4 frames
    9. com.sun.javaws
      Launcher.run
      1. com.sun.javaws.Launcher.executeApplication(Unknown Source)
      2. com.sun.javaws.Launcher.executeMainClass(Unknown Source)
      3. com.sun.javaws.Launcher.continueLaunch(Unknown Source)
      4. com.sun.javaws.Launcher.handleApplicationDesc(Unknown Source)
      5. com.sun.javaws.Launcher.handleLaunchFile(Unknown Source)
      6. com.sun.javaws.Launcher.run(Unknown Source)
      6 frames
    10. Java RT
      Thread.run
      1. java.lang.Thread.run(Unknown Source)
      1 frame