Uploaded image for project: 'Spring Data JPA'
  1. Spring Data JPA
  2. DATAJPA-904

Potential NullPointerException in JpaPersistentPropertyImpl.isEntity()

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 1.9.4 (Gosling SR4), 1.10.1 (Hopper SR1)
    • Component/s: Core
    • Labels:
      None
    • Environment:
      Hibernate 5.1.0.Final
      Hibernate Envers 5.1.0.Final
      Spring 4.2.4.RELEASE
      spring-data-jpa 1.11.0.BUILD-SNAPSHOT
    • Sprint:
      Hopper SR2

      Description

      Hi,

      I'm using Hibernate to map the tables of our database and some of them are audited with Envers (@Audited on the entity class). To solve the same problem that is described in DATAJPA-885, I switched to the latest snapshot (1.11.0).

      I'm now getting a NullPointerException at the start of the application on the table_AUD classes generated by Hibernate. The NPE is because the javaType of the _AUD EmbeddableTypeImpl object is null.

      org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'jpaMappingContext': Invocation of init method failed; nested exception is java.lang.NullPointerException
      	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1578)
      	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:545)
      	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:482)
      	at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306)
      	at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230)
      	at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302)
      	at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197)
      	at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:753)
      	at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:839)
      	at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:538)
      	at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:139)
      	at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:83)
      	at sgcib.ged.bcs.spring.SpringLauncher.launch(SpringLauncher.java:57)
      	at sgcib.ged.bcs.spring.SpringLauncher.launch(SpringLauncher.java:38)
      	at sgcib.ged.bcs.spring.SpringLauncher.launch(SpringLauncher.java:26)
      	at sgcib.ged.bcs.reflex.server.ReflexServer.main(ReflexServer.java:13)
      Caused by: java.lang.NullPointerException
      	at org.springframework.data.jpa.mapping.JpaPersistentPropertyImpl.isEntity(JpaPersistentPropertyImpl.java:161)
      	at org.springframework.data.mapping.model.AbstractPersistentProperty.getPersistentEntityType(AbstractPersistentProperty.java:129)
      	at org.springframework.data.jpa.mapping.JpaPersistentPropertyImpl.getPersistentEntityType(JpaPersistentPropertyImpl.java:133)
      	at org.springframework.data.mapping.context.AbstractMappingContext$PersistentPropertyCreator.createAndRegisterProperty(AbstractMappingContext.java:488)
      	at org.springframework.data.mapping.context.AbstractMappingContext$PersistentPropertyCreator.doWith(AbstractMappingContext.java:446)
      	at org.springframework.util.ReflectionUtils.doWithFields(ReflectionUtils.java:689)
      	at org.springframework.data.mapping.context.AbstractMappingContext.addPersistentEntity(AbstractMappingContext.java:314)
      	at org.springframework.data.mapping.context.AbstractMappingContext.addPersistentEntity(AbstractMappingContext.java:276)
      	at org.springframework.data.mapping.context.AbstractMappingContext.initialize(AbstractMappingContext.java:392)
      	at org.springframework.data.jpa.repository.config.JpaMetamodelMappingContextFactoryBean.createInstance(JpaMetamodelMappingContextFactoryBean.java:73)
      	at org.springframework.data.jpa.repository.config.JpaMetamodelMappingContextFactoryBean.createInstance(JpaMetamodelMappingContextFactoryBean.java:26)
      	at org.springframework.beans.factory.config.AbstractFactoryBean.afterPropertiesSet(AbstractFactoryBean.java:134)
      	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1637)
      	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1574)
      	... 15 more
      

      How do I solve this problem? Is this a problem in Hibernate?

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                olivergierke Oliver Drotbohm
                Reporter:
                ddurette Daniel Durette
                Last updater:
                Jens Schauder
              • Votes:
                0 Vote for this issue
                Watchers:
                4 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: