9
votes

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)
5
It looks like an Artifactory vs. plugin version mismatch. Artifactory returns XML while plugin expects JSON. I'll check in which version the change was made and will provide a full answer.JBaruch
Thanks. Seems strange though that some jobs, e.g. grails work OK, while others, e.g. gradle exhibit the error.John Cartwright
OK, I checked. Artifactory never returned XML for this query :) Question, do you have a proxy server between Artifactory and Jenkins?JBaruch
Thanks for checking. Artifactory is running standalone using Jetty but Jenkins goes through Apache to get to it.John Cartwright
I am getting the same error as well. I am using Jenkins ver. 1.601, Artifactory Plugin 2.2.7 and Artifactory 2.6.6DDK

5 Answers

1
votes

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>
0
votes

It appears that upgrading to Artifactory 3.6.0 resolved the problem. Now using Jenkins 1.605 and Artifactory 3.6.0 and not seeing the problem any longer.

0
votes

I had the same problem. I solved it by adding the artifactory url to non-proxy hosts as below Manage Jenkins -> Configure System -> Global Properties Check Environment Variables, and configure the properties with a name as below

-Dgradle.user.home=<your .gradle path> -Dhttp.proxyHost=<httpProxy> -Dhttp.proxyPort=<port_of_httpProxyHost> **-Dhttp.nonProxyHosts=<your_artifactory_url>** -Dhttps.proxyHost=<httpsProxy> -Dhttps.proxyPort=<port_of_httpsProxyHost>
0
votes

I solved this by putting Allow double escaping in IIS Request Filtering. Other proxies may require similar setting.

0
votes

My problem was publishing to a snapshot repository an artifact name-X-0.1-TEST.zip. Once I changed the version to X-0.1-SNAPSHOT, it uploaded.