JFrog Artifactory unable to download jars from remote repository - maven

When I run my maven build pointing to the JFrog Artifactory setup I see the following error in the log:
2020-05-14T04:41:01.640Z [jfrt ] [ERROR] [dcb2a29d3c46472e] [o.a.r.RemoteRepoBase:806 ] [http-
nio-8081-exec-1] - IO error while trying to download resource
'jcenter:org/springframework/security/spring-security-web/4.2.2.RELEASE/spring-security-web-
4.2.2.RELEASE.jar': **javax.net.ssl.SSLException: Connection reset**
2020-05-14T04:41:01.641Z [jfrt ] [WARN ] [dcb2a29d3c46472e] [o.a.e.DownloadServiceImpl:266 ] [http-
nio-8081-exec-1] - **Sending HTTP error code 404: Connection reset**
I have checked the connectivity to the jcenter repo from within the Artifactory admin conosole, and its says that its able to connect.
Require your assistance.
Regards

Please check the URL you are using for JCenter and make sure it is using secure HTTP - https://jcenter.bintray.com.
Starting in January 2020, JCenter is only serving requests made with HTTPS. From that point on, all requests made with HTTP are denied and any builds that use a JCenter URL with the non-secure HTTP protocol will fail.
For more info see the following blog post.

Related

JFrog Artifactory Cloud Configurate Remote Repository

I'm struggling with a simple test using JFrog Artifactory Cloud when creating a remote repository to adobe public one.
I configure a remote as maven repository, on URL I've inserted https://repo.adobe.com/nexus/content/repositories/public and test ok on name just give a adobe-public name and click on save and finish.
After that I'm trying to obtain a existing (in repo.adobe.com) pom from https://xxxx/artifactory/adobe-public/com/day/jcr/vault/... but I can't get any pom.
I've tried to change several cache settings or offline settings but issue is always ""message" : "adobe-public: is offline". status 404.
On Logs, https://cccc/ui/admin/artifactory/advanced/system_logs there isn't also anything useful.
Thank you in advanced.
This is caused by global offline mode being active.
I had same issue.
Solved in: "https://.../ui/admin/artifactory/configuration/artifactory_general" - turn off "Global Offline Mode" and save.
Have a similar setup with Maven repository pointing to https://repo.adobe.com/nexus/content/repositories/public and was successfully able to download the pom files, refer the below snippet,
$ wget --user=admin --password=Password https://myartifactory/artifactory/adobe-repo/ant/ant/1.5.1/ant-1.5.1.pom
--2020-11-01 10:27:54-- https://myartifactory/artifactory/adobe-repo/ant/ant/1.5.1/ant-1.5.1.pom
Resolving myartifactory (myartifactory)... 1.2.3.4, 2.1.3.5, 3.7.7.4
Connecting to myartifactory (myartifactory)|1.2.3.6|:443... connected.
HTTP request sent, awaiting response... 401 Unauthorized
Authentication selected: Basic realm="Artifactory Realm"
Reusing existing connection to myartifactory:443.
HTTP request sent, awaiting response... 200 OK
Length: 140 [application/x-maven-pom+xml]
Saving to: ‘ant-1.5.1.pom’
ant-1.5.1.pom 100%[====================================>] 140 --.-KB/s in 0s
2020-11-01 10:27:59 (5.14 MB/s) - ‘ant-1.5.1.pom’ saved [140/140]
Use wget and try to download the file as I did. Also, the error "offline" says that the repository is offline and cannot be downloaded, goto to the repository's configuration page under Artifactory UI --> Admin --> Repositories | Adobe-public and under the Basic tab, scroll down and look for "offline", if this "offline" is checked, uncheck it and try again.

Nexus 3.6 OSS Docker Hub Proxy - Can docker search but not docker pull

