Atmosphere framework examples do not work. Any idea? - java

Perhaps I am going mad, but I've spent the whole day just trying to get the standard samples on the atomosphere (https://github.com/Atmosphere/atmosphere-samples/) to work. Specifically the 'chat'. The instructions are simple - I follow them:
mvn package
cd samples/chat
mvn jetty:run
I visit localhost:8080 and I see the default page - it tells me it connects to the websockets. I see on the Jetty logs it registers the connection. I enter the 'user name' as requested, and then I get a javascript error 'WebSocket not connected.' - after a couple of minutes it says "Connection lost, trying to reconnect. Trying to reconnect 5000" upon which it then connects and works without any issues. Its the same on Chrome, firefox and Safari. Its also the same on 2 different Macs (mavericks) and 1 Windows 7 PC. It consistently fails like this. I have no firewall, proxy , etc running.
I am going out of my mind, and I cannot proceed with my work/project. Its getting late here and I'm dreading another whole day at this getting no where. Any ideas or can some just test this to make sure I'm not going mad? I posted on the user group but just got 'its your environment'. I've tried 3 environments and it makes no difference.
thanks

Ok. I think this 'Fix' has broken the samples;
https://github.com/Atmosphere/atmosphere-javascript/issues/74
debugging the atmosphere.js I see that webSocketOpened = true; is never set, and hence why the client can't send any messages as it thinks the connection is not open even though it is.
If I used client 2.1.4-SNAPSHOT the samples work fine.

Related

The application on Angular does not receive a response from the server

There is an application on Angular, the backend is an application on Java-Spring.
Both of them are running on a server in a shared network, on a Windows OC machine in VirtualBox (Linux).
The essence of the problem is that when you try to open a web application in a browser, it runs completely on one computer out of five with Windows OC and on one of one on Linux OC.
The browser is everywhere Chrome, only in Linux Mozilla
The application itself is launched, but it does not receive data from the backend at startup.
At the same time I get an error
Failed to load resource:
http://10.151.78.6:5003/es-serv/api/v1/get-data/sh1 net::ERR_CONNECTION_RESET
Here is the controller method that receives requests, there is no call to it in the logs
#GetMapping("/get-data/" + RestApiConstants.VARIABLE_NAME)
public ResponseEntity<ListResponse<DataDto>> getData(
#PathVariable(RestApiConstants.PARAM_NAME_WORD) String name) {
log.info("getData -> start");
return converterDtoService.converterDataDto(name);
}
Moreover, if you just try to open the link in the browser bar
http://10.151.78.6:5003/es-serv/api/v1/get-data/sh1
Then I get the data every time, I have never noticed any failures.
Very similar to the problem with CORS, but then the browser gives a specific error to all requests. Yes, and cors is disabled in the Java application. And even then it is not clear why it still works on some browsers.
It doesn't look like a timeout problem either, because I get an error instantly, and when the server doesn't respond, some time passes and it's noticeable.
And another such moment, I added a forced data reading button to the application. And after 20-30 attempts to read the data, the answer may still come to those computers that did not receive them.
If it was a problem with the network, then it is unclear why on the same computer from the same browser, the GET request typed in the browser line gets answers all the time, without a single pass.
Tell me where to look to understand the reason?
The problem was solved by updating the browsers to the latest version. And before that, the browser version was not very old. I don't understand how this could affect the transmission of the GET request over the network?

XAMPP / java.net.BindException: Address already in use

I was wondering if someone could help me out with an issue I'm having. I'm using a Jetty server and using XAMPP to connect to a MySQL server, which I'm accessing through PHPMyAdmin.
I have a class that essentially is meant to drop all the tables in a database and then add some more, with data.
The first time I ran it, it worked fine, and did what it's meant to do, but the next time, I'm getting errors like the ones below. If I try it with a different database on the same host, again, it works fine first time, but any additional attempts will not work.
Can anyone shed some light please?
It seems that your Jetty instance is already running. Try to stop it and then run your test again.
If I try it with a different database on the same host, again, it works fine first time, but any additional attempts will not work.
This is happening because, I suppose, you are trying to start the server every time you start a test, but not closing after the test is done.
You can now either stop your Jetty instance manually, using Task Manager, restarting your machine in order to be able to run tests again
You've probably ran Jetty server twice or port 8444 is being 'listened' by another application.
Fire that command and find out which service is using that port
netstat -aon | find /i "listening"

Java RMI app works fine from XP, but refuses connection from Windows 7

