1. OpenJPA
  2. OPENJPA-2284

NPE occurs when <cascade-persist/> is added to a <persistence-unit-defaults> in an orm.


    • Type: Bug Bug
    • Status: Closed
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: 2.0.3, 2.2.1, 2.3.0
    • Fix Version/s: 2.0.3, 2.1.2, 2.2.2,, 2.3.0
    • Component/s: jpa
    • Labels:


      Take this entity:

      public class Simple {

      private int id;
      private String name;

      Take this orm.xml entry:

      <!-- The cascade-persist entry causes an issue: -->

      <entity class="hat.entities.Simple" access="FIELD">
      <id name="id" />
      <basic name="name" />

      With this, the following exception will occur:

      Caused by: org.xml.sax.SAXException: file:/E:/jpa/openJPAcode/PMR93141/target/test-classes/META-INF/orm.xml [Location: Line: 16, C: 23]: An error was encountered while parsing element "id". Make sure the metadata file is correctly formatted. [java.lang.NullPointerException]
      at org.apache.openjpa.lib.meta.XMLMetaDataParser.getException(
      at org.apache.openjpa.lib.meta.CFMetaDataParser.endElement(
      at org.apache.openjpa.lib.meta.XMLMetaDataParser.endElement(
      at org.apache.xerces.parsers.AbstractSAXParser.endElement(
      at org.apache.xerces.parsers.AbstractXMLDocumentParser.emptyElement(
      at org.apache.xerces.impl.XMLNamespaceBinder.handleStartElement(
      at org.apache.xerces.impl.XMLNamespaceBinder.emptyElement(
      at org.apache.xerces.impl.dtd.XMLDTDValidator.emptyElement(
      at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanStartElement(
      at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(
      at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(
      at org.apache.xerces.parsers.DTDConfiguration.parse(
      at org.apache.xerces.parsers.DTDConfiguration.parse(
      at org.apache.xerces.parsers.XMLParser.parse(
      at org.apache.xerces.parsers.AbstractSAXParser.parse(
      at javax.xml.parsers.SAXParser.parse(
      at org.apache.openjpa.lib.meta.XMLMetaDataParser.parseNewResource(
      ... 60 more

      If I comment out the '<cascade-persist/>' entry, all works fine. Note that in the above XML I've added the </schema> and <delimited-identifiers/> entries as well. Neither of these have an effect on the outcome (they could simply be removed). I was thinking that if the issue occurred for the cascade stanza that it might also occur for the <delimited-identifiers/> entry since the two are similar in their XML definition (XSD). However, this issue seems isolated to just the cascade stanza.


        No work has yet been logged on this issue.


          • Assignee:
            Heath Thomann
            Heath Thomann
          • Votes:
            0 Vote for this issue
            1 Start watching this issue


            • Created: