Reputation: 106
I'm a freshman for the spring framework. I generate project from start.spring.io and now I try to run it. when I try it, I have to face following exception, (I use TomCat server) plz..give solution for this,
===========================Exception=============================
G:\courses\Course-projects\spring-projects\S5Guru\spring5webapp>mvnw spring-boot:run
Exception in thread "main" java.net.UnknownHostException: repo.maven.apache.org
at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:184)
at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:172)
at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
at java.net.Socket.connect(Socket.java:589)
at sun.security.ssl.SSLSocketImpl.connect(SSLSocketImpl.java:668)
at sun.security.ssl.BaseSSLSocketImpl.connect(BaseSSLSocketImpl.java:173)
at sun.net.NetworkClient.doConnect(NetworkClient.java:180)
at sun.net.www.http.HttpClient.openServer(HttpClient.java:432)
at sun.net.www.http.HttpClient.openServer(HttpClient.java:527)
at sun.net.www.protocol.https.HttpsClient.<init>(HttpsClient.java:264)
at sun.net.www.protocol.https.HttpsClient.New(HttpsClient.java:367)
at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.getNewHttpClient(AbstractDelegateHttpsURLConnection.java:191)
at sun.net.www.protocol.http.HttpURLConnection.plainConnect0(HttpURLConnection.java:1138)
at sun.net.www.protocol.http.HttpURLConnection.plainConnect(HttpURLConnection.java:1032)
at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.connect(AbstractDelegateHttpsURLConnection.java:177)
at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1546)
at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1474)
at sun.net.www.protocol.https.HttpsURLConnectionImpl.getInputStream(HttpsURLConnectionImpl.java:254)
at org.apache.maven.wrapper.DefaultDownloader.downloadInternal(DefaultDownloader.java:90)
at org.apache.maven.wrapper.DefaultDownloader.download(DefaultDownloader.java:76)
at org.apache.maven.wrapper.Installer.createDist(Installer.java:72)
at org.apache.maven.wrapper.WrapperExecutor.execute(WrapperExecutor.java:121)
at org.apache.maven.wrapper.MavenWrapperMain.main(MavenWrapperMain.java:61)
Upvotes: 5
Views: 12466
Reputation: 173
This problem occurs when there's a proxy server, e.g. in a company network. To solve this, create file HOME/.mvn/jvm.config with this content:
-Dhttp.proxyHost=<proxy-server>
-Dhttp.proxyPort=8080
-Dhttp.proxyUser=<user>
-Dhttp.proxyPassword=<password>
-Dhttps.proxyHost=<proxy-server>
-Dhttps.proxyPort=8080
-Dhttps.proxyUser=<user>
-Dhttps.proxyPassword=<password>
Upvotes: 6
Reputation: 1311
I had same probleme, it was my Internet Provider's fault, their DNS server could not resolve repo.maven.apache.org
.
I switched to 4G internet connection and it's worked.
Upvotes: 3
Reputation: 12367
Having working internet connection if necessary for this.
Upvotes: -1