Skip to content

Grails Wrapper Fails on Redirect to HTTPS #7

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
JasonTypesCodes opened this issue Jun 8, 2021 · 10 comments · Fixed by #8
Closed

Grails Wrapper Fails on Redirect to HTTPS #7

JasonTypesCodes opened this issue Jun 8, 2021 · 10 comments · Fixed by #8
Assignees

Comments

@JasonTypesCodes
Copy link

Discovered during apache/grails-core#11825

With the $HOME/.grails/wrapper cache I can run the ./grailsw locally or in our pipelines and everything works, but when there is no cache and the grailsw is run for the first time I receive this message:

You must be connected to the internet the first time you use the Grails wrapper
org.xml.sax.SAXParseException; lineNumber: 6; columnNumber: 3; The element type "hr" must be terminated by the matching end-tag "</hr>".
        at java.xml/com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(ErrorHandlerWrapper.java:204)
        at java.xml/com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.fatalError(ErrorHandlerWrapper.java:178)
        at java.xml/com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:400)
        at java.xml/com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:327)
        at java.xml/com.sun.org.apache.xerces.internal.impl.XMLScanner.reportFatalError(XMLScanner.java:1471)
        at java.xml/com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanEndElement(XMLDocumentFragmentScannerImpl.java:1685)
        at java.xml/com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(XMLDocumentFragmentScannerImpl.java:2883)
        at java.xml/com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:605)
        at java.xml/com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:534)
        at java.xml/com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:888)
        at java.xml/com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:824)
        at java.xml/com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:141)
        at java.xml/com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1216)
        at java.xml/com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(SAXParserImpl.java:635)
        at java.xml/com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl.parse(SAXParserImpl.java:324)
        at java.xml/javax.xml.parsers.SAXParser.parse(SAXParser.java:197)
        at grails.init.Start.getVersion(Start.java:36)
        at grails.init.Start.main(Start.java:83)
@JasonTypesCodes
Copy link
Author

It seems that what is happening, is the base url is hardcoded to use http and the repository returns a permanent redirect:

< HTTP/1.1 308 Permanent Redirect
< Date: Tue, 08 Jun 2021 17:28:11 GMT
< Content-Type: text/html
< Content-Length: 164
< Connection: keep-alive
< Location: https://repo.grails.org/grails/core/org/grails/grails4_1-wrapper/maven-metadata.xml
< X-Request-ID: d0cbcb3afa75da42b3890f2e0ac944e5
< 
<html>
<head><title>308 Permanent Redirect</title></head>
<body>
<center><h1>308 Permanent Redirect</h1></center>
<hr><center>nginx</center>
</body>
</html>

The lone <hr> tag is causing errors with the SAX Parser

@jeffscottbrown
Copy link

Related to #5.

@puneetbehl puneetbehl linked a pull request Jun 10, 2021 that will close this issue
puneetbehl added a commit that referenced this issue Jun 10, 2021
* Fixes #7
* Update Grails Artifactory URL to HTTPS
* Flexibility to override Grails Artifactory base URL via SystemProperty or Environment variable.
JasonTypesCodes added a commit to apache/grails-static-website that referenced this issue Jun 10, 2021
@JasonTypesCodes
Copy link
Author

We are putting together patch releases for Grails 4 and Grails 3 for this issue. For existing projects, you can update the grails-wrapper.jar in the base of your project to an updated one. More details and updated jar files are here: https://grails.org/blog/2021-06-10-grails-wrapper-update.html

@JasonTypesCodes
Copy link
Author

I'm leaving this issue open for a bit to collect feedback on these updated jars

@dacuna39
Copy link

We are putting together patch releases for Grails 4 and Grails 3 for this issue. For existing projects, you can update the grails-wrapper.jar in the base of your project to an updated one. More details and updated jar files are here: https://grails.org/blog/2021-06-10-grails-wrapper-update.html

Is there an updated grails-wrapper.jar file for Grails 2 as well? Please let me know, thank you for working on this

