Uploaded image for project: 'OpenJPA'
  1. OpenJPA
  2. OPENJPA-2791

Parsing persistence.xml throws premature end of file error

VotersWatch issueWatchersLinkCloneUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 2.4.3
    • 2.4.4, 3.1.0
    • build / infrastructure, jpa
    • Linux Ubuntu 18.04
    • Important
    • Hide
      Exception in thread "main" javax.persistence.PersistenceException: Explicit persistence provider error(s) occurred for "sccPU" after trying the following discovered implementations: org.apache.openjpa.persistence.PersistenceProviderImpl from provider: org.apache.openjpa.persistence.PersistenceProviderImpl
      at javax.persistence.Persistence.createPersistenceException(Persistence.java:241)
      at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:183)
      at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:72)
      at rfpeake.sccdata.app.Main.createEntityManagerFactory(Main.java:72)
      at rfpeake.sccdata.app.Main.main(Main.java:46)
      Caused by: <openjpa-2.4.3-r422266:1833086 nonfatal general error> org.apache.openjpa.util.GeneralException: org.xml.sax.SAXException: file:/home/robert/git/sccdata/target/classes/META-INF/persistence.xml [Location: Line: 5, C: 64]: org.xml.sax.SAXParseException; systemId: http://xmlns.jcp.org/xml/ns/persistence/persistence_2_1.xsd; lineNumber: 1; columnNumber: 1; Premature end of file.
      at org.apache.openjpa.lib.meta.XMLMetaDataParser.parseNewResource(XMLMetaDataParser.java:426)
      at org.apache.openjpa.lib.meta.XMLMetaDataParser.parse(XMLMetaDataParser.java:346)
      at org.apache.openjpa.lib.meta.XMLMetaDataParser.parse(XMLMetaDataParser.java:323)
      at org.apache.openjpa.lib.meta.XMLMetaDataParser.parse(XMLMetaDataParser.java:296)
      at org.apache.openjpa.persistence.PersistenceProductDerivation$ConfigurationParser.parse(PersistenceProductDerivation.java:811)
      at org.apache.openjpa.persistence.PersistenceProductDerivation.parseResources(PersistenceProductDerivation.java:576)
      at org.apache.openjpa.persistence.PersistenceProductDerivation.load(PersistenceProductDerivation.java:528)
      at org.apache.openjpa.persistence.PersistenceProductDerivation.load(PersistenceProductDerivation.java:339)
      at org.apache.openjpa.persistence.PersistenceProviderImpl.createEntityManagerFactory(PersistenceProviderImpl.java:87)
      at org.apache.openjpa.persistence.PersistenceProviderImpl.createEntityManagerFactory(PersistenceProviderImpl.java:155)
      at org.apache.openjpa.persistence.PersistenceProviderImpl.createEntityManagerFactory(PersistenceProviderImpl.java:63)
      at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:149)
      ... 3 more
      Show
      Exception in thread "main" javax.persistence.PersistenceException: Explicit persistence provider error(s) occurred for "sccPU" after trying the following discovered implementations: org.apache.openjpa.persistence.PersistenceProviderImpl from provider: org.apache.openjpa.persistence.PersistenceProviderImpl at javax.persistence.Persistence.createPersistenceException(Persistence.java:241) at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:183) at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:72) at rfpeake.sccdata.app.Main.createEntityManagerFactory(Main.java:72) at rfpeake.sccdata.app.Main.main(Main.java:46) Caused by: <openjpa-2.4.3-r422266:1833086 nonfatal general error> org.apache.openjpa.util.GeneralException: org.xml.sax.SAXException: file:/home/robert/git/sccdata/target/classes/META-INF/persistence.xml [Location: Line: 5, C: 64]: org.xml.sax.SAXParseException; systemId: http://xmlns.jcp.org/xml/ns/persistence/persistence_2_1.xsd; lineNumber: 1; columnNumber: 1; Premature end of file. at org.apache.openjpa.lib.meta.XMLMetaDataParser.parseNewResource(XMLMetaDataParser.java:426) at org.apache.openjpa.lib.meta.XMLMetaDataParser.parse(XMLMetaDataParser.java:346) at org.apache.openjpa.lib.meta.XMLMetaDataParser.parse(XMLMetaDataParser.java:323) at org.apache.openjpa.lib.meta.XMLMetaDataParser.parse(XMLMetaDataParser.java:296) at org.apache.openjpa.persistence.PersistenceProductDerivation$ConfigurationParser.parse(PersistenceProductDerivation.java:811) at org.apache.openjpa.persistence.PersistenceProductDerivation.parseResources(PersistenceProductDerivation.java:576) at org.apache.openjpa.persistence.PersistenceProductDerivation.load(PersistenceProductDerivation.java:528) at org.apache.openjpa.persistence.PersistenceProductDerivation.load(PersistenceProductDerivation.java:339) at org.apache.openjpa.persistence.PersistenceProviderImpl.createEntityManagerFactory(PersistenceProviderImpl.java:87) at org.apache.openjpa.persistence.PersistenceProviderImpl.createEntityManagerFactory(PersistenceProviderImpl.java:155) at org.apache.openjpa.persistence.PersistenceProviderImpl.createEntityManagerFactory(PersistenceProviderImpl.java:63) at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:149) ... 3 more

    Description

      XMLMetaDataParser in org.apache.openjpa.lib.meta uses the SaxParser to read persistence.xml. Just within the last few days, it has begun to throw this error:

      org.xml.sax.SAXException: file:/home/robert/git/sccdata/target/classes/META-INF/persistence.xml [Location: Line: 5, C: 64]: org.xml.sax.SAXParseException; systemId: http://xmlns.jcp.org/xml/ns/persistence/persistence_2_1.xsd; lineNumber: 1; columnNumber: 1; Premature end of file.

      Resorting to XML Copy Editor to validate the schema shows the error actually involved: Fatal Error at line 0, column 0: unsupported protocol in URL. It seems that Oracle's web site has switched from HTTP to HTTPS, which is a protocol that parser cannot handle, as explained in this post:

      [article|https://knowledgebase.progress.com/articles/Article/Unsupported-protocol-in-URL-reading-XML-from-a-URI.]

       

      The problem has been reported elsewhere Stack Overflow.

       

      Attachments

        Issue Links

        Activity

          This comment will be Viewable by All Users Viewable by All Users
          Cancel

          People

            Unassigned Unassigned
            OldSplice Robert F. Peake
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Slack

                Issue deployment