Background
I haven’t used Grails in a while so I chose to use it for a small web application I needed to build yesterday. Mostly because I wanted to see what was new in version 3.2.4. I have a bit of a history with Grails, it’s now like a running joke with me that almost every single time I use Grails, I have to struggle through some weird setup issue. So I was really curious what today’s problem would be.
The Problem: Error occurred running Grails CLI: proxy
I downloaded the new version and set up my PATH, JAVA_HOME, and GRAILS_HOME. Crossing my fingers, I tried to create a simple hello world app:
grails create-app HelloWorld
And true to my luck, something went wrong. Grails gave me the following lovely error.
Error occurred running Grails CLI: proxy (Click for stack trace)
Error occurred running Grails CLI: proxy (NOTE: Stack trace has been filtered. Use --verbose to see entire trace.)
java.net.UnknownHostException: proxy
at org.apache.http.impl.conn.SystemDefaultDnsResolver.resolve(SystemDefaultDnsResolver.java:45)
at org.apache.http.impl.conn.DefaultClientConnectionOperator.resolveHostname(DefaultClientConnectionOperator.java:278)
at org.apache.http.impl.conn.DefaultClientConnectionOperator.openConnection(DefaultClientConnectionOperator.java:162)
at org.apache.http.impl.conn.ManagedClientConnectionImpl.open(ManagedClientConnectionImpl.java:294)
at org.apache.http.impl.client.DefaultRequestDirector.tryConnect(DefaultRequestDirector.java:643)
at org.apache.http.impl.client.DefaultRequestDirector.execute(DefaultRequestDirector.java:479)
at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:906)
at org.apache.http.impl.client.DecompressingHttpClient.execute(DecompressingHttpClient.java:137)
at org.eclipse.aether.transport.http.HttpTransporter.execute(HttpTransporter.java:287)
at org.eclipse.aether.transport.http.HttpTransporter.implGet(HttpTransporter.java:243)
at org.eclipse.aether.spi.connector.transport.AbstractTransporter.get(AbstractTransporter.java:59)
at org.eclipse.aether.connector.basic.BasicRepositoryConnector$GetTaskRunner.runTask(BasicRepositoryConnector.java:447)
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:317)
at org.springframework.boot.cli.compiler.grape.AetherGrapeEngine.resolve(AetherGrapeEngine.java:299)
at org.springframework.boot.cli.compiler.grape.AetherGrapeEngine.resolve(AetherGrapeEngine.java:291)
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:333)
at org.grails.cli.GrailsCli.execute(GrailsCli.groovy:234)
at org.grails.cli.GrailsCli.main(GrailsCli.groovy:159)Error |
Error occurred running Grails CLI: proxy
At first glance, it looks like I have a proxy problem, and google seems to agree. Searching that error led me to posts claiming I needed to fix my proxy settings, maybe pass them along in GRAILS_OPTS, then offer up a goat sacrifice to the vengeful Grails gods to atone for using meteor.
There is one really small, insignificant, little problem though… I’m not behind a proxy.
Solution
It took me 2 hours to find the source of the problem. It turns out I had a leftover folder from long long ago in my home directory.
.m2
This was the source of all my misery, it wasn’t a proxy problem. Grails, for some reason, was looking for a host which was named “proxy”. I deleted the folder and alles klar.
So side note, when upgrading to 3 from 2 please delete those .<folders> created in your home directory. Just like when you have a weird problem while working in Grails, using the “clean” can sometimes fix it.