[jira] [Commented] (OPENJPA-2791) Parsing persistence.xml throws premature end of file error
[ https://issues.apache.org/jira/browse/OPENJPA-2791?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16873434#comment-16873434 ] Robert F. Peake commented on OPENJPA-2791: -- So, as I understand it, your goal is to use an httpclient that can handle redirection. But if all else fails, use a static xsd file in OpenJPA, just not version 1.0, as presently implemented. Having been out of commission for a couple of days because of this issue, I'm all in favor of a bullet-proof fall-back. > Parsing persistence.xml throws premature end of file error > -- > > Key: OPENJPA-2791 > URL: https://issues.apache.org/jira/browse/OPENJPA-2791 > Project: OpenJPA > Issue Type: Bug > Components: build / infrastructure, jpa >Affects Versions: 2.4.3 > Environment: Linux Ubuntu 18.04 >Reporter: Robert F. Peake >Priority: Major > Labels: build > Fix For: 2.4.4, 3.1.0 > > > 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: > {quote}org.xml.sax.SAXException: > [file:/home/robert/git/sccdata/target/classes/META-INF/persistence.xml|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. > {quote} > 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: > {color:#00}[article|[https://knowledgebase.progress.com/articles/Article/Unsupported-protocol-in-URL-reading-XML-from-a-URI].]{color} > {color:#00} {color} > {color:#00}The problem has been reported elsewhere [Stack > Overflow|https://stackoverflow.com/questions/56728487/org-xml-sax-saxparseexceptionpublicid-http-xmlns-jcp-org-xml-ns-persistence-p/56741356#56741356].{color} > -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (OPENJPA-2791) Parsing persistence.xml throws premature end of file error
[ https://issues.apache.org/jira/browse/OPENJPA-2791?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16873119#comment-16873119 ] Romain Manni-Bucau commented on OPENJPA-2791: - think so yes > Parsing persistence.xml throws premature end of file error > -- > > Key: OPENJPA-2791 > URL: https://issues.apache.org/jira/browse/OPENJPA-2791 > Project: OpenJPA > Issue Type: Bug > Components: build / infrastructure, jpa >Affects Versions: 2.4.3 > Environment: Linux Ubuntu 18.04 >Reporter: Robert F. Peake >Priority: Major > Labels: build > Fix For: 2.4.4, 3.1.0 > > > 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: > {quote}org.xml.sax.SAXException: > [file:/home/robert/git/sccdata/target/classes/META-INF/persistence.xml|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. > {quote} > 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: > {color:#00}[article|[https://knowledgebase.progress.com/articles/Article/Unsupported-protocol-in-URL-reading-XML-from-a-URI].]{color} > {color:#00} {color} > {color:#00}The problem has been reported elsewhere [Stack > Overflow|https://stackoverflow.com/questions/56728487/org-xml-sax-saxparseexceptionpublicid-http-xmlns-jcp-org-xml-ns-persistence-p/56741356#56741356].{color} > -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (OPENJPA-2791) Parsing persistence.xml throws premature end of file error
[ https://issues.apache.org/jira/browse/OPENJPA-2791?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16873059#comment-16873059 ] Francesco Chicchiriccò commented on OPENJPA-2791: - Yes [~solomax] just noticed, I am going to close this issue. > Parsing persistence.xml throws premature end of file error > -- > > Key: OPENJPA-2791 > URL: https://issues.apache.org/jira/browse/OPENJPA-2791 > Project: OpenJPA > Issue Type: Bug > Components: build / infrastructure, jpa >Affects Versions: 2.4.3 > Environment: Linux Ubuntu 18.04 >Reporter: Robert F. Peake >Priority: Major > Labels: build > > 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: > {quote}org.xml.sax.SAXException: > [file:/home/robert/git/sccdata/target/classes/META-INF/persistence.xml|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. > {quote} > 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: > {color:#00}[article|[https://knowledgebase.progress.com/articles/Article/Unsupported-protocol-in-URL-reading-XML-from-a-URI].]{color} > {color:#00} {color} > {color:#00}The problem has been reported elsewhere [Stack > Overflow|https://stackoverflow.com/questions/56728487/org-xml-sax-saxparseexceptionpublicid-http-xmlns-jcp-org-xml-ns-persistence-p/56741356#56741356].{color} > -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (OPENJPA-2791) Parsing persistence.xml throws premature end of file error
[ https://issues.apache.org/jira/browse/OPENJPA-2791?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16873057#comment-16873057 ] Maxim Solodovnik commented on OPENJPA-2791: --- I have added additional xsd for master while ago > Parsing persistence.xml throws premature end of file error > -- > > Key: OPENJPA-2791 > URL: https://issues.apache.org/jira/browse/OPENJPA-2791 > Project: OpenJPA > Issue Type: Bug > Components: build / infrastructure, jpa >Affects Versions: 2.4.3 > Environment: Linux Ubuntu 18.04 >Reporter: Robert F. Peake >Priority: Major > Labels: build > > 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: > {quote}org.xml.sax.SAXException: > [file:/home/robert/git/sccdata/target/classes/META-INF/persistence.xml|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. > {quote} > 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: > {color:#00}[article|[https://knowledgebase.progress.com/articles/Article/Unsupported-protocol-in-URL-reading-XML-from-a-URI].]{color} > {color:#00} {color} > {color:#00}The problem has been reported elsewhere [Stack > Overflow|https://stackoverflow.com/questions/56728487/org-xml-sax-saxparseexceptionpublicid-http-xmlns-jcp-org-xml-ns-persistence-p/56741356#56741356].{color} > -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (OPENJPA-2791) Parsing persistence.xml throws premature end of file error
[ https://issues.apache.org/jira/browse/OPENJPA-2791?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16873056#comment-16873056 ] Francesco Chicchiriccò commented on OPENJPA-2791: - Just found OPENJPA-2781, it seems OpenJPA 2.4.4 (not yet released) and 3.1.0 already bear the needed fix. > Parsing persistence.xml throws premature end of file error > -- > > Key: OPENJPA-2791 > URL: https://issues.apache.org/jira/browse/OPENJPA-2791 > Project: OpenJPA > Issue Type: Bug > Components: build / infrastructure, jpa >Affects Versions: 2.4.3 > Environment: Linux Ubuntu 18.04 >Reporter: Robert F. Peake >Priority: Major > Labels: build > > 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: > {quote}org.xml.sax.SAXException: > [file:/home/robert/git/sccdata/target/classes/META-INF/persistence.xml|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. > {quote} > 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: > {color:#00}[article|[https://knowledgebase.progress.com/articles/Article/Unsupported-protocol-in-URL-reading-XML-from-a-URI].]{color} > {color:#00} {color} > {color:#00}The problem has been reported elsewhere [Stack > Overflow|https://stackoverflow.com/questions/56728487/org-xml-sax-saxparseexceptionpublicid-http-xmlns-jcp-org-xml-ns-persistence-p/56741356#56741356].{color} > -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (OPENJPA-2791) Parsing persistence.xml throws premature end of file error
[ https://issues.apache.org/jira/browse/OPENJPA-2791?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16873053#comment-16873053 ] Francesco Chicchiriccò commented on OPENJPA-2791: - Ah no, sorry: [https://github.com/apache/openjpa/blob/2.4.x/openjpa-persistence/src/main/resources/org/apache/openjpa/persistence/persistence-xsd.rsrc] > Parsing persistence.xml throws premature end of file error > -- > > Key: OPENJPA-2791 > URL: https://issues.apache.org/jira/browse/OPENJPA-2791 > Project: OpenJPA > Issue Type: Bug > Components: build / infrastructure, jpa >Affects Versions: 2.4.3 > Environment: Linux Ubuntu 18.04 >Reporter: Robert F. Peake >Priority: Major > Labels: build > > 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: > {quote}org.xml.sax.SAXException: > [file:/home/robert/git/sccdata/target/classes/META-INF/persistence.xml|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. > {quote} > 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: > {color:#00}[article|[https://knowledgebase.progress.com/articles/Article/Unsupported-protocol-in-URL-reading-XML-from-a-URI].]{color} > {color:#00} {color} > {color:#00}The problem has been reported elsewhere [Stack > Overflow|https://stackoverflow.com/questions/56728487/org-xml-sax-saxparseexceptionpublicid-http-xmlns-jcp-org-xml-ns-persistence-p/56741356#56741356].{color} > -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (OPENJPA-2791) Parsing persistence.xml throws premature end of file error
[ https://issues.apache.org/jira/browse/OPENJPA-2791?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16873051#comment-16873051 ] Francesco Chicchiriccò commented on OPENJPA-2791: - [~romain.manni-bucau] so your proposal would be to have the {{persistence_2_1.xsd}} file into {{openjpa-lib}}'s JAR and to resolve any http*://*/persistence_2_1.xsd with that one? This sounds interesting (and efficient), but it hasn't been done so far for other persistence xsd versions (no persistence xsd in the source tree): could that be a problem? > Parsing persistence.xml throws premature end of file error > -- > > Key: OPENJPA-2791 > URL: https://issues.apache.org/jira/browse/OPENJPA-2791 > Project: OpenJPA > Issue Type: Bug > Components: build / infrastructure, jpa >Affects Versions: 2.4.3 > Environment: Linux Ubuntu 18.04 >Reporter: Robert F. Peake >Priority: Major > Labels: build > > 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: > {quote}org.xml.sax.SAXException: > [file:/home/robert/git/sccdata/target/classes/META-INF/persistence.xml|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. > {quote} > 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: > {color:#00}[article|[https://knowledgebase.progress.com/articles/Article/Unsupported-protocol-in-URL-reading-XML-from-a-URI].]{color} > {color:#00} {color} > {color:#00}The problem has been reported elsewhere [Stack > Overflow|https://stackoverflow.com/questions/56728487/org-xml-sax-saxparseexceptionpublicid-http-xmlns-jcp-org-xml-ns-persistence-p/56741356#56741356].{color} > -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (OPENJPA-2791) Parsing persistence.xml throws premature end of file error
[ https://issues.apache.org/jira/browse/OPENJPA-2791?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16873040#comment-16873040 ] Romain Manni-Bucau commented on OPENJPA-2791: - [~ilgrosso] think we can rewrite the xsd on the fly - we do it in tomee javaeejaxb - and ensure we use one we can resolve - likely locally. Wdyt? > Parsing persistence.xml throws premature end of file error > -- > > Key: OPENJPA-2791 > URL: https://issues.apache.org/jira/browse/OPENJPA-2791 > Project: OpenJPA > Issue Type: Bug > Components: build / infrastructure, jpa >Affects Versions: 2.4.3 > Environment: Linux Ubuntu 18.04 >Reporter: Robert F. Peake >Priority: Major > Labels: build > > 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: > {quote}org.xml.sax.SAXException: > [file:/home/robert/git/sccdata/target/classes/META-INF/persistence.xml|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. > {quote} > 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: > {color:#00}[article|[https://knowledgebase.progress.com/articles/Article/Unsupported-protocol-in-URL-reading-XML-from-a-URI].]{color} > {color:#00} {color} > {color:#00}The problem has been reported elsewhere [Stack > Overflow|https://stackoverflow.com/questions/56728487/org-xml-sax-saxparseexceptionpublicid-http-xmlns-jcp-org-xml-ns-persistence-p/56741356#56741356].{color} > -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (OPENJPA-2791) Parsing persistence.xml throws premature end of file error
[ https://issues.apache.org/jira/browse/OPENJPA-2791?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16873031#comment-16873031 ] Francesco Chicchiriccò commented on OPENJPA-2791: - {quote} making an explicit http connection, where we might be checking if there is an HTTP proxy configured {quote} It seems that replacing {code} CloseableHttpClient httpclient = HttpClients.createDefault(); {code} with {code} CloseableHttpClient httpclient = HttpClients.createSystem(); {code} should do the trick. > Parsing persistence.xml throws premature end of file error > -- > > Key: OPENJPA-2791 > URL: https://issues.apache.org/jira/browse/OPENJPA-2791 > Project: OpenJPA > Issue Type: Bug > Components: build / infrastructure, jpa >Affects Versions: 2.4.3 > Environment: Linux Ubuntu 18.04 >Reporter: Robert F. Peake >Priority: Major > Labels: build > > 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: > {quote}org.xml.sax.SAXException: > [file:/home/robert/git/sccdata/target/classes/META-INF/persistence.xml|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. > {quote} > 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: > {color:#00}[article|[https://knowledgebase.progress.com/articles/Article/Unsupported-protocol-in-URL-reading-XML-from-a-URI].]{color} > {color:#00} {color} > {color:#00}The problem has been reported elsewhere [Stack > Overflow|https://stackoverflow.com/questions/56728487/org-xml-sax-saxparseexceptionpublicid-http-xmlns-jcp-org-xml-ns-persistence-p/56741356#56741356].{color} > -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (OPENJPA-2791) Parsing persistence.xml throws premature end of file error
[ https://issues.apache.org/jira/browse/OPENJPA-2791?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16873018#comment-16873018 ] Francesco Chicchiriccò commented on OPENJPA-2791: - {quote} Problem solved. I replaced https://xmlns.jcp.org/xml/ns/persistence/persistence_2_1.xsd with https://www.oracle.com/webfolder/technetwork/jsc/xml/ns/persistence/persistence_2_1.xsd and the program now builds normally. Many thanks for your help. {quote} Glad that it solves your immediate need, but I see it more as a workaround. Since the problem seems to be fetching the actual xsd content (due to multiple redirects) rather than actual SAX validation, I have re-elaborated the snippet above as follows: {code} // first get actual xsd via httpclient, which correctly follows redirects CloseableHttpClient httpclient = HttpClients.createDefault(); HttpGet httpget = new HttpGet("http://xmlns.jcp.org/xml/ns/persistence/persistence_2_1.xsd;); CloseableHttpResponse response = httpclient.execute(httpget); // then obtain a Schema instance for the fetched xsd content SchemaFactory schemaFactory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI); Schema schema = schemaFactory.newSchema(new StreamSource(response.getEntity().getContent())); // finally do SAX parsing, with validation against the Schema instance obtained above SAXParserFactory saxParserFactory = SAXParserFactory.newInstance(); saxParserFactory.setNamespaceAware(true); saxParserFactory.setSchema(schema); SAXParser parser = saxParserFactory.newSAXParser(); parser.parse(App.class.getResourceAsStream("/persistence.xml"), new DefaultHandler() { @Override public void error(final SAXParseException e) throws SAXException { throw e; } }); {code} This works either in case of valid and invalid {{persistence.xml}}. Hence, the actual fix for the current issue could be changing {{XMLMetaDataParser}} to work as above, but I have some doubts, especially about: # adding dependency on commons-hc # making an explicit http connection, where we might be checking if there is an HTTP proxy configured [~struberg], [~romain.manni-bucau] what do you think? > Parsing persistence.xml throws premature end of file error > -- > > Key: OPENJPA-2791 > URL: https://issues.apache.org/jira/browse/OPENJPA-2791 > Project: OpenJPA > Issue Type: Bug > Components: build / infrastructure, jpa >Affects Versions: 2.4.3 > Environment: Linux Ubuntu 18.04 >Reporter: Robert F. Peake >Priority: Major > Labels: build > > 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: > {quote}org.xml.sax.SAXException: > [file:/home/robert/git/sccdata/target/classes/META-INF/persistence.xml|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. > {quote} > 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: > {color:#00}[article|[https://knowledgebase.progress.com/articles/Article/Unsupported-protocol-in-URL-reading-XML-from-a-URI].]{color} > {color:#00} {color} > {color:#00}The problem has been reported elsewhere [Stack > Overflow|https://stackoverflow.com/questions/56728487/org-xml-sax-saxparseexceptionpublicid-http-xmlns-jcp-org-xml-ns-persistence-p/56741356#56741356].{color} > -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (OPENJPA-2791) Parsing persistence.xml throws premature end of file error
[ https://issues.apache.org/jira/browse/OPENJPA-2791?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16872576#comment-16872576 ] Robert F. Peake commented on OPENJPA-2791: -- Problem solved. I replaced https://xmlns.jcp.org/xml/ns/persistence/persistence_2_1.xsd with https://www.oracle.com/webfolder/technetwork/jsc/xml/ns/persistence/persistence_2_1.xsd and the program now builds normally. Many thanks for your help. > Parsing persistence.xml throws premature end of file error > -- > > Key: OPENJPA-2791 > URL: https://issues.apache.org/jira/browse/OPENJPA-2791 > Project: OpenJPA > Issue Type: Bug > Components: build / infrastructure, jpa >Affects Versions: 2.4.3 > Environment: Linux Ubuntu 18.04 >Reporter: Robert F. Peake >Priority: Major > Labels: build > > 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: > {quote}org.xml.sax.SAXException: > [file:/home/robert/git/sccdata/target/classes/META-INF/persistence.xml|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. > {quote} > 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: > {color:#00}[article|[https://knowledgebase.progress.com/articles/Article/Unsupported-protocol-in-URL-reading-XML-from-a-URI].]{color} > {color:#00} {color} > {color:#00}The problem has been reported elsewhere [Stack > Overflow|https://stackoverflow.com/questions/56728487/org-xml-sax-saxparseexceptionpublicid-http-xmlns-jcp-org-xml-ns-persistence-p/56741356#56741356].{color} > -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (OPENJPA-2791) Parsing persistence.xml throws premature end of file error
[ https://issues.apache.org/jira/browse/OPENJPA-2791?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16872538#comment-16872538 ] Robert F. Peake commented on OPENJPA-2791: -- Debugging, the actual code is effectively identical to your example until the final setProperty method. Instead of a String giving the url of the xsd file, a schema object is passed containing an input stream and a jarURLConnection, which points to the jar file at: apache-tomee-webprofile-7.1.1/lib/openjpa-2.4.3.jar!/org/apache/openjpa/persistence/persistence-xsd.rsrc. That file contains the xsd schema for JPA 1.0. So the focus of investigation would seem to be how the schema object is assembled and why it is not getting the right url. The implementation is not available in the source code, as far as I can tell. Let me know if there is anything else I can check. > Parsing persistence.xml throws premature end of file error > -- > > Key: OPENJPA-2791 > URL: https://issues.apache.org/jira/browse/OPENJPA-2791 > Project: OpenJPA > Issue Type: Bug > Components: build / infrastructure, jpa >Affects Versions: 2.4.3 > Environment: Linux Ubuntu 18.04 >Reporter: Robert F. Peake >Priority: Major > Labels: build > > 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: > {quote}org.xml.sax.SAXException: > [file:/home/robert/git/sccdata/target/classes/META-INF/persistence.xml|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. > {quote} > 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: > {color:#00}[article|[https://knowledgebase.progress.com/articles/Article/Unsupported-protocol-in-URL-reading-XML-from-a-URI].]{color} > {color:#00} {color} > {color:#00}The problem has been reported elsewhere [Stack > Overflow|https://stackoverflow.com/questions/56728487/org-xml-sax-saxparseexceptionpublicid-http-xmlns-jcp-org-xml-ns-persistence-p/56741356#56741356].{color} > -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (OPENJPA-2791) Parsing persistence.xml throws premature end of file error
[ https://issues.apache.org/jira/browse/OPENJPA-2791?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16872451#comment-16872451 ] Francesco Chicchiriccò commented on OPENJPA-2791: - This (more close to OpenJPA's {{XMLMetaDataParser}}) is also working fine: {code} SAXParserFactory saxParserFactory = SAXParserFactory.newInstance(); saxParserFactory.setNamespaceAware(true); saxParserFactory.setValidating(true); SAXParser parser = saxParserFactory.newSAXParser(); parser.setProperty( "http://java.sun.com/xml/jaxp/properties/schemaLanguage;, "http://www.w3.org/2001/XMLSchema;); parser.setProperty( "http://java.sun.com/xml/jaxp/properties/schemaSource;, "https://www.oracle.com/webfolder/technetwork/jsc/xml/ns/persistence/persistence_2_1.xsd;); parser.parse(App.class.getResourceAsStream("/persistence.xml"), new DefaultHandler() { @Override public void error(final SAXParseException e) throws SAXException { throw e; } }); {code} while putting {code} https://xmlns.jcp.org/xml/ns/persistence/persistence_2_1.xsd {code} raises again the exception as above. > Parsing persistence.xml throws premature end of file error > -- > > Key: OPENJPA-2791 > URL: https://issues.apache.org/jira/browse/OPENJPA-2791 > Project: OpenJPA > Issue Type: Bug > Components: build / infrastructure, jpa >Affects Versions: 2.4.3 > Environment: Linux Ubuntu 18.04 >Reporter: Robert F. Peake >Priority: Major > Labels: build > > 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: > {quote}org.xml.sax.SAXException: > [file:/home/robert/git/sccdata/target/classes/META-INF/persistence.xml|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. > {quote} > 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: > {color:#00}[article|[https://knowledgebase.progress.com/articles/Article/Unsupported-protocol-in-URL-reading-XML-from-a-URI].]{color} > {color:#00} {color} > {color:#00}The problem has been reported elsewhere [Stack > Overflow|https://stackoverflow.com/questions/56728487/org-xml-sax-saxparseexceptionpublicid-http-xmlns-jcp-org-xml-ns-persistence-p/56741356#56741356].{color} > -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (OPENJPA-2791) Parsing persistence.xml throws premature end of file error
[ https://issues.apache.org/jira/browse/OPENJPA-2791?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16872442#comment-16872442 ] Francesco Chicchiriccò commented on OPENJPA-2791: - {quote}It doesn't work here because the root of the problem is that the SAXParser cannot handle the HTTPS protocol (either directly or by redirection) {quote} The problem seems to be more following redirects rather than https; if you put [https://www.oracle.com/webfolder/technetwork/jsc/xml/ns/persistence/persistence_2_1.xsd] rather than [https://xmlns.jcp.org/xml/ns/persistence/persistence_2_1.xsd] it should work - at least, it works on some simple spike I've made locally: {code} SchemaFactory schemaFactory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI); Schema schema = schemaFactory.newSchema( new URL("https://www.oracle.com/webfolder/technetwork/jsc/xml/ns/persistence/persistence_2_1.xsd;)); SAXSource source = new SAXSource(new InputSource(App.class.getResourceAsStream("/persistence.xml"))); Validator validator = schema.newValidator(); validator.validate(source); {code} works fine, while putting {code} https://xmlns.jcp.org/xml/ns/persistence/persistence_2_1.xsd {code} raises the "premature end of file" exception as reported above. > Parsing persistence.xml throws premature end of file error > -- > > Key: OPENJPA-2791 > URL: https://issues.apache.org/jira/browse/OPENJPA-2791 > Project: OpenJPA > Issue Type: Bug > Components: build / infrastructure, jpa >Affects Versions: 2.4.3 > Environment: Linux Ubuntu 18.04 >Reporter: Robert F. Peake >Priority: Major > Labels: build > > 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: > {quote}org.xml.sax.SAXException: > [file:/home/robert/git/sccdata/target/classes/META-INF/persistence.xml|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. > {quote} > 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: > {color:#00}[article|[https://knowledgebase.progress.com/articles/Article/Unsupported-protocol-in-URL-reading-XML-from-a-URI].]{color} > {color:#00} {color} > {color:#00}The problem has been reported elsewhere [Stack > Overflow|https://stackoverflow.com/questions/56728487/org-xml-sax-saxparseexceptionpublicid-http-xmlns-jcp-org-xml-ns-persistence-p/56741356#56741356].{color} > -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (OPENJPA-2791) Parsing persistence.xml throws premature end of file error
[ https://issues.apache.org/jira/browse/OPENJPA-2791?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16872372#comment-16872372 ] Robert F. Peake commented on OPENJPA-2791: -- This approach won't work because the root of the problem is that the SAXParser cannot handle the HTTPS protocol. Others have noted that if they revert to JPA 1.0, the parser works, but only because the request is not redirected to HTTPS (yet). Compare: robert@matx:~$ curl -v http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd * Trying 156.151.59.19... * TCP_NODELAY set * Connected to java.sun.com (156.151.59.19) port 80 (#0) > GET /xml/ns/persistence/persistence_1_0.xsd HTTP/1.1 > Host: java.sun.com > User-Agent: curl/7.58.0 > Accept: */* > * HTTP 1.0, assume close after body < HTTP/1.0 301 Moved Permanently < Location: http://www.oracle.com/webfolder/technetwork/jsc/xml/ns/persistence/persistence_1_0.xsd < Server: BigIP < Connection: close < Content-Length: 0 < * Closing connection 0 with: robert@matx:~$ curl -v http://xmlns.jcp.org/xml/ns/persistence/persistence_2_1.xsd * Trying 104.100.103.148... * TCP_NODELAY set * Connected to xmlns.jcp.org (104.100.103.148) port 80 (#0) > GET /xml/ns/persistence/persistence_2_1.xsd HTTP/1.1 > Host: xmlns.jcp.org > User-Agent: curl/7.58.0 > Accept: */* > < HTTP/1.1 301 Moved Permanently < Server: AkamaiGHost < Content-Length: 0 < Location: https://xmlns.jcp.org/xml/ns/persistence/persistence_2_1.xsd < Cache-Control: max-age=0 < Expires: Tue, 25 Jun 2019 13:47:06 GMT < Date: Tue, 25 Jun 2019 13:47:06 GMT < Connection: keep-alive < * Connection #0 to host xmlns.jcp.org left intact Note the line Location: [http://www.oracle.com/webfolder/technetwork/jsc/xml/ns/persistence] in one case and [https://xmlns.jcp.org/xml/ns/persistence/persistence_2_1.xsd.] in the other. The error thrown remains the same: premature end of file. org.apache.openjpa.util.GeneralException: org.xml.sax.SAXException: file:/home/robert/git/sccdata/target/classes/META-INF/persistence.xml [Location: Line: 5, C: 65]: org.xml.sax.SAXParseException; systemId: https://xmlns.jcp.org/xml/ns/persistence/persistence_2_1.xsd; lineNumber: 1; columnNumber: 1; Premature end of file. > Parsing persistence.xml throws premature end of file error > -- > > Key: OPENJPA-2791 > URL: https://issues.apache.org/jira/browse/OPENJPA-2791 > Project: OpenJPA > Issue Type: Bug > Components: build / infrastructure, jpa >Affects Versions: 2.4.3 > Environment: Linux Ubuntu 18.04 >Reporter: Robert F. Peake >Priority: Major > Labels: build > > 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: > {quote}org.xml.sax.SAXException: > [file:/home/robert/git/sccdata/target/classes/META-INF/persistence.xml|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. > {quote} > 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: > {color:#00}[article|[https://knowledgebase.progress.com/articles/Article/Unsupported-protocol-in-URL-reading-XML-from-a-URI].]{color} > {color:#00} {color} > {color:#00}The problem has been reported elsewhere [Stack > Overflow|https://stackoverflow.com/questions/56728487/org-xml-sax-saxparseexceptionpublicid-http-xmlns-jcp-org-xml-ns-persistence-p/56741356#56741356].{color} > -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (OPENJPA-2791) Parsing persistence.xml throws premature end of file error
[ https://issues.apache.org/jira/browse/OPENJPA-2791?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16872265#comment-16872265 ] Francesco Chicchiriccò commented on OPENJPA-2791: - What about simply replacing http://xmlns.jcp.org/xml/ns/persistence/persistence_2_1.xsd with https://xmlns.jcp.org/xml/ns/persistence/persistence_2_1.xsd in your {{persistence.xml}}? > Parsing persistence.xml throws premature end of file error > -- > > Key: OPENJPA-2791 > URL: https://issues.apache.org/jira/browse/OPENJPA-2791 > Project: OpenJPA > Issue Type: Bug > Components: build / infrastructure, jpa >Affects Versions: 2.4.3 > Environment: Linux Ubuntu 18.04 >Reporter: Robert F. Peake >Priority: Major > Labels: build > > 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: > {quote}org.xml.sax.SAXException: > [file:/home/robert/git/sccdata/target/classes/META-INF/persistence.xml|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. > {quote} > 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: > {color:#00}[article|[https://knowledgebase.progress.com/articles/Article/Unsupported-protocol-in-URL-reading-XML-from-a-URI].]{color} > {color:#00} {color} > {color:#00}The problem has been reported elsewhere [Stack > Overflow|https://stackoverflow.com/questions/56728487/org-xml-sax-saxparseexceptionpublicid-http-xmlns-jcp-org-xml-ns-persistence-p/56741356#56741356].{color} > -- This message was sent by Atlassian JIRA (v7.6.3#76005)