I've deployed Nexus OSS 3.6 and it's being served on http://server:8082/nexus
I have configured a docker-hub proxy using the instructions in http://www.sonatype.org/nexus/2017/02/16/using-nexus-3-as-your-repository-part-3-docker-images/ and have configured the docker-group to serve under port 18000
I can perform the following:
docker login server:18000
docker search server:18000/jenkins
but when I run:
docker pull server:18000/jenkins
i get the following error:
Error response from daemon: Get http://10.105.139.17:18000/v2/jenkins/manifests/latest:
error parsing HTTP 400 response body: invalid character '<'
looking for beginning of value:
"<html>\n<head>\n<meta http-equiv=\"Content-Type\"
content=\"text/html;charset=ISO-8859-1\"/>\n<title>
Error 400 </title>\n</head>\n<body>\n<h2>HTTP ERROR: 400</h2>\n
<p>Problem accessing /nexus/v2/token.
Reason:\n<pre> Not a Docker request</pre></p>\n<hr />
Powered by Jetty:// 9.3.20.v20170531<hr/>\n
</body>\n</html>\n"
My jetty nexus.properties config file is:
# Jetty section
application-port=8082
application-host=0.0.0.0
# nexus-args=${jetty.etc}/jetty.xml,${jetty.etc}/jetty-http.xml,${jetty.etc}/jetty-requestlog.xml
nexus-context-path=/nexus
# Nexus section
# nexus-edition=nexus-pro-edition
# nexus-features=\
# nexus-pro-feature
Could anyone offer any suggestions on how to fix this please?
I have the same problem when I enabled the anonymous read on some docker repository.
Repositories->Docker hosted->Check the checkbox (Disable to allow anonymous pull) from the repository.
seems you need to upgrade Nexus to 3.6.1 according to :
https://issues.sonatype.org/browse/NEXUS-14488
in order to allow anonymous read again

SonarQube 5.6 - update plugin behind proxy (HTTPS) and web context

Using the update center behind a proxy with an associated context gives me this known error:
Fail to download the plugin (css, version 3.1) from https://github.com/racodond/sonar-css-plugin/releases/download/3.1/sonar-css-plugin-3.1.jar
Error is : Fail to download: https://github.com/racodond/sonar-css-plugin/releases/download/3.1/sonar-css-plugin-3.1.jar (no proxy)
I've seen I must provide http.proxyHost/Port in the sonar.properties configuration file, but I've got problems with web context (assigned by sonar.web.context=/mycontext).
Two cases:
http.proxyHost=myhost/mycontext => fails because tries connection with myhost/mycontext:port
Fail to download the plugin (css, version 3.1) from https://github.com/racodond/sonar-css-plugin/releases/download/3.1/sonar-css-plugin-3.1.jar
Error is : Fail to download: https://github.com/racodond/sonar-css-plugin/releases/download/3.1/sonar-css-plugin-3.1.jar (HTTP proxy: <myhost>/<mycontext>:443)
http.proxyHost=myhost => fails and sonarqube don't show any plugin
Note: Ports are 80 y 443 (standard), https uses same host.
Any help is much appreciated.

mvn deploy to artifactory (large size artifact) gives broken pipe error

