Welcome to the Inedo Forums! Check out the Forums Guide for help getting started.
If you are experiencing any issues with the forum software, please visit the Contact Form on our website and let us know!
ProGet says "500 Internal Server Error" when deploying via maven
-
I run a local ProGet installation (5.3.29 (Build 19)) with a Maven feed. When I try to deploy via Maven (
mvn deploy
), the transfer of maven-metadata.xml fails with500 Internal Server Error
:... [INFO] --- maven-deploy-plugin:2.7:deploy (default-deploy) @ projectname --- Uploading to maven-releases: https://proget.url/maven2/maven-releases/info/dornbach/projectname/1.0.0/projectname-1.0.0.jar Uploaded to maven-releases: https://proget.url/maven2/maven-releases/info/dornbach/projectname/1.0.0/projectname-1.0.0.jar (17 kB at 24 kB/s) Uploading to maven-releases: https://proget.url/maven2/maven-releases/info/dornbach/projectname/1.0.0/projectname-1.0.0.pom Uploaded to maven-releases: https://proget.url/maven2/maven-releases/info/dornbach/projectname/1.0.0/projectname-1.0.0.pom (4.4 kB at 13 kB/s) Downloading from maven-releases: https://proget.url/maven2/maven-releases/info/dornbach/projectname/maven-metadata.xml Downloaded from maven-releases: https://proget.url/maven2/maven-releases/info/dornbach/projectname/maven-metadata.xml (273 B at 2.3 kB/s) Uploading to maven-releases: https://proget.url/maven2/maven-releases/info/dornbach/projectname/maven-metadata.xml [INFO] ------------------------------------------------------------------------ [INFO] BUILD FAILURE [INFO] ------------------------------------------------------------------------ [INFO] Total time: 4.493 s [INFO] Finished at: 2021-05-29T12:20:08+02:00 [INFO] ------------------------------------------------------------------------ [ERROR] Failed to execute goal org.apache.maven.plugins:maven-deploy-plugin:2.7:deploy (default-deploy) on project projectname: Failed to deploy metadata: Could not transfer metadata info.dornbach: projectname/maven-metadata.xml from/to maven-releases (https://proget.url/maven2/maven-releases/): transfer failed for https://proget.url/maven2/maven-releases/info/dornbach/projectname/maven-metadata.xml, status: 500 Internal Server Error
In ProGet's Diagnostic Center, the following corresponding error message is logged:
An error occurred processing a PUT request to http://proget.url/maven2/maven-releases/info/dornbach/projectname/maven-metadata.xml: Root element is missing.
The stack trace is as follows:
System.Xml.XmlException: Root element is missing. at System.Xml.XmlTextReaderImpl.Throw(Exception e) at System.Xml.XmlTextReaderImpl.ParseDocumentContent() at System.Xml.Linq.XDocument.Load(XmlReader reader, LoadOptions options) at System.Xml.Linq.XDocument.Load(Stream stream, LoadOptions options) at System.Xml.Linq.XDocument.Load(Stream stream) at Inedo.ProGet.WebApplication.FeedEndpoints.Maven.MavenFeedHandler.ProcessRequestAsync(HttpContext context, MavenFeed feed, String relativeUrl) in C:\Users\builds\AppData\Local\Temp\InedoAgent\BuildMaster\192.168.44.60\Temp\_E131122\Src\ProGet.WebApplication\FeedEndpoints\Maven\MavenFeedHandler.cs:line 173 at Inedo.ProGet.WebApplication.FeedEndpoints.FeedEndpointHandler.FeedRequestHandler.ProcessRequestAsync(HttpContext context) in C:\Users\builds\AppData\Local\Temp\InedoAgent\BuildMaster\192.168.44.60\Temp\_E131122\Src\ProGet.WebApplication\FeedEndpoints\FeedEndpointHandler.cs:line 121
The downloaded
maven-metadata.xml
is:<metadata> <groupId>info.dornbach</groupId> <artifactId>projectname</artifactId> <versioning> <latest>1.0.0</latest> <versions> <version>1.0.0</version> </versions> <lastUpdated>20210529102007</lastUpdated> </versioning> </metadata>
I am using Maven 3.8.1:
$ mvn -version Apache Maven 3.8.1 (05c21c65bdfed0f71a2f2ada8b84da59348c4c5d) Maven home: /usr/local/Cellar/maven/3.8.1/libexec Java version: 1.8.0_181, vendor: Oracle Corporation, runtime: /Library/Java/JavaVirtualMachines/jdk1.8.0_181.jdk/Contents/Home/jre Default locale: de_DE, platform encoding: UTF-8 OS name: "mac os x", version: "10.14.6", arch: "x86_64", family: "mac"
After the Error occurred and the Maven deploy step failed, the package is available in the Web-UI and for download.
-
Hi @jndornbach_8182,
Thanks for posting all the information, it's really helpful!
With that stack trace information, we can see where the error is occurring... and as the error says, the PUT body doesn't contain XML as the code expects.
if (context.Request.HttpMethod == "PUT") { if (info.IsMetadataRequest) { if (info.HashAlgorithm == null) { var xdoc = XDocument.Load(context.Request.InputStream); var metadataElement = xdoc.Element("metadata"); if (metadataElement != null) { var versioningElement = metadataElement.Element("versioning"); if (versioningElement != null) { var releaseVersion = (string)versioningElement.Element("release"); if (!string.IsNullOrWhiteSpace(releaseVersion)) await new DB.Context(false).MavenArtifacts_SetReleaseVersionAsync(feed.FeedId, info.GroupId, info.ArtifactId, releaseVersion.Trim()); } } } else { // Don't need to actually save the hash since it's computed on demand } context.Response.StatusCode = 201; } }
If I'm being totally honest, I don't understand why the code is doing what it's doing
But that doesn't mean I can't help fix it! Could I trouble you to attach a tool like Fiddler to capture the requests, and then send us the session file? We can then inspect that PUT request, and see what's going on.
You can send to support at inedo dot com with a subject of
[QA-597]
-- but please let me know when you do, so I can dig in the box and find it.Thanks,
Alana
-
Hello Alana.
I just sent you an email with the requested Fiddler session recording file as well as the relevant excerpt of the console log of the run of
mvn deploy
.
I reproduced and captured the error with ProGet version 5.3.32 (Build 11) in contrast to the version I used in my initial thread posting.The failing PUT request to
http://127.0.0.1:8090/maven2/maven-feed/info/dornbach/testproject/maven-metadata.xml
has the following content:<?xml version="1.0" encoding="UTF-8"?> <metadata> <groupId>info.dornbach</groupId> <artifactId>testproject</artifactId> <versioning> <latest>1.0.0</latest> <release>1.0.0</release> <versions> <version>1.0.0</version> </versions> <lastUpdated>20210717092715</lastUpdated> </versioning> </metadata>
Thank you!
-
Hi @jndornbach_8182 ,
Thanks so much for sending that over, super helpful!
Here's what I did:
- created a new feed named
maven-feed
- opened the .saz file
- reissued the
.jar
PUT request (changed URL) ... jar uploaded - reissued the
.pom
PUT request... pom uploaded - reissued the
maven-metadata.xml
GET request... results were identical to yours - reissued the
maven-metadata.xml
PUT request.... no error
There are no ProGet software changes; from the headers, I can see you've since upgraded to ProGet 5.3.32, and I don't see anything that would remotely yield this difference - https://my.inedo.com/downloads/issues?Product=ProGet&FromVersion=5.3.33
The only thing I can think of is .NET5/Linux (you're running on Docker) vs .NET452/Windows (I was using IIS). We keep finding a few oddities like this, so I logged this as PG-1992 and escalated it. We should et it fixed for next maintenance release (July 30), but a few folks are on vacation now, so it'll take a couple days to get thru review.
- created a new feed named
-
@atripp thank you for the new ticket PG-1992.
I vote for it. I use PG 5.3 in Docker and have the same "500 Root element is missing" error on mvn deploy.
It can be ignored in manual deploys but causes problems within script...
Regards.
-
Hi @pumin_0299 & @jndornbach_8182 ,
This issue has been resolved and will release later this week in ProGet 5.3.34.
Thanks,
Rich
-
Thank you very much! I'm curious about the release...