Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Jenkins error when publishing artifact to Artifactory

I have a gradle build of a spring-boot project as a job in Jenkins. I'm using Jenkins' artifactory plugin to publish the resulting JAR to our artifactory server.

The build completes successfully and the artifact is published, however the Jenkins console reports an error communicating with Artifactory (excerpt from the console listed below).

I'm using Jenkins 1.597, artifactory plugin 2.2.5, and Artifactory 3.0.3

Can anyone suggest how to resolve this or help me to better understand what the problem is?

Thanks!

--john

:artifactoryPublish
Deploying artifact: http://artifactory.ngdc.noaa.gov/artifactory/jenkins-local/ngdc/hazards/tsunamis/1.0-SNAPSHOT/tsunamis-1.0-SNAPSHOT.jar
Failed while reading the response from: PUT http://artifactory.ngdc.noaa.gov/artifactory/jenkins-local/ngdc/hazards/tsunamis/1.0-SNAPSHOT/tsunamis-1.0-SNAPSHOT.jar;build.name=tsunami;build.timestamp=1423158706241;build.number=42;vcs.revision=afd5283084a119a1e8a2983e0e94cfca7fc14df2 HTTP/1.1
org.codehaus.jackson.JsonParseException: Unexpected character ('<' (code 60)): expected a valid value (number, String, array, object, 'true', 'false' or 'null')
 at [Source: org.apache.http.conn.EofSensorInputStream@b51b399; line: 1, column: 2]
    at org.codehaus.jackson.JsonParser._constructError(JsonParser.java:943)
like image 366
John Cartwright Avatar asked Feb 05 '15 20:02

John Cartwright


1 Answers

I solved the issue simply by changing the http protocol to https in the artifactory server URL (Jenkins -> Manage Jenkins -> Configure System -> Artifactory).

So instead of Artifactory servers URL:

http://my.artifactory.server/artifactory

I have Artifactory servers URL:

https://my.artifactory.server/artifactory

Explanation

My artifactory server sits behind nginx proxy, which responds with HTTP 301 (redirection) to http protocol requests. Jenkins artifactory plugin doesn't handle such redirections and requires a direct URL.

You can check if your URL is direct or not using culr:

curl -l http://my.artifactory.server/artifactory

response:

<html>
<head><title>301 Moved Permanently</title></head>
<body bgcolor="white">
<center><h1>301 Moved Permanently</h1></center>
<hr><center>nginx/1.6.3</center>
</body>
</html>
like image 81
dedek Avatar answered Sep 19 '22 19:09

dedek