I am trying to deploy a large zip file (305 MB) to artifactory using the mvn deploy command, but i am getting broken pipe errors. I tried to upload the same file via the browser's "Deploy" button, and it worked fine.
Is there a setting that i can use to increase the socket timeout, or force maven/artifactory to wait until the package is uploaded?
Any help on how to resolve this is appreciated. Here are the log entries and stack trace:
May 09, 2016 11:16:32 AM org.apache.maven.wagon.providers.http.httpclient.impl.execchain.RetryExec execute
INFO: Retrying request to {}->http://mvnrepo.dev.xyz.myorg.net:8080
May 09, 2016 11:17:02 AM org.apache.maven.wagon.providers.http.httpclient.impl.execchain.RetryExec execute
INFO: I/O exception (java.net.SocketException) caught when processing request to {}->http://mvnrepo.dev.xyz.myorg.net:8080: Broken pipe
May 09, 2016 11:17:02 AM org.apache.maven.wagon.providers.http.httpclient.impl.execchain.RetryExec execute
INFO: Retrying request to {}->http://mvnrepo.dev.xyz.myorg.net:8080
Caused by: org.eclipse.aether.transfer.ArtifactTransferException: Could not transfer artifact com.myorg.xyz.myapp:my-app-package:zip:0.1-svc20160509.151532-7 from/to xyz-service-snapshots (http://mvnrepo.dev.xyz.myorg.net:8080/artifactory/xyz-service-local): Broken pipe
at org.eclipse.aether.connector.basic.ArtifactTransportListener.transferFailed(ArtifactTransportListener.java:43)
at org.eclipse.aether.connector.basic.BasicRepositoryConnector$TaskRunner.run(BasicRepositoryConnector.java:355)
at org.eclipse.aether.connector.basic.BasicRepositoryConnector.put(BasicRepositoryConnector.java:274)
at org.eclipse.aether.internal.impl.DefaultDeployer.deploy(DefaultDeployer.java:311)
... 26 more
Caused by: org.apache.maven.wagon.TransferFailedException: Broken pipe
at org.apache.maven.wagon.providers.http.AbstractHttpClientWagon.put(AbstractHttpClientWagon.java:662)
at org.apache.maven.wagon.providers.http.AbstractHttpClientWagon.put(AbstractHttpClientWagon.java:557)
at org.apache.maven.wagon.providers.http.AbstractHttpClientWagon.put(AbstractHttpClientWagon.java:539)
at org.apache.maven.wagon.providers.http.AbstractHttpClientWagon.put(AbstractHttpClientWagon.java:533)
at org.apache.maven.wagon.providers.http.AbstractHttpClientWagon.put(AbstractHttpClientWagon.java:513)
at org.eclipse.aether.transport.wagon.WagonTransporter$PutTaskRunner.run(WagonTransporter.java:644)
at org.eclipse.aether.transport.wagon.WagonTransporter.execute(WagonTransporter.java:427)
at org.eclipse.aether.transport.wagon.WagonTransporter.put(WagonTransporter.java:410)
at org.eclipse.aether.connector.basic.BasicRepositoryConnector$PutTaskRunner.runTask(BasicRepositoryConnector.java:510)
at org.eclipse.aether.connector.basic.BasicRepositoryConnector$TaskRunner.run(BasicRepositoryConnector.java:350)
... 28 more
Caused by: java.net.SocketException: Broken pipe
at java.net.SocketOutputStream.socketWrite0(Native Method)
at java.net.SocketOutputStream.socketWrite(SocketOutputStream.java:113)
at java.net.SocketOutputStream.write(SocketOutputStream.java:159)
at org.apache.maven.wagon.providers.http.httpclient.impl.io.SessionOutputBufferImpl.streamWrite(SessionOutputBufferImpl.java:123)
at org.apache.maven.wagon.providers.http.httpclient.impl.io.SessionOutputBufferImpl.flushBuffer(SessionOutputBufferImpl.java:135)
at org.apache.maven.wagon.providers.http.httpclient.impl.io.SessionOutputBufferImpl.write(SessionOutputBufferImpl.java:164)
at org.apache.maven.wagon.providers.http.httpclient.impl.io.ContentLengthOutputStream.write(ContentLengthOutputStream.java:115)
at org.apache.maven.wagon.providers.http.AbstractHttpClientWagon$RequestEntityImplementation.writeTo(AbstractHttpClientWagon.java:204)
at org.apache.maven.wagon.providers.http.httpclient.impl.DefaultBHttpClientConnection.sendRequestEntity(DefaultBHttpClientConnection.java:155)
at org.apache.maven.wagon.providers.http.httpclient.impl.conn.CPoolProxy.sendRequestEntity(CPoolProxy.java:149)
at org.apache.maven.wagon.providers.http.httpclient.protocol.HttpRequestExecutor.doSendRequest(HttpRequestExecutor.java:236)
I managed to fix the issue by downgrade maven version from 3.5.2 to 3.0.4
Artifactory - open source 7.12.6
General
A Broken pipe error typically indicates a network issue. Deploying an artifact on Artifactory may fail with this error either if you have network issues (lost packets during deployment) or if your Artifactory repository has ran out of space (physical memory on the repository). Check Case 1 and Case 2 for troubleshooting.
Tip: Run mvn deploy -X. The -X option will log further information related with your error (sets log-level to debug)
Case 1: Network Issue
Solution: Just retry it :)
Issue Details
Maven's source code seems to be using apache's Validate method, (throws an IllegalArgumentException on validation error) to compare and validate the size of the deployed artifact with the artifact that was built locally. Note: On deploy, maven builds the artifact locally, and then uploads it to the configured repository (could be Artifactory, Maven Central etc) which in your case is Artifactory.
The error should look like this:
[DEBUG] Failed to dispatch transfer event 'PUT PROGRESSED [ARTIFACT_SERVER_URL]/artifact.jar <> [LOCAL_PATH]/artifact.jar
java.lang.IllegalArgumentException: progressed file size cannot be greater than size: 117964800 > 116927216
at org.apache.commons.lang3.Validate.isTrue (Validate.java:158)
at org.apache.maven.cli.transfer.AbstractMavenTransferListener$FileSizeFormat.formatProgress (AbstractMavenTransferListener.java:195)
at org.apache.maven.cli.transfer.ConsoleMavenTransferListener.getStatus (ConsoleMavenTransferListener.java:117)
at org.apache.maven.cli.transfer.ConsoleMavenTransferListener.transferProgressed (ConsoleMavenTransferListener.java:90)
...
Case 2: No space left on Artifactory repository
Solution: Free up space on Artifactory repository
Issue Details
For any erros related with deployment to artifactory, you can always check Artifactory's log from Web Application.
Just Navigate (from Sidebar) to Admin/Advanced/System Logs. Check for any error or warning in the log file.
An error related with the available space could be like the following:
2021-08-18 11:20:43,339 [http-nio-8081-exec-19] [WARN ] (o.a.w.s.RepoFilter :252) - Sending HTTP error code 404: No space left on device
2021-08-18 11:20:43,346 [http-nio-8081-exec-16] [WARN ] (o.a.r.s.RepositoryServiceImpl:1739) - Datastore disk is too high: Warning limit: 80%, Used: 94%, Total: 688.01 GB, Used: 652.97 GB, Available: 35.04 GB
2021-08-18 11:20:43,346 [http-nio-8081-exec-16] [INFO ] (o.a.e.UploadServiceImpl:386) - Deploy to 'libs-snapshot-local:artifact.jar' Content-Length: 170019165
2021-08-18 11:20:44,086 [http-nio-8081-exec-16] [ERROR] (o.a.w.s.RepoFilter :251) - Upload request of libs-snapshot-local:artifact.jar failed due to {}
java.io.IOException: No space left on device
at java.io.FileOutputStream.writeBytes(Native Method)
at java.io.FileOutputStream.write(FileOutputStream.java:326)
...
In case you do identify such errors, try to remove some old artifacts to free up space, and retry your deployment later
Tip: It's a good practise to set some purging policies for old artifacts/snapshots on your Artifactory.

Authenticate sonar-runner via basic auth

Our sonarqube server is behind http basic authentication and local runner fails with 401 error. Is it somehow possible to provide credentials to it? AOfficial docs shows how to provide sonarqube's internal user...
UPD #1:
sonarqube: v5.3,
sonar-runner: v2.5
Debug log of runner:
INFO: Scanner configuration file: /Users/user/Documents/Projects/Project1/sonar-scanner-2.5/conf/sonar-runner.properties
INFO: Project configuration file: /Users/user/Documents/Projects/Project1/sonar-project.properties
INFO: SonarQube Scanner 2.5
INFO: Java 1.8.0_45 Oracle Corporation (64-bit)
INFO: Mac OS X 10.11.3 x86_64
INFO: Error stacktraces are turned on.
DEBUG: cache: /Users/user/.sonar/ws_cache/https%3A%2F%2Fexample.com%2Fsonar%2F/global
INFO: User cache: /Users/user/.sonar/cache
DEBUG: Extract sonar-runner-batch in temp...
DEBUG: Get bootstrap index...
DEBUG: Download: https://example.com/sonar/batch_bootstrap/index
INFO: ------------------------------------------------------------------------
INFO: EXECUTION FAILURE
INFO: ------------------------------------------------------------------------
INFO: Total time: 1.171s
INFO: Final Memory: 5M/245M
INFO: ------------------------------------------------------------------------
ERROR: Error during SonarQube Scanner execution
org.sonar.runner.impl.RunnerException: Unable to execute SonarQube
at org.sonar.runner.impl.IsolatedLauncherFactory$1.run(IsolatedLauncherFactory.java:100)
at org.sonar.runner.impl.IsolatedLauncherFactory$1.run(IsolatedLauncherFactory.java:87)
at java.security.AccessController.doPrivileged(Native Method)
at org.sonar.runner.impl.IsolatedLauncherFactory.createLauncher(IsolatedLauncherFactory.java:87)
at org.sonar.runner.impl.IsolatedLauncherFactory.createLauncher(IsolatedLauncherFactory.java:83)
at org.sonar.runner.api.EmbeddedRunner.doStart(EmbeddedRunner.java:249)
at org.sonar.runner.api.EmbeddedRunner.start(EmbeddedRunner.java:187)
at org.sonar.runner.api.EmbeddedRunner.start(EmbeddedRunner.java:182)
at org.sonarsource.scanner.cli.Main.execute(Main.java:75)
at org.sonarsource.scanner.cli.Main.main(Main.java:66)
Caused by: java.lang.IllegalStateException: Fail to download libraries from server
at org.sonar.runner.impl.Jars.downloadFiles(Jars.java:93)
at org.sonar.runner.impl.Jars.download(Jars.java:70)
at org.sonar.runner.impl.JarDownloader.download(JarDownloader.java:40)
at org.sonar.runner.impl.IsolatedLauncherFactory$1.run(IsolatedLauncherFactory.java:91)
... 9 more
Caused by: java.lang.IllegalStateException: Status returned by url [https://example.com/sonar/batch_bootstrap/index] is not valid: [401]
at org.sonar.runner.impl.ServerConnection.callUrl(ServerConnection.java:186)
at org.sonar.runner.impl.ServerConnection.downloadString(ServerConnection.java:121)
at org.sonar.runner.impl.ServerConnection.tryServerFirst(ServerConnection.java:148)
at org.sonar.runner.impl.ServerConnection.download(ServerConnection.java:112)
at org.sonar.runner.impl.Jars.downloadFiles(Jars.java:78)
... 12 more
No it doesn't look like sonar-runner supports proxy authentication. SonarQube has built-in access control so I'm not sure why you'd need proxy authentication on top of that. Maybe you could disable proxy authentication for SonarQube's URL.
The sonar-runner, even if configured with credentials, does not use these to make it's first call to the server. The endpoint is /batch/index. You have to allow public access to that endpoint. For all other urls basic auth is fine.
More details about my working setup in my answer here: https://stackoverflow.com/a/60132667/1838233
I've tried that setup with the runner and a sonar-project.properties file containing:
sonar.host.url=https://myserver/sonar/
sonar.login=${env.SONARUSER}
sonar.password=${env.SONARPWD}
and could access Sonar behind Apache basic auth that way.
I have been looking for this too and failed to find any options to allow this. One use case I can think of for needing this is you have the sonar client running on the far end of a GCP IAP away from the sonar server. You'd need to have the client pass through the initial proxy to get to the sonar server. Even if the sonar server supports this auth natively you need some way for the client to pass an auth header.
This is for scenarios where you either don't trust sonar or you don't trust the deployment of sonar by some novice, but you do trust a zero-trust protected proxy by gcp's platform

Resources