Skip to content

How to solve the error: "java.net.UnknownHostException: username:[email protected]:port" #510

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
kuanyan9527 opened this issue Jun 3, 2025 · 5 comments

Comments

@kuanyan9527
Copy link

kuanyan9527 commented Jun 3, 2025

I get an error when run command graalpy -m standalone native --module test.py --output test --venv venv

Error message:
INFO: downloading org.graalvm.python:python-embedding:24.2.1 from https://repo1.maven.org/maven2/ to graalpy-24.2.1-linux-amd64/downloaded_standalone_resources May 29, 2025 4:25:49 PM org.graalvm.maven.downloader.MVNDownloader getProxy INFO: using proxy 'http://username:[email protected]:port' May 29, 2025 4:25:49 PM org.graalvm.maven.downloader.MVNDownloader downloadMavenFile SEVERE: exception while downloading maven file from https://repo1.maven.org/maven2/org/graalvm/python/python-embedding/24.2.1/python-embedding-24.2.1.pom java.net.UnknownHostException: username:[email protected]:port at [email protected]/sun.nio.ch.NioSocketImpl.connect(NioSocketImpl.java:558) at [email protected]/java.net.Socket.connect(Socket.java:665) at [email protected]/java.net.Socket.connect(Socket.java:603) at [email protected]/sun.net.NetworkClient.doConnect(NetworkClient.java:166) at [email protected]/sun.net.www.http.HttpClient.openServer(HttpClient.java:516) at [email protected]/sun.net.www.http.HttpClient.openServer(HttpClient.java:570) at [email protected]/sun.net.www.http.HttpClient.openServer(HttpClient.java:599) at [email protected]/sun.net.www.protocol.https.HttpsClient.<init>(HttpsClient.java:205) at [email protected]/sun.net.www.protocol.https.HttpsClient.New(HttpsClient.java:287) at [email protected]/sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.getNewHttpClient(AbstractDelegateHttpsURLConnection.java:193) at [email protected]/sun.net.www.protocol.http.HttpURLConnection.plainConnect0(HttpURLConnection.java:1007) at [email protected]/sun.net.www.protocol.http.HttpURLConnection.plainConnect(HttpURLConnection.java:898) at [email protected]/sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.connect(AbstractDelegateHttpsURLConnection.java:179) at [email protected]/sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1376) at [email protected]/sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1301) at [email protected]/java.net.HttpURLConnection.getResponseCode(HttpURLConnection.java:493) at [email protected]/sun.net.www.protocol.https.HttpsURLConnectionImpl.getResponseCode(HttpsURLConnectionImpl.java:307) at org.graalvm.maven.downloader.MVNDownloader.downloadFromServer(MVNDownloader.java:220) at org.graalvm.maven.downloader.MVNDownloader.downloadMavenFile(MVNDownloader.java:200) at org.graalvm.maven.downloader.MVNDownloader.downloadDependencies(MVNDownloader.java:109) at org.graalvm.maven.downloader.Main.main(Main.java:163) at com.oracle.graal.python.shell.GraalPythonMain.polyglotGet(GraalPythonMain.java:156) at com.oracle.graal.python.shell.GraalPythonMain.preprocessArguments(GraalPythonMain.java:167) at org.graalvm.launcher.AbstractLanguageLauncher.launch(AbstractLanguageLauncher.java:282) at org.graalvm.launcher.AbstractLanguageLauncher.launch(AbstractLanguageLauncher.java:126) at org.graalvm.launcher.AbstractLanguageLauncher.runLauncher(AbstractLanguageLauncher.java:180)
I have to connect to the Internet through a proxy,but I'm not sure if this is caused by the proxy.
According to the prompt information, I want to solve it by changing the internal mvn source. When I checked the org.graalvm.maven.downloader source code, I found a way to set the source, but I cant not set "org.graalvm.maven.downloader.repository" environment.

...
static final String DEFAULT_MAVEN_REPO = "https://repo1.maven.org/maven2/";
static final String MAVEN_PROP = "org.graalvm.maven.downloader.repository";
...

public static String getDefaultRepo() {
    var repo = System.getenv(MAVEN_PROP);
    if (repo == null) {
            return DEFAULT_MAVEN_REPO;
     } else {
            return repo;
     }
}

What should I do to resolve "java.net.UnknownHostException".

@timfel
Copy link
Member

timfel commented Jun 4, 2025

As you saw you can just set the environment variable org.graalvm.maven.downloader.repository if you want to point to a maven mirror.

env 'org.graalvm.maven.downloader.repository=http://my.maven.internal.repo/' graalpy -m standalone --verbose native --module test.py --output test --venv venv

Make sure your mirror is reachable though, otherwise it'll look like this:

using GRAALVM: /home/tim/.sdkman/candidates/java/23-graal
  native_image: /home/tim/.sdkman/candidates/java/23-graal/bin/native-image
  javac: /home/tim/.sdkman/candidates/java/23-graal/bin/javac
downloading graalpython maven artifacts: /home/tim/.pyenv/versions/graalpy-24.2.1/libexec/graalpy-polyglot-get -a python-embedding -g org.graalvm.python -v 24.2.1 -o /home/tim/.pyenv/versions/graalpy-24.2.1/downloaded_standalone_resources
Jun 04, 2025 7:49:50 PM org.graalvm.maven.downloader.Main main
INFO: downloading org.graalvm.python:python-embedding:24.2.1 from http://my.maven.internal.repo/ to /home/tim/.pyenv/versions/graalpy-24.2.1/downloaded_standalone_resources
Jun 04, 2025 7:49:50 PM org.graalvm.maven.downloader.MVNDownloader getProxy
INFO: using proxy 'https://my.corporations.proxy:8080'
Jun 04, 2025 7:49:50 PM org.graalvm.maven.downloader.MVNDownloader downloadMavenFile
WARNING: could not download maven file from http://my.maven.internal.repo/org/graalvm/python/python-embedding/24.2.1/python-embedding-24.2.1.pom, because of: java.io.IOException: Skipping download from http://my.maven.internal.repo/org/graalvm/python/python-embedding/24.2.1/python-embedding-24.2.1.pom due to response code 502. Falling back on https://repo1.maven.org/maven2

@kuanyan9527
Copy link
Author

kuanyan9527 commented Jun 5, 2025

Thanks @timfel your method works, but a new error occurred:
WARNING: could not download maven file from http://my.maven.internal.repo/org/graalvm/python/python-embedding/24.2.1/python-embedding-24.2.1.pom, because of: javax.net.ssl.SSLHandshakeException: (certificate_unknown) PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target. Falling back on https://repo1.maven.org/maven2/
I googled and found a solution

keytool -import -noprompt -trustcacerts -alias mymavenrepo.crt -file $JAVA_HOME/lib/security/mymavenrepo.crt -keystore $JAVA_HOME/lib/security/cacerts -storepass changeit

Unfortunately, it doesn't seem to work.

@timfel
Copy link
Member

timfel commented Jun 5, 2025

@kuanyan9527 if your custom repository is inside your org, you don't need the proxy. try unsetting the proxy environment variables to access it without a proxy

@kuanyan9527
Copy link
Author

Yes, it is the internal Maven repository. I have unset the proxy, but an SSLHandshakeException error occurred.

@timfel
Copy link
Member

timfel commented Jun 6, 2025

Hm, then I don't know, sorry, We just use URLConnection conn = url.openConnection(getProxy());, but this is running AOT compiled, so nothing you do to your JAVA_HOME will affect this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants