java.lang.NullPointerException

Hibernate JIRA | Martin Kamp Jensen | 1 year ago
tip
Your exception is missing from the Samebug knowledge base.
Here are the best solutions we found on the Internet.
Click on the to mark the helpful solution and get rewards for you help.
  1. 0

    Using MetadataSources.addCacheableFile with a .hbm.xml file that exists but without a .hbm.xml.bin file (not created yet at this point) results in a null binding because of https://github.com/hibernate/hibernate-orm/blob/5.0.1.Final/hibernate-core/src/main/java/org/hibernate/boot/jaxb/internal/CacheableFileXmlSource.java#L98. In the end it results in a NPE: {noformat} java.lang.NullPointerException at org.hibernate.boot.model.source.internal.hbm.HbmMetadataSourceProcessorImpl.<init>(HbmMetadataSourceProcessorImpl.java:53) at org.hibernate.boot.model.source.internal.hbm.HbmMetadataSourceProcessorImpl.<init>(HbmMetadataSourceProcessorImpl.java:40) at org.hibernate.boot.model.process.spi.MetadataBuildingProcess$1.<init>(MetadataBuildingProcess.java:142) at org.hibernate.boot.model.process.spi.MetadataBuildingProcess.complete(MetadataBuildingProcess.java:141) at org.hibernate.boot.model.process.spi.MetadataBuildingProcess.build(MetadataBuildingProcess.java:83) at org.hibernate.boot.internal.MetadataBuilderImpl.build(MetadataBuilderImpl.java:418) at org.hibernate.boot.internal.MetadataBuilderImpl.build(MetadataBuilderImpl.java:87) at org.hibernate.boot.MetadataSources.buildMetadata(MetadataSources.java:179) {noformat} Instead, I think that the binding should be returned after having been serialized (now the .hbm.xml.bin file exists). That is, "return binding" after https://github.com/hibernate/hibernate-orm/blob/5.0.1.Final/hibernate-core/src/main/java/org/hibernate/boot/jaxb/internal/CacheableFileXmlSource.java#L95. I have attached a patch that seems to fix the problem for me.

    Hibernate JIRA | 1 year ago | Martin Kamp Jensen
    java.lang.NullPointerException
  2. 0

    Using MetadataSources.addCacheableFile with a .hbm.xml file that exists but without a .hbm.xml.bin file (not created yet at this point) results in a null binding because of https://github.com/hibernate/hibernate-orm/blob/5.0.1.Final/hibernate-core/src/main/java/org/hibernate/boot/jaxb/internal/CacheableFileXmlSource.java#L98. In the end it results in a NPE: {noformat} java.lang.NullPointerException at org.hibernate.boot.model.source.internal.hbm.HbmMetadataSourceProcessorImpl.<init>(HbmMetadataSourceProcessorImpl.java:53) at org.hibernate.boot.model.source.internal.hbm.HbmMetadataSourceProcessorImpl.<init>(HbmMetadataSourceProcessorImpl.java:40) at org.hibernate.boot.model.process.spi.MetadataBuildingProcess$1.<init>(MetadataBuildingProcess.java:142) at org.hibernate.boot.model.process.spi.MetadataBuildingProcess.complete(MetadataBuildingProcess.java:141) at org.hibernate.boot.model.process.spi.MetadataBuildingProcess.build(MetadataBuildingProcess.java:83) at org.hibernate.boot.internal.MetadataBuilderImpl.build(MetadataBuilderImpl.java:418) at org.hibernate.boot.internal.MetadataBuilderImpl.build(MetadataBuilderImpl.java:87) at org.hibernate.boot.MetadataSources.buildMetadata(MetadataSources.java:179) {noformat} Instead, I think that the binding should be returned after having been serialized (now the .hbm.xml.bin file exists). That is, "return binding" after https://github.com/hibernate/hibernate-orm/blob/5.0.1.Final/hibernate-core/src/main/java/org/hibernate/boot/jaxb/internal/CacheableFileXmlSource.java#L95. I have attached a patch that seems to fix the problem for me.

    Hibernate JIRA | 1 year ago | Martin Kamp Jensen
    java.lang.NullPointerException

    Root Cause Analysis

    1. java.lang.NullPointerException

      No message provided

      at org.hibernate.boot.model.source.internal.hbm.HbmMetadataSourceProcessorImpl.<init>()
    2. org.hibernate.boot
      MetadataSources.buildMetadata
      1. org.hibernate.boot.model.source.internal.hbm.HbmMetadataSourceProcessorImpl.<init>(HbmMetadataSourceProcessorImpl.java:53)
      2. org.hibernate.boot.model.source.internal.hbm.HbmMetadataSourceProcessorImpl.<init>(HbmMetadataSourceProcessorImpl.java:40)
      3. org.hibernate.boot.model.process.spi.MetadataBuildingProcess$1.<init>(MetadataBuildingProcess.java:142)
      4. org.hibernate.boot.model.process.spi.MetadataBuildingProcess.complete(MetadataBuildingProcess.java:141)
      5. org.hibernate.boot.model.process.spi.MetadataBuildingProcess.build(MetadataBuildingProcess.java:83)
      6. org.hibernate.boot.internal.MetadataBuilderImpl.build(MetadataBuilderImpl.java:418)
      7. org.hibernate.boot.internal.MetadataBuilderImpl.build(MetadataBuilderImpl.java:87)
      8. org.hibernate.boot.MetadataSources.buildMetadata(MetadataSources.java:179)
      8 frames