We are currently evaluating upgrading from XP to Windows 7, but have one last sticking point, we can't seem to run our Java RMI application from Windows 7.
I'm using the same JRE / Classpath from both machines, is there any other gotcha's that I'm missing?
Update
I have run Wireshark on both machines, and it appears the Windows 7 box makes the request, but the response coming back from the server fails with
Trans2 Response, QUERY_PATH_INFO, Error: STATUS_OBJECT_PATH_NOT_FOUND
any ideas where I go from here?
Update 2
I have created a fresh XP installation (gotta love virtual machines) and the application runs without a problem, clearly something has changed in Windows 7
Update 3
We've created a fresh Windows 7 install, in the same datacenter as the server and that connects fine, so my friendly(!) network admin needs to sort out his network, definitely looking like a firewall issue somewhere. Thanks to all (especially Lucian) for all the time you've spent on this.
Did you unblock the port you use for your application's RMI?
I remember having this problem once.
The default port for RMI is 1099 if I remember correctly, but you can set that in the command line.
Edit:
Are sections A.3 or C.4 from here or section 6.0 from here of any help?
Edit2:
Here's a link to an access permissions thread related to the response found with Wireshark.
In case this helps anyone in future, there was a "Policy Map Inspection" on our Cisco router, we disabled "inspect skinny" and everything works. Cisco Tech note this was stopping all returning RMI traffic before it made it to the firewall, so was very hard to debug.

Android - Check if external server is online

I want to check if my server is online before launching any activity with an online component.
I have tried using ping
runtime.exec("ping -c 1 google.com");
proc.waitFor();
int exit = proc.exitValue();
but this will always give either exit code 1 or 2, never 0, even when I know the server is online..
I have also tried
Online=InetAddress.getByName("www.google.com").isReachable(10000);
But apparently this function is flakey as hell with external servers, and as such it doesn't work either.
Surely such a basic function as checking if a server is online should be pretty straightforward? does anyone have any ideas I haven't tried yet?
Try connecting to the server, using whatever protocol you are going to use "for real". Just because a server responds to a ping does not mean that the server is running for what you need it for. So, for example, if you are going to make requests of a Web service, perform some simple HTTP operation.

FTP connection "hangs" on "LIST"

All,
I have an issue with a remote ftp server that has kept me busy for three days now and I am going nuts over it. :(
A while ago, I wrote a simple ftp retriever class that uses apache commons-net 2.0. The class works fine on 5 different ftp servers, I can retrieve data as I want.
Now I have come across a server that I need to connect to that just won't let me list directories or retrieve data.
This is the order of commands that are being sent and retrieved by my class:
220 (vsFTPd 2.0.1)
USER XXXXXXX
331 Please specify the password.
PASS XXXXXXX
230 Login successful
TYPE I
200 Switching to Binary mode.
PASV
227 Entering Passive Mode (XXX,XXX,XXX,XXX,XXX,XXX)
NLST
150 Here comes the directory listing.
226 Directory send OK.
SYST
215 UNIX Type: L8
PASV
227 Entering Passive Mode (XXX,XXX,XXX,XXX,XXX,XXX)
LIST
150 Here comes the directory listing.
At the last line, my code hangs indefinitely (well, I killed it after 2 hours of waiting to see how long it would block). I have tried everything, from using an active connection to setting ASCII type to using different ftp libraries - always with the same result.
Normally, I would just call the guys and tell them that their server is configured incorrectly. However, connecting via FileZilla not only works but is lightning fast and never causes any problems. Also, connecting via command line on linux works like a charm.
I am totally lost here. Does anybody have any ideas why I have this problem?
Cheers
I cannot believe that I spent almost five days on this. After long sessions of rolling back changes, committing intermediate versions, debugging and about 15923 cups of coffee, I finally found the reason for all this mess.
It turns out that - for whatever reason - as soon as you package xpp3 drivers (as in XStream) in your ear and deploy this on JBoss 5.1, any connection via any ftp libraries will get messed up.
I have no idea if this is caused by other libraries interfering with xpp3 or if it is xpp3 itself. Frankly, I could not care less, either at the moment. All I know is that as soon as I removed that dependency from my project everything worked like a charm.
Damn you, xpp3 - I will sue you for the ten years of my life you cost me! :)
Thanks all for your help, I am going home now...
Suggestion: install Wireshark on the client machine and capture network traces under both working (filezilla) and non-working conditions to see what's different. If you're on Linux use the tcpdump command to capture the packets and then use Wireshark to examine them.

Categories

Resources