java.lang.NullPointerException

Hibernate JIRA | Konstantin Sharenkov | 1 decade ago
  1. 0

    When I tryed to Implement Parametrized user type to support Native J2SE 5.0 Enums as VARCHAR. I randomply detect that I able to set 2 properties with the same name at one class. <?xml version="1.0"?> <!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD//EN" "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd"> <hibernate-mapping package="com.enterra.tth.po" > <typedef class="com.enterra.tth.po.NativeEnumType" name="ActorAttributeType"> <param name="enumClass">com.enterra.tth.po.ActorAttribute$Type</param> </typedef> <class name="ActorAttribute" table="t_actor_attribute" optimistic-lock="version" > <cache usage="read-write"/> <!-- Standrt part of mapping --> <id name="id" type="string" > <column name="f_id" sql-type="char(32)" not-null="true"/> <generator class="uuid.hex"/> </id> ... <property name="type" type="ActorAttributeType"> <column name="f_type" sql-type="varchar"/> </property> <property name="type" type="string"> <column name="f_value" sql-type="varchar"/> </property> </class> </hibernate-mapping> See property "type". Aclually getter and setter use com.enterra.tth.po.ActorAttribute$Type But both in background will use VARCHAR. As result I recieved class cast exception com.enterra.tth.po.ActorAttribute$Type to String. I think it will be better to disable duplicated properties. Or generate warning may be. Thanks. PS. After I update Hibernate 3 from cvs today and rebuild it I have started to recieve following exception. java.lang.NullPointerException at org.hibernate.tuple.PojoTuplizer.handleProperty(PojoTuplizer.java:82) at org.hibernate.tuple.AbstractTuplizer.<init>(AbstractTuplizer.java:77) at org.hibernate.tuple.PojoTuplizer.<init>(PojoTuplizer.java:53) at org.hibernate.tuple.TuplizerLookup.create(TuplizerLookup.java:45) at org.hibernate.tuple.EntityMetamodel.<init>(EntityMetamodel.java:202) at org.hibernate.persister.entity.BasicEntityPersister.<init>(BasicEntityPersister.java:398) at org.hibernate.persister.entity.SingleTableEntityPersister.<init>(SingleTableEntityPersister.java:104) at org.hibernate.persister.PersisterFactory.createClassPersister(PersisterFactory.java:55) at org.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:198) at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1043) Hope it will help you too.

    Hibernate JIRA | 1 decade ago | Konstantin Sharenkov
    java.lang.NullPointerException
  2. 0

    When I tryed to Implement Parametrized user type to support Native J2SE 5.0 Enums as VARCHAR. I randomply detect that I able to set 2 properties with the same name at one class. <?xml version="1.0"?> <!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD//EN" "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd"> <hibernate-mapping package="com.enterra.tth.po" > <typedef class="com.enterra.tth.po.NativeEnumType" name="ActorAttributeType"> <param name="enumClass">com.enterra.tth.po.ActorAttribute$Type</param> </typedef> <class name="ActorAttribute" table="t_actor_attribute" optimistic-lock="version" > <cache usage="read-write"/> <!-- Standrt part of mapping --> <id name="id" type="string" > <column name="f_id" sql-type="char(32)" not-null="true"/> <generator class="uuid.hex"/> </id> ... <property name="type" type="ActorAttributeType"> <column name="f_type" sql-type="varchar"/> </property> <property name="type" type="string"> <column name="f_value" sql-type="varchar"/> </property> </class> </hibernate-mapping> See property "type". Aclually getter and setter use com.enterra.tth.po.ActorAttribute$Type But both in background will use VARCHAR. As result I recieved class cast exception com.enterra.tth.po.ActorAttribute$Type to String. I think it will be better to disable duplicated properties. Or generate warning may be. Thanks. PS. After I update Hibernate 3 from cvs today and rebuild it I have started to recieve following exception. java.lang.NullPointerException at org.hibernate.tuple.PojoTuplizer.handleProperty(PojoTuplizer.java:82) at org.hibernate.tuple.AbstractTuplizer.<init>(AbstractTuplizer.java:77) at org.hibernate.tuple.PojoTuplizer.<init>(PojoTuplizer.java:53) at org.hibernate.tuple.TuplizerLookup.create(TuplizerLookup.java:45) at org.hibernate.tuple.EntityMetamodel.<init>(EntityMetamodel.java:202) at org.hibernate.persister.entity.BasicEntityPersister.<init>(BasicEntityPersister.java:398) at org.hibernate.persister.entity.SingleTableEntityPersister.<init>(SingleTableEntityPersister.java:104) at org.hibernate.persister.PersisterFactory.createClassPersister(PersisterFactory.java:55) at org.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:198) at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1043) Hope it will help you too.

    Hibernate JIRA | 1 decade ago | Konstantin Sharenkov
    java.lang.NullPointerException
  3. Speed up your debug routine!

    Automated exception search integrated into your IDE

  4. 0

    If an invalid proxy interface is specified for an object managed by hibernate, an NPE is raised. A more descriptive error would be nice :) Here's an example (invalid) mapping. The interface specified exists, but is in a different package: <hibernate-mapping > <class name="com.spider.scoreboard.hdao.impl.PerformanceChartHDao" table="performancecharts" proxy="com.spider.scoreboard.hdao.IPerformanceChart" dynamic-update="false" dynamic-insert="false" select-before-update="false" optimistic-lock="version" > <id name="id" column="performancechartid" type="java.lang.Integer" > <generator class="assigned"> <!-- To add non XDoclet generator parameters, create a file named hibernate-generator-params-PerformanceChartHDao.xml containing the additional parameters and place it in your merge dir. --> </generator> </id> <property name="name" type="java.lang.String" update="true" insert="true" access="property" column="performancechartname" /> <property name="backgroundImageId" type="java.lang.Integer" update="true" insert="true" access="property" column="backgroundimageid" /> <property name="zoomScale" type="java.lang.Double" update="true" insert="true" access="property" column="zoomscale" /> <set name="edges" lazy="true" inverse="true" cascade="all" sort="unsorted" > <key column="performancechartid" > </key> <one-to-many class="com.spider.scoreboard.hdao.impl.PerformanceChartEdgeHDao" /> </set> <set name="nodes" lazy="true" inverse="true" cascade="all" sort="unsorted" > <key column="performancechartid" > </key> <one-to-many class="com.spider.scoreboard.hdao.impl.PerformanceChartNodeHDao" /> </set> <!-- To add non XDoclet property mappings, create a file named hibernate-properties-PerformanceChartHDao.xml containing the additional properties and place it in your merge dir. --> </class> </hibernate-mapping> Here is the stack trace: ERROR (ScoreboardContextLoaderServlet:startupOrRestart) - Context initialization failed org.springframework.beans.factory.BeanCreationException: Error creating Hibernate SessionFactory FactoryBean; nested exception is java.lang.NullPointerException: null java.lang.NullPointerException at org.hibernate.tuple.PojoTuplizer.buildProxyFactory(PojoTuplizer.java:103) at org.hibernate.tuple.AbstractTuplizer.<init>(AbstractTuplizer.java:83) at org.hibernate.tuple.PojoTuplizer.<init>(PojoTuplizer.java:54) at org.hibernate.tuple.TuplizerLookup.create(TuplizerLookup.java:47) at org.hibernate.tuple.EntityMetamodel.<init>(EntityMetamodel.java:217) at org.hibernate.persister.entity.BasicEntityPersister.<init>(BasicEntityPersister.java:401) at org.hibernate.persister.entity.SingleTableEntityPersister.<init>(SingleTableEntityPersister.java:104) at org.hibernate.persister.PersisterFactory.createClassPersister(PersisterFactory.java:55) at org.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:206) at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1055) at org.springframework.orm.hibernate3.LocalSessionFactoryBean.newSessionFactory(LocalSessionFactoryBean.java:678) at org.springframework.orm.hibernate3.LocalSessionFactoryBean.afterPropertiesSet(LocalSessionFactoryBean.java:613) at com.spider.scoreboard.database.DatabaseBeanFactoryPostProcessor.createLocalSessionFactoryBean(DatabaseBeanFactoryPostProcessor.java:150) at com.spider.scoreboard.database.DatabaseBeanFactoryPostProcessor.postProcessBeanFactory(DatabaseBeanFactoryPostProcessor.java:90) at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:375) at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:301) at org.springframework.web.context.support.AbstractRefreshableWebApplicationContext.refresh(AbstractRefreshableWebApplicationContext.java:131) at com.spider.scoreboard.framework.springx.ScoreboardApplicationContext.refresh(ScoreboardApplicationContext.java:73) at com.spider.scoreboard.framework.springx.ScoreboardContextLoaderServlet.loadContext(ScoreboardContextLoaderServlet.java:319) at com.spider.scoreboard.framework.springx.ScoreboardContextLoaderServlet.startupOrRestart(ScoreboardContextLoaderServlet.java:118) at com.spider.scoreboard.framework.springx.ScoreboardContextLoaderServlet.init(ScoreboardContextLoaderServlet.java:83) at javax.servlet.GenericServlet.init(GenericServlet.java:258) at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:888) at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:776) at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:3363) at org.apache.catalina.core.StandardContext.start(StandardContext.java:3586) at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1141) at org.apache.catalina.core.StandardHost.start(StandardHost.java:707) at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1141) at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:316) at org.apache.catalina.core.StandardService.start(StandardService.java:450) at org.apache.catalina.core.StandardServer.start(StandardServer.java:2143) at org.apache.catalina.startup.Catalina.start(Catalina.java:463) at org.apache.catalina.startup.Catalina.execute(Catalina.java:350) at org.apache.catalina.startup.Catalina.process(Catalina.java:129) 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 org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:156)

    Hibernate JIRA | 1 decade ago | Matt Sgarlata
    java.lang.NullPointerException
  5. 0

    [hibernate-issues] [Hibernate-JIRA] Created: (HHH-7196) Could not instantiate persister org.hibernate.persister.entity.SingleTableEntityPersister

    jboss.org | 4 months ago
    org.hibernate.MappingException: Could not instantiate persister org.hibernate.persister.entity.SingleTableEntityPersister

    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.NullPointerException

      No message provided

      at org.hibernate.tuple.PojoTuplizer.handleProperty()
    2. Hibernate
      SingleTableEntityPersister.<init>
      1. org.hibernate.tuple.PojoTuplizer.handleProperty(PojoTuplizer.java:82)
      2. org.hibernate.tuple.AbstractTuplizer.<init>(AbstractTuplizer.java:77)
      3. org.hibernate.tuple.PojoTuplizer.<init>(PojoTuplizer.java:53)
      4. org.hibernate.tuple.TuplizerLookup.create(TuplizerLookup.java:45)
      5. org.hibernate.tuple.EntityMetamodel.<init>(EntityMetamodel.java:202)
      6. org.hibernate.persister.entity.BasicEntityPersister.<init>(BasicEntityPersister.java:398)
      7. org.hibernate.persister.entity.SingleTableEntityPersister.<init>(SingleTableEntityPersister.java:104)
      7 frames
    3. Hibernate
      SessionFactoryImpl.<init>
      1. org.hibernate.persister.PersisterFactory.createClassPersister(PersisterFactory.java:55)
      2. org.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:198)
      2 frames
    4. Hibernate
      Configuration.buildSessionFactory
      1. org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1043)
      1 frame