1

I am using httpurlconnection to post on Facebook,but I am getting following exception

 java.net.UnknownHostException: graph.facebook.com  

might be due to proxy setting,same code running fine while running in a java stand alone application while putting following

 codeProxy proxy = new Proxy(Proxy.Type.HTTP,new InetSocketAddress("proxy.domain.com", 8080))

Can any one tell how to set proxy on weblogic server?

asgs
  • 3,928
  • 6
  • 39
  • 54
Atiksh
  • 11
  • 2

2 Answers2

0
  1. Set system properties http.proxyHost and http.proxyPort. You can do this with System.setProperty(), or from the command line with the -D syntax. and kindly refer to http://docs.oracle.com/javase/7/docs/api/java/net/doc-files/net-properties.html#Proxies

  2. you also need to declare -DUseSunHttpHandler=true in the weblogic. it will force use sun/oracle sun.net.www.protocol.http.HttpURLConnection implemention for java.net.HttpURLConnection instead of weblogic.net.http.SOAPHttpURLConnection

try to use connection.usingProxy() to verify the proxy works or not after openConnection();

Ajax Zhang
  • 356
  • 3
  • 12
0

To configure WebLogic proxy file is modified setDomainEnv.cmd (Windows) that is located in the bin folder of the domain.

For example for the integrated server is here

C: \ Users \ [YOUT USER NAME] \ AppData \ Roaming \ JDeveloper \ system11.1.1.4.37.59.23 \ DefaultDomain \ bin

The following property must be placed on file with the details of your proxy

@REM Estableciendo proxi
set JAVA_OPTIONS=%JAVA_OPTIONS% -Dhttp.proxySet=true -Dhttp.proxyHost=192.168.101.11 -Dhttp.proxyPort=8080 -Dhttp.nonProxyHosts=localhost

See the nex link:

Configure Web Logic Proxi

Ronald Coarite
  • 4,460
  • 27
  • 31