We have one webservice which invokes third party webservice. To test this implementation we have different environments.
Local Developer Machine: When we run the application, everything works fine and our webservice is able to hit the third party URL. (Local Machine uses Windows OS)
Local Development Server: After deploying the application on development server, we are not able to access the third party URL and get Http Proxy 407 error. (We are having Linux, with IBM J9 JVM.)
To get around this problem, we tried setting -Dhttps.proxyUser XXX -Dhttps.proxyPassword XXX, but we continued to get the error. The second option we tried is using Authenticator.setDefault(new CustomImplAuthenticator()). But surprisingly, the JVM didnt invoke getPasswordAuthentication and continued to throw error.
We ran the same application again on local developer machine with authenticator.setdefault code. We could access the URL as said earlier, but this time again JVM didnt invoke getPasswordAuthentication method. After searching over net, we found that through NTLM the authentication data is resolved and hence we feel that the code is working on windows.
Can anyone let me know what settings, we should configure on application deployed in Linux box so that at least implementation assigned for Authenticator.setDefault will be invoked.
It depends on how you build up your http connection.
if you for example use the Apache HTTPClient you can set the proxy configuration into the DefaultHttpClient by invoking setProxyAuthenticationHandler.
Your implementation that does the http call needs to know about the proxy.
Related
In windows 2003 using JDK 1.7_21
So I setup Jemeter on my desktop to do an HTTP request to a specific URL and it works fine. But when I try from another machine I get a connect timeout.
The URL works fine in the I.E browser and I can also ping the domain from the command line. But for wahat ever reason the JVM doesn't want to connect.
In fact this is to test a sample HTTPClient I wrote. it's not the code because the code works off the desktop but on the server environment the JVM wont connect, proof JMeter wont either. but the browser and pings works.
I suspect java is getting it's network settings from somewhere different??? Proxy???
Well.. is IE/Windows using a proxy? You can check by going to to Internet Options > Connections > LAN Settings
If it is, you can set some JVM properties so that your Java application uses a proxy, there a couple ways of doing that, one way is through the command line when you execute it, you can use something similar to:
java -Dhttp.proxyHost=your.proxy -Dhttp.proxyPort=your.proxy.port -jar your.jar
or
java -Dhttp.proxyHost=your.proxy -Dhttp.proxyPort=your.proxy.port YourMainClass
My webservice is running on jboss and client is on the tomcat
both client and webservice is running perfect on my local machine.
but if i setup client on another machine, the client program giving an error message 404 not found
I have shared my jboss over network and i am able to access webservice wsdl from another machine using http:192.168.1.26:8080/FalconServer/SearchService?wsdl
I set the same url in Client code.
but it won't work, any help
I wanted to put this as a comment, but i dont seem to find a comment button.
Did you start your jboss binding to your ip address. One way to do that:
run -b
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.
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...
and
Caused by: java.net.UnknownHostException: www.hostname.com
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?
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.
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
Where proxyhostname and the port number are correct for your setup. Then you need to restart the server.
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.
Also, this link was good for various proxy options to the JVM:
http://download.oracle.com/javase/6/docs/technotes/guides/net/proxies.html
You have to explicitly set the proxy server. Several options are available depending on the Glassfish version. In general you can set the proxy by either using JVM arguments or the Glassfish Admin console. An intro for GF3 is available here (sorry for only providing a link, but I do not want to repeat all the details here).
Just to make the answer complete, if the proxy requires user name and password, set the following in Glassfish:
-Dhttp.proxyUser=someUserName
-Dhttp.proxyPassword=somePassword
The host cannot be resolved, are you sure you use a hostname resolvable by an internet DNS server or are you using something that can only be resolved from within your network or even worse, a hosts entry local to your machine?
Aside from that, the proxy server might be denying you access to some ports, but this is probably not your problem right now. If the proxy allows access to port 80, try running your Glassfish on port 80 as well if you get any connection timeout errors.
I am having a problem with a signed Java applet which performs simple HTTPS requests to our server (using Java's URL, Connection classes). Everything looks ok for majority of the clients. However, we do have several clients under corporate network, which are behind a proxy that requires authentication (possibly windows-logon-based authentication)). And for these clients we often hear such feedback like:
The application behaves extremely slow though our network speed is 20mbps.
20mbps connection is a huge speed for our application to work perfectly.
So my first question specifically the following:
1) Can it be the case that proxy analyses the content of our requests and thus impacts the performance of the app. And could it be only a Java-specific problem ?
The next part is about Java and Java applets specifically.
From forums I know there is a problem with Java selecting the right proxy configured in Browser. Sometimes Java applet fails to detect the proxy configured in IE, and the only solution is to configure it also in Java's Control Panel.
Having said this, the next question is:
2) Taking into account that direct connection for the corporate clients is not allowed and Java Control Panel is not properly configured, could that be the case that Java plugin selects another - wrong proxy, thru which it eventually access to the servers and thus resulting very low performance ?
I also have tried to use Apache's HttpClient (http://hc.apache.org/httpcomponents-client-ga/), to check how it performs under such environment. I have configured the client as specified in Apache tutorial to automatically get the JRE's proxy:
httpclient = new DefaultHttpClient();
ProxySelectorRoutePlanner routePlanner = new ProxySelectorRoutePlanner(
httpclient.getConnectionManager().getSchemeRegistry(),
ProxySelector.getDefault());
httpclient.setRoutePlanner(routePlanner);
And what we faced is an authentication required error (407) when we try to execute requests via Apache's httpclient. Specifically407 proxy authentication required. the ISA server requires
authorisation to fulfill the request
So the last question is about this differences between Apache and Java's client.
3) How Java Applet chooses the proxy ? and How Apache Client's selection logic differs from that of Java's ?
Please share any strongly confirmed experience you might find out could be helpful for my situation.
Thanks in advance.
3) How Java Applet chooses the proxy ?
Default behaviour:
Applet checks control panel\java\ network\network proxy settings
and uses the proxy according to the configuration in there.
Setting system properties for an applet does not works.
i.e:
System.setProperty("java.net.useSystemProxies","true");
System.setProperty("http.proxyHost", "1.1.1.1");
System.setProperty("http.proxyPort", "8080");
If you want to alter the proxy selection for an applet.
then you can use ProxySelector class.
also check out this question how-to-set-http-proxy-in-an-applet you may find it useful.
I've been trying to setup W3C Unicorn on Ubuntu 10 using Tomcat6 but running into a few problems with proxy servers.
I've got Unicorn configured (via tomcat) to use a proxy server using java's -Dhttp.proxyHost and -Dhttp.proxyPort. This works fine and Unicorn is able to download the files it needs.
The problem is that we're trying to use it to validate content on an internal network which requires bypassing the proxy server. I've tried using -Dhttp.nonProxyHosts but nothing seems to be working. Unicorn just keeps giving the following errors whenever I try to validate using a local URL:
From the HTML validator:
HTTP Error
Unexpected HTTP response 500 Can't connect to some.internal.dom (Bad hostname 'some.internal.dom') while trying to retrieve http://some.internal.dom:4000/
From the HTTP validator:
Checker Error
Could not connect to the server (No address associated with hostname)
And from the Feed Validator:
Server returned (-2, 'Name or service not known')
An error occurred while trying to validate this feed.
I've tried everything I can think of but just don't seem to be able to get the nonProxyHosts to work. Any suggestions?
Thanks
Discovered after some investigation that Unicorn doesn't actually provide the validation services, it redirects requests to the W3C (or any other configured) validation service. This means the local proxy configuration was irrelevant as the request was being passed to W3C who weren't able to connect to our internal network (obviously), which explains why we were getting the error messages despite the proxy configuration working.
Each of the W3C validators can be downloaded and installed independently, and Unicorn can then be configured to connect to those instead of the official W3C validators.
Took a lot of digging to work this out - the W3C Unicorn site needs to explain things a bit clearer!