John Cartwright
John Cartwright

Reputation: 599

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)

Upvotes: 9

Views: 5906

Answers (5)

user123456789
user123456789

Reputation: 83

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.

Upvotes: 0

Radek Porazil
Radek Porazil

Reputation: 41

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

Upvotes: 0

gopalanrc
gopalanrc

Reputation: 274

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>

Upvotes: 0

dedek
dedek

Reputation: 8301

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>

Upvotes: 1

John Cartwright
John Cartwright

Reputation: 599

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.

Upvotes: 0

Related Questions