mvn deploy snapshot to nexus oss failed with return code 500 internal error

17,551

Solution 1

Nexus requires a Servlet 3.0 compliant container. It comes bundled with a Servlet 3.0 compliant Jetty 8. If you deploy it on another container you have to make sure it is compliant. Couldn't find this in the documtation but from own experience it seems to be the case.

When you

HTTP GET http://xxx.xxx.com:8080/nexus/content/repositories/snapshots/com/xxx/utils/licm/0.2.9-SNAPSHOT/maven-metadata.xml

in a browser you should be able to see the stacktrace, which contains

java.lang.NoSuchMethodError: javax.servlet.http.HttpServletResponse.getStatus()

This is only available in Servlet 3.0 containers.

Solution 2

I've encountered the same return code (500) and reason (Internal server error), and finnaly found that the nexus server disk space is full. :) Checking the nexus log in the server could find this clue.

Solution 3

Answer myself.

When the nexus server can't find the maven-metadata.xml,it will cause tomcat throw an exception,this is the problem

I change the Tomcat version from 6.x to 7.0.x,everything is ok

Solution 4

This was the error reported as similar in my case:

Failed to transfer file: 
 http://192.168.0.2:8080/repository/maven-snapshots/org/xxxx/xxx-yyy/1.0-SNAPSHOT/maven-metadata.xml. 
Return code is: 500 , ReasonPhrase:Server Error.

In my case after doing the http file verification suggested by @hansi, the server response was javax.servlet.ServletException: java.lang.NumberFormatException: null.

After doing some review about what causes this, I found that is is because a problem with the artifact creation timestamp. In my case the maven-metadata.xml was corrupted and it was caused by a reboot in the server that adjusted the time automatically after the daylight saving time was in efect. I got a clue about it in this post https://issues.sonatype.org/browse/NEXUS-12496

What worked in my case was to delete the maven-metadata.xml in all the artifact references. After that the error was corrected.

Share:
17,551
Admin
Author by

Admin

Updated on June 05, 2022

Comments

  • Admin
    Admin almost 2 years

    I use maven to deploy artifact to sonatype nexus,I can perform release action normally,but deploy snapshots failed.

    • sonatype nexus 2.7.0.5
    • Java 1.7
    • maven 3.0.5

      1. mvn release:prepare;mvn release:perform; successful without any error
      2. mvn deploy failed with return code 500
    [INFO] maven-jar-plugin:2.4:jar (default-jar) @ licm 
    [INFO] Building jar: /foo/licm/trunk/target/licm-0.2.9-SNAPSHOT.jar
    [INFO]
    [INFO] maven-install-plugin:2.3.1:install (default-install) @ licm
    [INFO] Installing /foo/licm/trunk/target/licm-0.2.9-SNAPSHOT.jar to /foo/.m2/repository/com/xxx/utils/licm/0.2.9-SNAPSHOT/licm-0.2.9-SNAPSHOT.jar
    [INFO] Installing /foo/licm/trunk/pom.xml to /foo/.m2/repository/com/xxx/utils/licm/0.2.9-SNAPSHOT/licm-0.2.9-SNAPSHOT.pom
    [INFO]
    [INFO] --- maven-deploy-plugin:2.8.1:deploy (default-deploy) @ licm ---
    Downloading: http://xxx.xxx.com:8080/nexus/content/repositories/snapshots/com/xxx/utils/licm/0.2.9-SNAPSHOT/maven-metadata.xml
        [WARNING] Could not transfer metadata com.xxx.utils:licm:0.2.9-SNAPSHOT/maven-metadata.xml 
    from/to Snapshots (http://xxx.xxx.com:8080/nexus/content/repositories/snapshots): Failed to transfer file:
     http://xxx.xxx.com:8080/nexus/content/repositories/snapshots/com/xxx/utils/licm/0.2.9-SNAPSHOT/
    maven-metadata.xml. Return code is: 500 , ReasonPhrase:Internal Server Error.
    
    [INFO] ------------------------------------------------------------------------
    [INFO] BUILD FAILURE
    [INFO] ------------------------------------------------------------------------
    [INFO] Total time: 1.824s
    [INFO] Finished at: Fri Dec 20 01:20:33 CST 2013
    [INFO] Final Memory: 8M/20M
    [INFO] ------------------------------------------------------------------------
    [ERROR] Failed to execute goal org.apache.maven.plugins:maven-deploy-plugin:2.8.1:deploy (default-deploy) on project licm: Failed to retrieve remote metadata com.xxx.utils:licm:0.2.9-SNAPSHOT/maven-metadata.xml: Could not transfer metadata com.xxx.utils:licm:0.2.9-SNAPSHOT/maven-metadata.xml from/to Snapshots (http://xxx.xxx.com:8080/nexus/content/repositories/snapshots): Failed to transfer file: http://xxx.xxx.com:8080/nexus/content/repositories/snapshots/com/xxx/utils/licm/0.2.9-SNAPSHOT/maven-metadata.xml. Return code is: 500 , ReasonPhrase:Internal Server Error. -> [Help 1]"
    

    This is my first time to deploy snapshots to remote repository,so there have nothing in snapshot repository on nexus server

    • settings.xml
       <?xml version="1.0"?>
    <settings>
    <servers>
    <server>
            <id>Releases</id>
            <username>admin</username>
            <password>admin123</password>
    
    </server>
    <server>
            <id>Snapshots</id>
            <username>admin</username>
            <password>admin123</password>
    </server>
    </servers>
    <mirrors>
    <mirror>
            <id>Nexus</id>
            <name>Nexus Public Mirror</name>
            <url>http://xxx.xxx.com:8080/nexus/content/groups/public</url>
            <mirrorOf>*</mirrorOf>
    </mirror>
    
    </mirrors>
    </settings>
    
    • pom.xml
    <distributionManagement>
        <repository>
          <id>Releases</id>
          <name>xxx Releases Repositories</name>
          <url>http://xxx.xxx.com:8080/nexus/content/repositories/releases</url>
        </repository>
        <snapshotRepository>
          <id>Snapshots</id>
          <name>xxx Snapshots Repositories</name>
          <url>http://xxx.xxx.com:8080/nexus/content/repositories/snapshots</url>
        </snapshotRepository>
      </distributionManagement>