Reputation: 53
trying to connect to Kafka but with Schema Registry behind proxy that requires authentication. I'm aware that Schema Registry Client right now does not support providing proxy credentials (https://github.com/confluentinc/schema-registry/issues/2137).
However I tried to set the proxy settings on system level and reuse them in my Java app, that connects to the Schema Registry and tries to put a simple message.
Attempt 1:
java -Djava.net.useSystemProxies=true -jar ./avro-producer-2.1.0-jar-with-dependencies.jar
result: Error connection refused. Seems like the proxy parameters were ignored completely.
[2024-01-12 16:56:47,210] (io.confluent.kafka.schemaregistry.client.rest.RestService) - ERROR Failed to send HTTP request to endpoint: https://xyz.cloud/subjects/mycorp.crm.campaign.
V1-value/versions
java.net.ConnectException: Connection refused (Connection refused)
at java.net.PlainSocketImpl.socketConnect(Native Method) ~[?:1.8.0_352]
at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350) ~[?:1.8.0_352]
at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206) ~[?:1.8.0_352]
at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188) ~[?:1.8.0_352]
at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392) ~[?:1.8.0_352]
at java.net.Socket.connect(Socket.java:607) ~[?:1.8.0_352]
at sun.security.ssl.SSLSocketImpl.connect(SSLSocketImpl.java:293) ~[?:1.8.0_352]
at sun.net.NetworkClient.doConnect(NetworkClient.java:175) ~[?:1.8.0_352]
at sun.net.www.http.HttpClient.openServer(HttpClient.java:463) ~[?:1.8.0_352]
at sun.net.www.http.HttpClient.openServer(HttpClient.java:558) ~[?:1.8.0_352]
at sun.net.www.protocol.https.HttpsClient.<init>(HttpsClient.java:264) ~[?:1.8.0_352]
at sun.net.www.protocol.https.HttpsClient.New(HttpsClient.java:367) ~[?:1.8.0_352]
at
Attempt 2:
java -Dhttp.proxyHost=myproxy.myorg.com -Dhttp.proxyPort=8080 -Dhttp.proxyUser=myuser_dev -Dhttp.proxyPassword=p3aFxxxx -Dhttps.proxyHost=myproxy.myorg.com -Dhttps.proxyPort=8080 -Dhttps.proxyUser=myuser_dev -Dhttps.proxyPassword=p3aFxxxx -Djdk.http.auth.tunneling.disabledSchemes="" -Djdk.http.auth.proxying.disabledSchemes="" -Djdk.https.auth.tunneling.disabledSchemes="" -Djdk.https.auth.proxying.disabledSchemes="" -jar ./avro-producer-2.1.0-jar-with-dependencies.jar
result: Error proxy returns authorization required
(io.confluent.kafka.schemaregistry.client.rest.RestService) - ERROR Failed to send HTTP request to endpoint: https://xyz.cloud/subjects/mycorp.crm.campaign.
V1-value/versions
java.io.IOException: Unable to tunnel through proxy. Proxy returns "HTTP/1.1 407 authenticationrequired"
at sun.net.www.protocol.http.HttpURLConnection.doTunneling(HttpURLConnection.java:2154) ~[?:1.8.0_352]
at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.connect(AbstractDelegateHttpsURLConnection.java:195) ~[?:1.8.0_352]
at sun.net.www.protocol.http.HttpURLConnection.getOutputStream0(HttpURLConnection.java:1342) ~[?:1.8.0_352]
at sun.net.www.protocol.http.HttpURLConnection.getOutputStream(HttpURLConnection.java:1317) ~[?:1.8.0_352]
at sun.net.www.protocol.https.HttpsURLConnectionImpl.getOutputStream(HttpsURLConnectionImpl.java:264) ~[?:1.8.0_352]
at io.confluent.kafka.schemaregistry.client.rest.RestService.sendHttpRequest(RestService.java:178) [avro-producer-2.1.0-jar-with-dependencies.jar:?]
Java version is OpenJDK 1.8.0_352
What am I doing wrong?
Upvotes: 1
Views: 265