Cannot tunnel through proxies. Proxy returns HTTP / 1.1 503 Service Unavailable

I want to connect to an intranet server, the url I need to connect is:

URLConnection conn = new URL("https://mywebsite").openConnection();

When I get to the connection method call, do the following: `

conn.connect();

I get the following exception:

java.io.IOException: Unable to tunnel through proxy. Proxy rerurns HTTP/1.1 503 Service Unavailable"
at sun.net.www.protocol.httpHttpURLConnection.doTunneling

How can I solve this exception, I have tried many solutions posted online but with no luck.

+6
source share
2 answers

, (http_proxy ..; java, -Dhttp.proxyHost=.., , ). URL (https://mycompany.example.com/service) ( ), .

, , , .

0

. jaxws-maven-plugin maven jaxws-maven-plugin Java- WSDL, . , httpproxy, noproxy. , JVM:

<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>jaxws-maven-plugin</artifactId>
<version>2.4.1</version>
<executions>
    <execution>
        <id>wsdltoJava</id>
        <goals>
            <goal>wsimport</goal>
        </goals>
        <configuration>
            <wsdlUrls>
                <wsdlUrl>https://someService.yourcompany.net/Service/Service?wsdl</wsdlUrl>
            </wsdlUrls>
            <vmArgs>
                <vmArg>-Dhttp.nonProxyHosts=*.yourcompany.net</vmArg>
            </vmArgs>
            <keep>true</keep>
            <packageName>com.yourcompany.package</packageName>
            <sourceDestDir>your/target/directory</sourceDestDir>
        </configuration>
    </execution>
</executions>

0

Source: https://habr.com/ru/post/1672723/


All Articles