Home Error occurred running Grails CLI: Unknown Host (504)
Reply: 1

Error occurred running Grails CLI: Unknown Host (504)

imarchuang
1#
imarchuang Published in 2018-01-09 14:46:58Z

I got an error Unknown Host (504) when I tried to start grails 3.3.2, and the details shows below:

$ grails --stacktrace --verbose
| Error Error occurred running Grails CLI: Unknown Host (504)
org.apache.http.client.HttpResponseException: Unknown Host (504)
    at org.eclipse.aether.transport.http.HttpTransporter.handleStatus(HttpTransporter.java:466)
    at org.eclipse.aether.transport.http.HttpTransporter.execute(HttpTransporter.java:291)
    at org.eclipse.aether.transport.http.HttpTransporter.implPeek(HttpTransporter.java:231)
    at org.eclipse.aether.spi.connector.transport.AbstractTransporter.peek(AbstractTransporter.java:43)
    at org.eclipse.aether.connector.basic.BasicRepositoryConnector$PeekTaskRunner.runTask(BasicRepositoryConnector.java:376)
    at org.eclipse.aether.connector.basic.BasicRepositoryConnector$TaskRunner.run(BasicRepositoryConnector.java:350)
    at org.eclipse.aether.util.concurrency.RunnableErrorForwarder$1.run(RunnableErrorForwarder.java:67)
    at org.eclipse.aether.connector.basic.BasicRepositoryConnector$DirectExecutor.execute(BasicRepositoryConnector.java:581)
    at org.eclipse.aether.connector.basic.BasicRepositoryConnector.get(BasicRepositoryConnector.java:249)
    at org.eclipse.aether.internal.impl.DefaultArtifactResolver.performDownloads(DefaultArtifactResolver.java:520)
    at org.eclipse.aether.internal.impl.DefaultArtifactResolver.resolve(DefaultArtifactResolver.java:421)
    at org.eclipse.aether.internal.impl.DefaultArtifactResolver.resolveArtifacts(DefaultArtifactResolver.java:246)
    at org.eclipse.aether.internal.impl.DefaultArtifactResolver.resolveArtifact(DefaultArtifactResolver.java:223)
    at org.apache.maven.repository.internal.DefaultArtifactDescriptorReader.loadPom(DefaultArtifactDescriptorReader.java:320)
    at org.apache.maven.repository.internal.DefaultArtifactDescriptorReader.readArtifactDescriptor(DefaultArtifactDescriptorReader.java:217)
    at org.eclipse.aether.internal.impl.DefaultDependencyCollector.resolveCachedArtifactDescriptor(DefaultDependencyCollector.java:535)
    at org.eclipse.aether.internal.impl.DefaultDependencyCollector.getArtifactDescriptorResult(DefaultDependencyCollector.java:519)
    at org.eclipse.aether.internal.impl.DefaultDependencyCollector.processDependency(DefaultDependencyCollector.java:409)
    at org.eclipse.aether.internal.impl.DefaultDependencyCollector.processDependency(DefaultDependencyCollector.java:363)
    at org.eclipse.aether.internal.impl.DefaultDependencyCollector.process(DefaultDependencyCollector.java:351)
    at org.eclipse.aether.internal.impl.DefaultDependencyCollector.collectDependencies(DefaultDependencyCollector.java:254)
    at org.eclipse.aether.internal.impl.DefaultRepositorySystem.resolveDependencies(DefaultRepositorySystem.java:341)
    at org.springframework.boot.cli.compiler.grape.AetherGrapeEngine.resolve(AetherGrapeEngine.java:319)
    at org.springframework.boot.cli.compiler.grape.AetherGrapeEngine.resolve(AetherGrapeEngine.java:301)
    at org.springframework.boot.cli.compiler.grape.AetherGrapeEngine.resolve(AetherGrapeEngine.java:293)
    at org.grails.cli.boot.GrailsDependencyVersions.<init>(GrailsDependencyVersions.groovy:53)
    at org.grails.cli.boot.GrailsDependencyVersions.<init>(GrailsDependencyVersions.groovy:49)
    at org.grails.cli.profile.repository.MavenProfileRepository.<init>(MavenProfileRepository.groovy:53)
    at org.grails.cli.GrailsCli.createMavenProfileRepository(GrailsCli.groovy:334)
    at org.grails.cli.GrailsCli.execute(GrailsCli.groovy:235)
    at org.grails.cli.GrailsCli.main(GrailsCli.groovy:159)
| Error Error occurred running Grails CLI: Unknown Host (504)

Here is my version info:

$ grails -v
| Grails Version: 3.3.2
| Groovy Version: 2.4.13
| JVM Version: 1.8.0_121

Extra info: I am running it on Mac behind a proxy network. I've added the following statement into my bin/grails (/Users/foouser/.sdkman/candidates/grails/current/bin/grails) script:

export GRAILS_OPTS="-Dhttp.proxyHost=myHttpProxy -Dhttp.proxyPort=8000 -Dhttps.proxyHost=myHttpsProxy -Dhttps.proxyPort=443"

imarchuang
2#
imarchuang Reply to 2018-01-09 15:19:27Z

After few trials and errors, I found this org.eclipse.aether.internal.impl.DefaultRepositorySystem is actually trying to read and parse my $HOME/.m2/settings.xml. And below it was my original settings.xml:

<settings xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.1.0 http://maven.apache.org/xsd/settings-1.1.0.xsd"
  xmlns="http://maven.apache.org/SETTINGS/1.1.0"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <proxies>
    <proxy>
        <id>proxy</id>
        <active>true</active>
        <protocol>http</protocol>
        <host>myHttpProxy</host>
        <port>8000</port>
    </proxy>
    <proxy>
        <id>httpsproxy</id>
        <active>true</active>
        <protocol>https</protocol>
        <host>myHttpProxy</host>
        <port>443</port>
    </proxy>
  </proxies>
  <servers>
    <server>
      <username>myname</username>
      <password>mypassword</password>
      <id>Artifactory</id>
    </server>
  </servers>
  <mirrors>
    <mirror>
      <id>Artifactory</id>
      <!-- Drive all repositories through the Artifactory mirror  -->
      <mirrorOf>*</mirrorOf>
      <url>http://myartifactoryurl</url>
    </mirror>
  </mirrors>
</settings>

Unfortunately, it wasn't parsed well...

The current workaround (a bad one though) I have is to change this settings.xml to the default one from maven, which has nothing setup there.

You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.333405 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO