我使用 Jenkins Artifactory 插件。Artifactory安装在Nginx服务器旁边。有时,Jenkins 会在上传时返回错误:
[main] ERROR org.jfrog.build.extractor.maven.BuildInfoClientBuilder - Failed while reading the response from: PUT https://XXXX.XXX/XX-XXXXXXX-XXX/com/XXXX/XXXX/xxxxxxxx/xxxxxxx-api/1.0.0-SNAPSHOT/xxxxxxx-api-1.0.0-SNAPSHOT-jar-with-dependencies.jar;build.timestamp=1457104033410;build.name=xxxxxxx-build;build.number=75 HTTP/1.1
org.codehaus.jackson.JsonParseException: Unexpected character ('<' (code 60)): expected a valid value (number, String, array, object, 'true', 'false' or 'null')
仅当文件大于特定大小时,才会出现此错误。
这个问题是一个 Nginx 问题。当我尝试使用来自其他软件(例如:DNC)的"PUT"操作时,我有一个Nginx错误消息,而不是Artifactory。这就是为什么Artifactory无法理解它的原因。
PUT https://XXXX.XXX/XX-XXXXXXX-XXX/com/XXXX/XXXX/xxxxxxxx/xxxxxxx-api/1.0.0-SNAPSHOT/xxxxxxx-api-1.0.0-SNAPSHOT-jar-with-dependencies.jar;build.timestamp=1457104033410;build.name=xxxxxxx-build;build.number=75 HTTP/1.1
结果:
<html>
<head><title>413 Request Entity Too Large</title></head>
<body bgcolor="white">
<center><h1>413 Request Entity Too Large</h1></center>
<hr><center>nginx/1.8.1</center>
</body>
</html>
你需要增加 Nginx 配置文件中的client_max_body_size:/etc/nginx/nginx.conf
# set client body size to 500M #
client_max_body_size 500M;
500M 表示需要上传的项目的最大大小。
更多信息请点击此处:http://www.cyberciti.biz/faq/linux-unix-bsd-nginx-413-request-entity-too-large/