[ 
https://issues.apache.org/jira/browse/OPENJPA-2791?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=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.

<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: 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:#000000}[article|[https://knowledgebase.progress.com/articles/Article/Unsupported-protocol-in-URL-reading-XML-from-a-URI].]{color}
> {color:#000000} {color}
> {color:#000000}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)

Reply via email to