Maven Connection Reset error

12,739

Solution 1

I used the following flag and it downloaded everything successfully.

-Dhttps.protocols=TLSv1.2

Solution 2

I had proxy issue

update V:\Ecomm\apache-maven-3.6.1\conf\settings.xml

sample:


<proxies>
   <proxy>
      <id>example-proxy</id>
      <active>true</active>
      <protocol>http</protocol>
      <host>proxy.example.com</host>
      <port>8080</port>
      <username>proxyuser</username>
      <password>somepassword</password>
      <nonProxyHosts>www.google.com|*.example.com</nonProxyHosts>
    </proxy>
  </proxies>
Share:
12,739
Lav
Author by

Lav

Updated on June 17, 2022

Comments

  • Lav
    Lav almost 2 years

    I have a maven project on linux. It was building fine until last week. Today I am getting below error

    [ERROR] Failed to execute goal on project my-integration-service: Could not resolve
    dependencies for project com.mycompany.myproj:my-integration-service:jar:0.0.1-SNAPSHOT:
    Failed to collect dependencies for [org.springframework:spring-core:jar:4.0.4.RELEASE
    (compile), org.springframework:spring-tx:jar:4.0.4.RELEASE (compile), ...]: No versions
    available for joda-time:joda-time:jar:[2.2,) within specified range -> [Help 1]
    

    I checked my settings.xml , and in local repository I can see the many versions of this... library 2.2 , 2.4 ... 2.9.1

    I also saw the file M2_REPO/joda-time/joda-time/resolver-status.properties

    maven-metadata-codehaus.xml.error=Could not transfer metadata joda-time\:joda-time/maven-metadata.xml from/to codehaus (http\://repository.codehaus.org/org/codehaus)\: Error transferring file\: repository.codehaus.org
    ...
    maven-metadata-spring-milestone.xml.error=Could not transfer metadata joda-time\:joda-time/maven-metadata.xml from/to spring-milestone (http\://maven.springframework.org/milestone)\: Error transferring file\: Connection reset
    ....
    maven-metadata-com.springsource.repository.maven.releases.xml.error=Could not transfer metadata joda-time\:joda-time/maven-metadata.xml from/to com.springsource.repository.maven.releases (http\://maven.springframework.org/release)\: Error transferring file\: Connection reset
    ...
    maven-metadata-just-testing.xml.error=Could not transfer metadata joda-time\:joda-time/maven-metadata.xml from/to just-testing (http\://repo1.maven.org/maven2)\: Access denied to\: http\://repo1.maven.org/maven2/joda-time/joda-time/maven-metadata.xml
    ...
    maven-metadata-apache.snapshots.xml.error=Could not transfer metadata joda-time\:joda-time/maven-metadata.xml from/to apache.snapshots (http\://repository.apache.org/snapshots/)\: Error transferring file\: Connection reset
    ...
    maven-metadata-maven-restlet.xml.error=Could not transfer metadata joda-time\:joda-time/maven-metadata.xml from/to maven-restlet (http\://maven.restlet.org)\: Error transferring file\: Connection reset
    

    Also I ran command mvn -X archetype:generate as suggested What could be causing 'error transferring file' in maven?

    [WARNING] Error reading archetype catalog http://repo1.maven.org/maven2
    org.apache.maven.wagon.TransferFailedException: Error transferring file: Connection reset
            at org.apache.maven.wagon.providers.http.LightweightHttpWagon.fillInputData(LightweightHttpWagon.java:143)
            at org.apache.maven.wagon.StreamWagon.getInputStream(StreamWagon.java:116)
            at org.apache.maven.wagon.StreamWagon.getIfNewer(StreamWagon.java:88)
            ....
            ....
            at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:352)
    Caused by: java.net.SocketException: Connection reset
            at java.net.SocketInputStream.read(SocketInputStream.java:196)
            at java.net.SocketInputStream.read(SocketInputStream.java:122)
            at java.io.BufferedInputStream.fill(BufferedInputStream.java:235)
            at java.io.BufferedInputStream.read1(BufferedInputStream.java:275)
            at java.io.BufferedInputStream.read(BufferedInputStream.java:334)
            at sun.net.www.http.HttpClient.parseHTTPHeader(HttpClient.java:687)
            at sun.net.www.http.HttpClient.parseHTTP(HttpClient.java:633)
            at sun.net.www.http.HttpClient.parseHTTP(HttpClient.java:658)
            at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1323)
            at java.net.HttpURLConnection.getResponseCode(HttpURLConnection.java:468)
            at org.apache.maven.wagon.providers.http.LightweightHttpWagon.fillInputData(LightweightHttpWagon.java:115)
            ... 31 more
    [WARNING] No archetype found in remote catalog. Defaulting to internal catalog
    [DEBUG] Using catalog /wmchome/hfundadm/.m2/archetype-catalog.xml
    [INFO] No archetype defined. Using maven-archetype-quickstart (org.apache.maven.archetypes:maven-archetype-quickstart:1.0)
    Choose archetype
    

    Not very sure what could cause this error?

    1. any port blocked? If so then why error in 1 file only ?
    2. not sure if local_repository is being ignored ? it has needed file there
    3. List item

    Using Apache Maven 3.0.3 (r1075438; 2011-02-28 12:31:09-0500)

    <profile>
          <id>defaultProfile</id>
          <activation>
            <activeByDefault>true</activeByDefault>
          </activation>
          <repositories>
            <repository>
              <id>central</id>
              <url>http://my-mvn-repo/repo</url>
                <snapshots>
                  <enabled>true</enabled>
                  <updatePolicy>always</updatePolicy>
                </snapshots>
                <releases>
                  <enabled>true</enabled>
                </releases>
            </repository>
          </repositories>
          <pluginRepositories>
            <pluginRepository>
              <id>central</id>
              <url>http://my-mvn-repo/repo</url>
                <releases>
                  <enabled>true</enabled>
                </releases>
            </pluginRepository>
          </pluginRepositories>
          <properties>
            <downloadSources>true</downloadSources>
            <downloadJavadocs>true</downloadJavadocs>
          </properties>
    </profile>
    

    but I don't see any server with <id> as central, there are many servers... not sure which one is being used

    <server>
            <id>abccommon_id</id> 
            <username>abccommon_adm</username>
            <password>****</password>
    </server>
    
  • Lav
    Lav over 8 years
    strange , it was working fine last week , let me rechek
  • Lav
    Lav over 8 years
    i could access this link from my browser , will have to check which user the build script is using
  • Lav
    Lav over 8 years
    Hi Geeth , as per the tutorial here tutorialspoint.com/maven/maven_repositories.htm , maven 1st searches in local repo , then central repo , last remote repo ... and in my case i can see the jar file present in local repo , and also central repo one with access denied error doesnt seem to have a password its open for all ( correct me if wrong )
  • JGCW
    JGCW over 8 years
    but did you check your credentials?
  • khmarbaise
    khmarbaise over 8 years
    Accessing via browser is something different than accessing with Maven...often browser have SSO mechanism and may be proxy accesses configured which you usually don't configured in Maven settings.xml file...
  • Lav
    Lav over 8 years
    updated the ques , there are many server configured , didn't see any one configured as central .... unable to decide which one is being used ... as different teams seem to have put in entries there
  • MartinTeeVarga
    MartinTeeVarga about 8 years
    Credentials to access public maven central repository?
  • keiki
    keiki about 3 years
    Someone has an explanation why this solves the issue?
  • Vitalii Diravka
    Vitalii Diravka about 3 years
    explicit version of Transport Layer Security?!