Not able to debug from one web app to another web app - java

I am running two web application using IntelliJ. Both are running on http port 8080 and for one I have changed jmx port to 9099. Issuse is when I try to call another app using httpget HttpGet httpGet = new HttpGet(http://localhost:8080/b-app); from the a-app, http request never hitting http://localhost:8080/b-app. Do I need any specific configuration in intelliJ for it?
Thanks for the help

Related

URI for connecting to Heroku WebSocket endpoint

We have a Java web application at http://ourapp.com hosted at Heroku and the frontend of the app cannot connect to the WebSocket endpoint (endpoint) running in a Heroku dyno. We have tried these URIs:
ws://ourapp.com/endpoint
ws://ourapp.com:80/endpoint
ws://ourapp.com:8080/endpoint
ws://ourapp.com:8084/endpoint
ws://ourapp.com:443/endpoint
wss://ourapp.com/endpoint
wss://ourapp.com:80/endpoint
wss://ourapp.com:8080/endpoint
wss://ourapp.com:8084/endpoint
wss://ourapp.com:443/endpoint
None of the above open a connection. What are we missing here?
PS: I have set up a test ground: http://vakuutustiedot-dev.herokuapp.com/websocket.test.html (the URI is PROTOCOL:vakuutustiedot-dev.herokuapp.com:PORT/trial)
The target app runs in a Heroku Apache Tomcat 8.5.38.
What comes to the port number, I am not sure how to get one.
Perhaps you have missed adding the support of WebSockets to Heroku, like in this answer (https://stackoverflow.com/a/50002416/11197115)?
Maybe you should try configuring the proxy attribute of devServer. This attribute is used when the frontend app and backend api are not running on the same host. Perhaps the below setting might solve your problem.
module.exports = {
devServer: {
proxy: 'ws://ourapp.com:8080/endpoint'
}
}
For more info see the docs: https://cli.vuejs.org/config/#devserver

Getting Kerberos Auth header only with Fiddler

I am new to Windows authentication and am facing a weird issue.
I have setup an application with SPNEGO filter library for Java.
All settings as per the documentations have been set.
Now when i open the URL of my application from another machine in the same domain, using any browser, i get a negotiation header as
TlRMTVNTUAABAAAAl4II...
This means that it is an NTLM negotiation request.
if i start fiddler and then try to run the same request for testing, i am getting a kerberos authentication request.
YIIGgwYGKwYBBQUCoIIGdzCCBnOgMDAuBg...
This means that when I am calling using fiddler, the browser is assuming that the system is on same network.
I am unable to figure out why this is happening..??
I need the kerberos ticket even in normal execution.
Server: JBoss 4.3.2 GA
anybody has any idea...??
thanks in advance

Accessing Servlet from android httpclient programs getting connection refused?

While I access the localhost servlet from android httpclient utils I am getting connection refused error. The servlet is running fine, but I am getting error.
This is the code:
String dmurl="http://127.0.0.1:9090/DataManagerProject/DMServlet";
HttpClient httpClient = new DefaultHttpClient();
HttpGet hrtreq = new HttpGet(dmurl);
HttpResponse resp = httpClient.execute(hrtreq);
String output = EntityUtils.toString(resp.getEntity());
I am getting following error org.apache.http.conn.httphostconnectexception connection to refused
if you are using emulator to run your app for local server. mention the local ip as 10.0.2.2 and have to give Internet permission into your app
For more details, please refer this link.
Also, Turn Off the firewall and any anti-virus application in your PC
Check whether you have internet access enabled in your emulator and in your application
<uses-permission android:name="android.permission.INTERNET"/>
To access internet data of the device or emulator from your application add the above line in your manifest xml file.Also check the servlet mapping is proper in your the servlet project.
Assuming your servlet runs on your computer the reason you can't get a connection is because your using the wrong IP. 127.0.0.1 is a loopback address meaning that if you connect to 127.0.0.1 on your Android device, it will try to connect to the Android device.
To make it work you have to find the IP address of the computer which runs the servlet and use that in the URL instead.
In addition make sure you have given the Internet permission to your app.

How to get a response from localhost server in GWT client side?

I have a WCF based web service and hosted on local machine written in c#. I want to get a response from this hosted service in my GWT client side.
Please check the following code:
url = "localhost:8089/request"
RequestBuilder builder = new RequestBuilder(RequestBuilder.GET, url);
Request response = builder.sendRequest(null, new RequestCallback() {
#override
public void onResponseReceived(Request request, Response response) {
Window.alert(response + " ");
}
});
Everytime when i am trying to run the code it shows an "http://localhost:8089 is not allowed by Access-Control-Allow-Origin."
PS: i searched for this error but i don't want to disable the web security of all browsers.
Is there any alternative solution to do get response of localhost server running on different porn on same machine. That is why i want to call a url in client side.
Please suggest a solution.
Edit
Let me explain you full scenario in points:
GWT application is hosted on some server (www.abc.com)
WCF is a web service installed at each client.
A client open his/her browser and put the url (www.abc.com/page)
This page want to access the web services hosted on a client machine.
Can't you configure your WCF service to send an Access-Control-Allow-Origin: www.abc.com response header?
Otherwise, I guess you could use a proxy servlet in www.abc.com that proxies the call to the getRemoteAddr, assuming there's no proxy in-between.

java - can't make http request on port other than 80

My java program is hitting "http://url:port" kind of url to fetch some data. On my local windows machine deployed on tomcat 6, it is working fine. But on production which is a linux machine having tomcat 6 on it, it gives me connection timeout.
Ironically, if I hit the URL without port number, it will successfully bring me the output but not with port. Not finding any clue, please help.
The snippet of code I am using to connect and fetch data is:
HttpClient httpclient = new DefaultHttpClient();
HttpGet httpget = new HttpGet("59.162.167.36:80/api/…");
httpget.setHeader("User-Agent", "UserAgent: Mozilla/5.0");
HttpResponse response = httpclient.execute(httpget);
HttpEntity entity = response.getEntity();
One obvious possibility is that a firewall in front of your production machine is blocking access to that port. Check the firewall.
The answer is straightforward: On production you don't have that port opened, contact the administrator, or the hosting and issue your problem. Of course they will confirm my thesis.
Almost certainly your hosting provider implements a firewall of some description in the data center. This is common practice. Send them a message asking if port X is blocked, and if so can they open it.

Categories

Resources