java.lang.ClassCastException

There are no available Samebug tips for this exception. Do you have an idea how to solve this issue? A short tip would help users who saw this issue last week.

  • 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)
    via by Henri ter Steeg,
  • 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)
    via by Henri ter Steeg,
    • 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)
    No Bugmate found.