如何设置 Glassfish 以通过代理服务器?

How do I set up Glassfish to go via a proxy server?(如何设置 Glassfish 以通过代理服务器?)

本文介绍了如何设置 Glassfish 以通过代理服务器?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在办公室内的本地计算机上运行 Glassfish v2.1.1 实例时遇到问题,我们有一个用于传出连接的代理服务器.我最初的解决方法是在家工作.

I have been having issues with running a Glassfish v2.1.1 instance on my local machine from within the office, where we have a proxy server for outgoing connections. My initial workaround has been to work from home.

我正在公司外部的 HTTPS 服务器上调用 SOAP 服务.由于 Glassfish 未通过公司的代理服务器,因此在尝试初始化 SOAP 客户端时出现以下错误:

I am calling a SOAP service on a HTTPS server outside of the company. As Glassfish is not going via the company's proxy server, I get the following error when trying to initialise my SOAP clients:

javax.xml.ws.WebServiceException: Failed to access the WSDL at: https://www.hostname.com...

Caused by: java.net.UnknownHostException: www.hostname.com

我在我的命令行上设置了代理环境变量,并且我的系统代理设置都正常工作,以便我可以使用浏览器访问 WSDL.我应该如何配置 Glassfish?

I have proxy environment variables set on my command line, as well as my system proxy settings all working correctly so that I can get to the WSDL with the browser. How should I configure Glassfish?

推荐答案

我很难找到这个问题的答案,因为这个主题在网络上没有详细介绍.一个链接告诉我如何配置 HTTP 代理,但没有提到 HTTPS,所以我花了一段时间才弄明白.

I had a lot of trouble finding an answer to this, as the topic isn't covered in a lot of detail on the web. One link told me how to configure the HTTP proxy, but mentioned nothing about HTTPS, so it took me a while to figure it out.

打开 Glassfish 服务器上的管理控制台并转到:应用程序服务器 -> JVM 设置 -> JVM 选项.点击添加JVM选项"4次,输入以下4个选项

Open up the admin console on your Glassfish server and go to: Application Server -> JVM Settings -> JVM Options. Click "Add JVM Option" 4 times and enter the following 4 options

-Dhttp.proxyHost=proxyhostname
-Dhttp.proxyPort=8080
-Dhttps.proxyHost=proxyhostname
-Dhttps.proxyPort=8080

proxyhostname 和端口号对于您的设置是正确的.然后你需要重启服务器.

Where proxyhostname and the port number are correct for your setup. Then you need to restart the server.

请注意,我找不到从 PAC 文件设置代理的任何选项,也找不到需要身份验证的代理.在这种情况下,您可能需要安装本地身份验证代理处理程序,例如 Mac OS X 的 Authoxy,它将您的 localhost 变为非身份验证代理,并屏蔽来自中央身份验证代理的身份验证请求.

Note that I couldn't find any options for setting up the proxy from a PAC file, nor for proxies which require auth. In this case, you may need to install a local auth proxy handler like Authoxy for Mac OS X, which turns your localhost into a non-auth proxy and masks the authentication request from the central auth proxy.

此外,此链接适用于 JVM 的各种代理选项:http://download.oracle.com/javase/6/docs/technotes/guides/net/proxies.html

Also, this link was good for various proxy options to the JVM: http://download.oracle.com/javase/6/docs/technotes/guides/net/proxies.html

这篇关于如何设置 Glassfish 以通过代理服务器?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!

本文标题为:如何设置 Glassfish 以通过代理服务器?

基础教程推荐