@JasonTypesCodes
Copy link
Author

Is there an updated grails-wrapper.jar file for Grails 2 as well? Please let me know, thank you for working on this

@dacuna39 I have not witnessed this error in a Grails 2 application. If you are seeing this problem, please let us know what version of Grails you are using and the specific behavior you are seeing

@dacuna39
Copy link

@JasonTypesCodes I'm using grails 2.4.5. I updated the repo urls

mavenRepo "https://repo.grails.org/artifactory/core/"
mavenRepo "https://repo.grails.org/artifactory/plugins/"

It works on local but this error occurs on CI

| Loading Grails 2.4.5
| Configuring classpath
| Error Resolve error obtaining dependencies: The following artifacts could not be resolved: org.apache.httpcomponents:httpcore:jar:4.3.2, org.apache.httpcomponents:httpclient:jar:4.3.2, org.grails.plugins:tomcat:zip:8.0.30: Could not transfer artifact org.apache.httpcomponents:httpcore:jar:4.3.2 from/to grailsCentral (https://repo.grails.org/grails/plugins): Received fatal alert: handshake_failure (Use --stacktrace to see the full trace)
| Error Resolve error obtaining dependencies: The following artifacts could not be resolved: cglib:cglib-nodep:jar:2.2.2, org.apache.httpcomponents:httpcore:jar:4.3.2, org.apache.httpcomponents:httpclient:jar:4.3.2, com.github.groovy-wslite:groovy-wslite:jar:1.1.0, org.postgresql:postgresql:jar:9.4-1206-jdbc41, org.elasticmq:elasticmq-rest-sqs_2.11:jar:0.8.12, org.jadira.usertype:usertype.jodatime:jar:2.0.1, com.google.guava:guava:jar:17.0, dnsjava:dnsjava:jar:2.1.7, jmimemagic:jmimemagic:jar:0.1.2, com.twelvemonkeys.imageio:imageio-ico:jar:3.0.2, org.im4java:im4java:jar:1.4.0, org.imgscalr:imgscalr-lib:jar:4.2, org.flywaydb:flyway-core:jar:3.0, org.rythmengine:rythm-engine:jar:1.0.1, org.jsoup:jsoup:jar:1.8.1, org.codehaus.groovy.modules.http-builder:http-builder:jar:0.7.1, com.pusher:pusher-http-java:jar:1.0.0, com.cedarsoftware:json-io:jar:2.7.2, org.apache.ws.security:wss4j:jar:1.6.17, org.apache.cxf:cxf-rt-ws-security:jar:2.6.2, org.apache.activemq:activemq-core:jar:5.7.0, org.apache.commons:commons-csv:jar:1.2, org.apache.tika:tika-core:jar:1.12, org.projectlombok:lombok:jar:1.16.2, commons-io:commons-io:jar:2.4, commons-fileupload:commons-fileupload:jar:1.3, org.multiverse:multiverse-core:jar:0.7.0, com.itextpdf.tool:xmlworker:jar:5.5.8, com.stripe:stripe-java:jar:10.9.0, org.grails.plugins:aws-sdk:zip:1.10.44, org.grails.plugins:scaffolding:zip:2.1.2, org.grails.plugins:cache:zip:1.1.8, org.grails.plugins:asset-pipeline:zip:2.1.5, org.grails.plugins:mail:zip:1.0.7, org.grails.plugins:hibernate:zip:3.6.10.19, org.grails.plugins:database-migration:zip:1.4.0, org.grails.plugins:jquery:zip:1.11.0.2, org.grails.plugins:multi-tenant-single-db:zip:0.8.3, org.grails.plugins:build-test-data:zip:2.4.0, org.grails.plugins:spring-security-core:zip:2.0-RC3, org.grails.plugins:spring-security-rest:zip:1.4.1.RC1, org.grails.plugins:gflyway2:zip:0.4.1, org.grails.plugins:functional-test-development:zip:0.9.3, org.grails.plugins:quartz:zip:1.0.1, org.grails.plugins:platform-core:zip:1.0.0, org.grails.plugins:jms:zip:1.3-SNAPSHOT, org.grails.plugins:remote-control:zip:1.5, org.grails.plugins:rest-client-builder:zip:2.1.1, org.grails.plugins:joda-time:zip:1.5: Could not transfer artifact cglib:cglib-nodep:jar:2.2.2 from/to grailsCentral (https://repo.grails.org/grails/plugins): Received fatal alert: handshake_failure (Use --stacktrace to see the full trace)
| Error Resolve error obtaining dependencies: The following artifacts could not be resolved: org.apache.httpcomponents:httpcore:jar:4.3.2, org.apache.httpcomponents:httpclient:jar:4.3.2, com.github.groovy-wslite:groovy-wslite:jar:1.1.0, org.postgresql:postgresql:jar:9.4-1206-jdbc41, org.elasticmq:elasticmq-rest-sqs_2.11:jar:0.8.12, org.jadira.usertype:usertype.jodatime:jar:2.0.1, com.google.guava:guava:jar:17.0, dnsjava:dnsjava:jar:2.1.7, jmimemagic:jmimemagic:jar:0.1.2, com.twelvemonkeys.imageio:imageio-ico:jar:3.0.2, org.im4java:im4java:jar:1.4.0, org.imgscalr:imgscalr-lib:jar:4.2, org.flywaydb:flyway-core:jar:3.0, org.rythmengine:rythm-engine:jar:1.0.1, org.jsoup:jsoup:jar:1.8.1, org.codehaus.groovy.modules.http-builder:http-builder:jar:0.7.1, com.pusher:pusher-http-java:jar:1.0.0, com.cedarsoftware:json-io:jar:2.7.2, org.apache.ws.security:wss4j:jar:1.6.17, org.apache.cxf:cxf-rt-ws-security:jar:2.6.2, org.apache.activemq:activemq-core:jar:5.7.0, org.apache.commons:commons-csv:jar:1.2, org.apache.tika:tika-core:jar:1.12, org.projectlombok:lombok:jar:1.16.2, commons-io:commons-io:jar:2.4, commons-fileupload:commons-fileupload:jar:1.3, org.multiverse:multiverse-core:jar:0.7.0, com.itextpdf.tool:xmlworker:jar:5.5.8, com.stripe:stripe-java:jar:10.9.0, org.grails.plugins:aws-sdk:zip:1.10.44, org.grails.plugins:scaffolding:zip:2.1.2, org.grails.plugins:cache:zip:1.1.8, org.grails.plugins:asset-pipeline:zip:2.1.5, org.grails.plugins:mail:zip:1.0.7, org.grails.plugins:hibernate:zip:3.6.10.19, org.grails.plugins:database-migration:zip:1.4.0, org.grails.plugins:jquery:zip:1.11.0.2, org.grails.plugins:multi-tenant-single-db:zip:0.8.3, org.grails.plugins:build-test-data:zip:2.4.0, org.grails.plugins:spring-security-core:zip:2.0-RC3, org.grails.plugins:spring-security-rest:zip:1.4.1.RC1, org.grails.plugins:gflyway2:zip:0.4.1, org.grails.plugins:functional-test-development:zip:0.9.3, org.grails.plugins:quartz:zip:1.0.1, org.grails.plugins:platform-core:zip:1.0.0, org.grails.plugins:jms:zip:1.3-SNAPSHOT, org.grails.plugins:remote-control:zip:1.5, org.grails.plugins:rest-client-builder:zip:2.1.1, org.grails.plugins:joda-time:zip:1.5: Could not transfer artifact org.apache.httpcomponents:httpcore:jar:4.3.2 from/to grailsCentral (https://repo.grails.org/grails/plugins): Received fatal alert: handshake_failure (Use --stacktrace to see the full trace)
| Error Resolve error obtaining dependencies: The following artifacts could not be resolved: org.elasticmq:elasticmq-rest-sqs_2.11:jar:0.8.12, org.jadira.usertype:usertype.jodatime:jar:2.0.1, com.google.guava:guava:jar:17.0, dnsjava:dnsjava:jar:2.1.7, jmimemagic:jmimemagic:jar:0.1.2, com.twelvemonkeys.imageio:imageio-ico:jar:3.0.2, org.im4java:im4java:jar:1.4.0, org.imgscalr:imgscalr-lib:jar:4.2, org.flywaydb:flyway-core:jar:3.0, org.rythmengine:rythm-engine:jar:1.0.1, org.jsoup:jsoup:jar:1.8.1, org.codehaus.groovy.modules.http-builder:http-builder:jar:0.7.1, com.pusher:pusher-http-java:jar:1.0.0, com.cedarsoftware:json-io:jar:2.7.2, org.apache.ws.security:wss4j:jar:1.6.17, org.apache.cxf:cxf-rt-ws-security:jar:2.6.2, org.apache.activemq:activemq-core:jar:5.7.0, org.apache.commons:commons-csv:jar:1.2, org.apache.tika:tika-core:jar:1.12, org.projectlombok:lombok:jar:1.16.2, commons-io:commons-io:jar:2.4, commons-fileupload:commons-fileupload:jar:1.3, org.multiverse:multiverse-core:jar:0.7.0, com.itextpdf.tool:xmlworker:jar:5.5.8, com.stripe:stripe-java:jar:10.9.0, org.grails.plugins:aws-sdk:zip:1.10.44, org.grails.plugins:scaffolding:zip:2.1.2, org.grails.plugins:cache:zip:1.1.8, org.grails.plugins:asset-pipeline:zip:2.1.5, org.grails.plugins:mail:zip:1.0.7, org.grails.plugins:multi-tenant-single-db:zip:0.8.3, org.grails.plugins:build-test-data:zip:2.4.0, org.grails.plugins:spring-security-core:zip:2.0-RC3, org.grails.plugins:spring-security-rest:zip:1.4.1.RC1, org.grails.plugins:gflyway2:zip:0.4.1, org.grails.plugins:functional-test-development:zip:0.9.3, org.grails.plugins:quartz:zip:1.0.1, org.grails.plugins:platform-core:zip:1.0.0, org.grails.plugins:jms:zip:1.3-SNAPSHOT, org.grails.plugins:remote-control:zip:1.5, org.grails.plugins:rest-client-builder:zip:2.1.1, org.grails.plugins:joda-time:zip:1.5: Could not transfer artifact org.elasticmq:elasticmq-rest-sqs_2.11:jar:0.8.12 from/to grailsCentral (https://repo.grails.org/grails/plugins): Received fatal alert: handshake_failure (Use --stacktrace to see the full trace)
| Error The following artifacts could not be resolved: org.apache.httpcomponents:httpcore:jar:4.3.2, org.apache.httpcomponents:httpclient:jar:4.3.2, org.grails.plugins:tomcat:zip:8.0.30: Could not transfer artifact org.apache.httpcomponents:httpcore:jar:4.3.2 from/to grailsCentral (https://repo.grails.org/grails/plugins): Received fatal alert: handshake_failure
| Run 'grails dependency-report' for further information.

@JasonTypesCodes
Copy link
Author

It works on local but this error occurs on CI

@dacuna39 this appears to be an issue establishing the TLS connection. I don't know the details of your CI machine or which version of Java you are using. If you are on Java 7, the suggestion in this comment may help: apache/grails-core#11825 (comment)

If you continue to experience issues, please open a new issue with the complete stacktrace and runtime information so we can look into it further

@dacuna39
Copy link

@JasonTypesCodes That comment's solution worked. It was indeed the TLS on Java 7, I must have missed that comment. Thanks for the help

@JasonTypesCodes
Copy link
Author

I think we can close this issue. If additional problems are encountered, please open a new issue. Thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants