Score:0

How can I tell JVM to use a proxy in Ubuntu Server 20.04.5 LTS?

cv flag

I want to install the elasticsearch-ingest-attachment for Zammad on Ubuntu Server (Ubuntu 20.04.5 LTS). This fails ("Exception in thread "main" java.net.ConnectException: Connection timed out"), probably because I'm behind a proxy.

I managed to set the proxy in various places (/etc/apt/apt.conf.d/95proxies, /etc/environment, /etc/wgetrc, ~/.curlrc), but I cannot figure out how to make JVM use a proxy. I tried to use these commands, but they failed (returning: -bash: syntax error near unexpected token `"https.proxyHost",'):

System.setProperty("https.proxyHost", 192.168.0.1);

In the end, I want to be able to sucessfully install ingest-attachment via:

sudo /usr/share/elasticsearch/bin/elasticsearch-plugin install ingest-attachment

I found tons of Java-documentations, but they are confusing to me. I hoped, I would be able to just add JVM-proxy-settings in a file like /etc/environment.

Best regards,

WhatCouldGoWrong avatar
cv flag
Sorry, I was inaccurate there. It is Ubuntu 20.04.5 LTS. I changed that.
WhatCouldGoWrong avatar
cv flag
found this (trying it now): sudo CLI_JAVA_OPTS="-Dhttp.proxyHost=192.168.0.1 -Dhttp.proxyPort=8080 -Dhttps.proxyHost=192.168.0.1 -Dhttps.proxyPort=8080" ./elasticsearch-plugin install ingest-attachment
WhatCouldGoWrong avatar
cv flag
still: Exception in thread "main" java.net.ConnectException: Connection timed out
WhatCouldGoWrong avatar
cv flag
I added --verbose to the command - and it shows me an attempt to download this file: https://artifacts.elastic.co/downloads/elasticsearch-plugins/ingest-attachment/ingest-attachment-linux-x86_64-7.10.2.zip. It seems like this file doesn't exist, so maybe that's the problem.
WhatCouldGoWrong avatar
cv flag
Got a new url. This one works with wget. Still cannot use sudo CLI_JAVA_OPTS="-Dhttp.proxyHost=192.168.0.1 -Dhttp.proxyPort=8080 -Dhttps.proxyHost=192.168.0.1 -Dhttps.proxyPort=8080" ./elasticsearch-plugin install ingest-attachment. But I was able to download the file with wget and using the local file during the installation. So I solved my problem without finding out, how to actually use a proxy in JVM. Maybe CLI_JAVA_OPTS is the answer, maybe not.
WhatCouldGoWrong avatar
cv flag
Here's my workaround: cd ~ wget https://artifacts.elastic.co/downloads/elasticsearch-plugins/ingest-attachment/ingest-attachment-7.17.8.zip cd /usr/share/elasticsearch/bin sudo ./elasticsearch-plugin install file:///home/myusername/ingest-attachment-7.17.8.zip sudo systemctl restart elasticsearch
I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.