|
From: Maverick C. G. <mav...@gm...> - 2007-05-25 07:44:10
|
On 5/24/07, Yoav Landman <yla...@gm...> wrote: > It was due to the fact that the java.net URL was pointing at a m1 repo which > is unsupported. We changed the URL in the default config that Artifactory > comes with to point to the m2 repo of java.net. Okay. I want do detail my example. My artifactory has been setted up on a repository http://repo.intranet/repos/baselibs = {ARTIFACTORY_HOME}/etc/artifactory.config.xml = <remoteRepository> <key>eBiz-repo</key> <handleReleases>true</handleReleases> <handleSnapshots>true</handleSnapshots> <url>http://repo.intranet/repos/baselibs</url> </remoteRepository> === Frankly, it is a SVN repository. Let's check this repo by WGET === >wget --spider -d http://repo.intranet/repos/baselibs/weblogic/xbean/9.1/xbean-9.1.pom.md5 DEBUG output created by Wget 1.10.2 on Windows. --10:58:18-- http://repo.intranet/repos/baselibs/weblogic/xbean/9.1/xbean-9.1.pom.md5 => `xbean-9.1.pom.md5' Resolving repo.intranet... seconds 0.00, *.*.*.* =) Caching repo.intranet => *.*.*.* =) Connecting to repo.intranet|*.*.*.*|:80... seconds 0.00, connected. Created socket 1920. Releasing 0x00395510 (new refcount 1). ---request begin--- HEAD /repos/baselibs/weblogic/xbean/9.1/xbean-9.1.pom.md5 HTTP/1.0 User-Agent: Wget/1.10.2 Accept: */* Host: repo.intranet Connection: Keep-Alive ---request end--- HTTP request sent, awaiting response... ---response begin--- HTTP/1.1 200 OK Date: Fri, 25 May 2007 06:58:18 GMT Server: Apache/2.0.52 (Red Hat) Last-Modified: Wed, 23 May 2007 14:04:08 GMT ETag: "37//weblogic/xbean/9.1/xbean-9.1.pom.md5" Accept-Ranges: bytes Vary: Accept-Encoding Keep-Alive: timeout=10, max=1000 Connection: Keep-Alive Content-Type: text/plain; charset=UTF-8 ---response end--- 200 OK Length: unspecified [text/plain] Closed fd 1920 200 OK === As you can see, this server follows the RFC http://www.w3.org/Protocols/rfc2616/rfc2616-sec9.html#sec9.4 It must not send 'Content-Length' header. Only 'GET' request is provided such header: === >wget -d http://repo.intranet/repos/baselibs/weblogic/xbean/9.1/xbean-9.1.pom.md5 DEBUG output created by Wget 1.10.2 on Windows. --11:10:30-- http://repo.intranet/repos/baselibs/weblogic/xbean/9.1/xbean-9.1.pom.md5 => `xbean-9.1.pom.md5' Resolving repo.intranet... seconds 0.00, *.*.*.* =) Caching repo.intranet => *.*.*.* =) Connecting to repo.intranet|*.*.*.*|:80... seconds 0.00, connected. Created socket 1920. Releasing 0x00395500 (new refcount 1). ---request begin--- GET /repos/baselibs/weblogic/xbean/9.1/xbean-9.1.pom.md5 HTTP/1.0 User-Agent: Wget/1.10.2 Accept: */* Host: repo.intranet Connection: Keep-Alive ---request end--- HTTP request sent, awaiting response... ---response begin--- HTTP/1.1 200 OK Date: Fri, 25 May 2007 07:10:30 GMT Server: Apache/2.0.52 (Red Hat) Last-Modified: Wed, 23 May 2007 14:04:08 GMT ETag: "37//weblogic/xbean/9.1/xbean-9.1.pom.md5" Accept-Ranges: bytes Content-Length: 32 Vary: Accept-Encoding Keep-Alive: timeout=10, max=1000 Connection: Keep-Alive Content-Type: text/plain; charset=UTF-8 ---response end--- 200 OK Registered socket 1920 for persistent reuse. Length: 32 [text/plain] === And now 'Content-Length' header is presented =) The same result can be displayed if the httpclient log is switched on 'DEBUG'. = {ARTIFACTORY_HOME}/etc/log4j.properties = log4j.logger.httpclient.wire=DEBUG === === 2007-05-24 19:15:36,583 [DEBUG] httpclient.wire.header - >> "HEAD /repos/baselibs/weblogic/xbean/9.1/xbean-9.1.pom.md5 HTTP/1.1[\r][\n]" 2007-05-24 19:15:36,583 [DEBUG] httpclient.wire.header - >> "Connection: Keep-Alive[\r][\n]" 2007-05-24 19:15:36,583 [DEBUG] httpclient.wire.header - >> "Origin-Artifactory: 8a571de312b7cacf:5b1925ef:112be9ed591:-8000[\r][\n]" 2007-05-24 19:15:36,583 [DEBUG] httpclient.wire.header - >> "User-Agent: Jakarta Commons-HttpClient/3.1-beta1[\r][\n]" 2007-05-24 19:15:36,598 [DEBUG] httpclient.wire.header - >> "Host: base_install_libs.maven.ebusiness.t-mobile.co.uk[\r][\n]" 2007-05-24 19:15:36,598 [DEBUG] httpclient.wire.header - >> "[\r][\n]" 2007-05-24 19:15:36,723 [DEBUG] httpclient.wire.header - << "HTTP/1.1 200 OK[\r][\n]" 2007-05-24 19:15:36,723 [DEBUG] httpclient.wire.header - << "Date: Thu, 24 May 2007 15:15:36 GMT[\r][\n]" 2007-05-24 19:15:36,723 [DEBUG] httpclient.wire.header - << "Server: Apache/2.0.52 (Red Hat)[\r][\n]" 2007-05-24 19:15:36,723 [DEBUG] httpclient.wire.header - << "Last-Modified: Wed, 23 May 2007 14:04:08 GMT[\r][\n]" 2007-05-24 19:15:36,723 [DEBUG] httpclient.wire.header - << "ETag: "37//weblogic/xbean/9.1/xbean-9.1.pom.md5"[\r][\n]" 2007-05-24 19:15:36,723 [DEBUG] httpclient.wire.header - << "Accept-Ranges: bytes[\r][\n]" 2007-05-24 19:15:36,723 [DEBUG] httpclient.wire.header - << "Vary: Accept-Encoding[\r][\n]" 2007-05-24 19:15:36,723 [DEBUG] httpclient.wire.header - << "Keep-Alive: timeout=10, max=1000[\r][\n]" 2007-05-24 19:15:36,723 [DEBUG] httpclient.wire.header - << "Connection: Keep-Alive[\r][\n]" 2007-05-24 19:15:36,723 [DEBUG] httpclient.wire.header - << "Content-Type: text/plain; charset=UTF-8[\r][\n]" 2007-05-24 19:15:36,755 [DEBUG] httpclient.wire.header - >> "GET /repos/baselibs/weblogic/xbean/9.1/xbean-9.1.pom.md5 HTTP/1.1[\r][\n]" 2007-05-24 19:15:36,755 [DEBUG] httpclient.wire.header - >> "Connection: Keep-Alive[\r][\n]" 2007-05-24 19:15:36,755 [DEBUG] httpclient.wire.header - >> "Origin-Artifactory: 8a571de312b7cacf:5b1925ef:112be9ed591:-8000[\r][\n]" 2007-05-24 19:15:36,755 [DEBUG] httpclient.wire.header - >> "User-Agent: Jakarta Commons-HttpClient/3.1-beta1[\r][\n]" 2007-05-24 19:15:36,755 [DEBUG] httpclient.wire.header - >> "Host: base_install_libs.maven.ebusiness.t-mobile.co.uk[\r][\n]" 2007-05-24 19:15:36,755 [DEBUG] httpclient.wire.header - >> "[\r][\n]" 2007-05-24 19:15:36,880 [DEBUG] httpclient.wire.header - << "HTTP/1.1 200 OK[\r][\n]" 2007-05-24 19:15:36,880 [DEBUG] httpclient.wire.header - << "Date: Thu, 24 May 2007 15:15:36 GMT[\r][\n]" 2007-05-24 19:15:36,880 [DEBUG] httpclient.wire.header - << "Server: Apache/2.0.52 (Red Hat)[\r][\n]" 2007-05-24 19:15:36,880 [DEBUG] httpclient.wire.header - << "Last-Modified: Wed, 23 May 2007 14:04:08 GMT[\r][\n]" 2007-05-24 19:15:36,880 [DEBUG] httpclient.wire.header - << "ETag: "37//weblogic/xbean/9.1/xbean-9.1.pom.md5"[\r][\n]" 2007-05-24 19:15:36,880 [DEBUG] httpclient.wire.header - << "Accept-Ranges: bytes[\r][\n]" 2007-05-24 19:15:36,880 [DEBUG] httpclient.wire.header - << "Content-Length: 32[\r][\n]" 2007-05-24 19:15:36,880 [DEBUG] httpclient.wire.header - << "Vary: Accept-Encoding[\r][\n]" 2007-05-24 19:15:36,880 [DEBUG] httpclient.wire.header - << "Keep-Alive: timeout=10, max=999[\r][\n]" 2007-05-24 19:15:36,880 [DEBUG] httpclient.wire.header - << "Connection: Keep-Alive[\r][\n]" 2007-05-24 19:15:36,880 [DEBUG] httpclient.wire.header - << "Content-Type: text/plain; charset=UTF-8[\r][\n]" 2007-05-24 19:15:36,958 [DEBUG] httpclient.wire.content - << "7a18b09dbc0beafcb180323f8b622dd3" 2007-05-24 19:15:37.020::WARN: /artifactory/eBiz-repo-cache/weblogic/xbean/9.1/xbean-9.1.pom.md5 java.lang.IllegalArgumentException at org.mortbay.jetty.HttpGenerator.setContentLength(HttpGenerator.java:206) at org.mortbay.jetty.Response.setContentLength(Response.java:685) at org.artifactory.request.HttpArtifactoryResponse.setContentLength(HttpArtifactoryResponse.java:50) at org.artifactory.request.RequestResponseHelper.updateResponseFromRepoResource(RequestResponseHelper.java:87) at org.artifactory.request.RequestResponseHelper.sendBodyResponse(RequestResponseHelper.java:40) at org.artifactory.engine.DownloadEngine.respond(DownloadEngine.java:454) at org.artifactory.engine.DownloadEngine.processStandard(DownloadEngine.java:221) === Unfortunately, your code is too strictly rely on headers of HEAD response. And when org.artifactory.repo.RemoteRepoBase.getResourceStreamHandle() method is called its parameter (RepoResource res) does not updated with headers of GET response. As a result RepoResource.getSize() returns value [-1] (is it C way? =). So an attempt to call org.mortbay.jetty.HttpGenerator.setContentLength() method with [-1] value throws a java.lang.IllegalArgumentException =( since = org.mortbay.jetty.HttpGenerator = public void setContentLength(long value) { if (value<_contentWritten) throw new IllegalArgumentException(); super.setContentLength(value); } === In my point of view, it look like a defect. Can you fix it? P.S. I can try to fix it myself, but I am not sure that my solution will align with your code ideology. -- Be Happy!!! UIN ICQ: 9487080 JUD: Mav...@ja... |