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

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"

Related

no process listening on port 8080 but shows already in use

I try to start a Spring boot project. It worked fine originally, but after I restart my computer for some reason, I keep getting the messages "Port xxxx was already in use".
And Even if I change the port, I still get this error. I'm pretty sure I have no process in use.
Though it might be solved when I restart my computer, I was still wondering the problem.

jdbc driver does not work in java

In java, I use jdbc connect to sqlite. the following sentence works,
Connection conn =DriverManager.getConnection("jdbc:sqlite:C://Users//13149//Desktop//SqliteDB0.sqlite");
When I replace this with the following one.
Connection conn =DriverManager.getConnection("jdbc:sqlite://localhost:3306//Database//SqliteDB0.sqlite")
The first time, it does not give any error message, only stop there. However, as I run it again, it always gives error message. Anyone can help me? Thanks.
Maybe you have gotten the wrong idea. A SQLite database is simply a file...so, the first setup you provided works fine.
The setup you provided would have worked fine on MySQL, for example, since there's a database server running on 3306 port. Since SQLite isn't a client/server database, but a local file, the only viable option is pointing to its physical file.
In case this second setup is supposed to be running on your application server, you just have to create the SQLite physical file and point the connection URL to it, just like you did in first place.
If you really need, for example, to have the database running on another server (different from your application server) you should consider migrating to MySQL/PostgreSQL. Both of them will allow you client/server connection.

Amazon EC2 stops working unexpectedly

I am facing a problem that is burning my brain. I have an amazon ec2 instance that runs Linux AMI, I installed tomcat7 and I am deploying my webservice in it. This webservice connects itself with an amazon RDS instance where I have my mysql (that I use to validate user and password). When I start my tomcat7 service everything works great, after one hour I can't log in into my system.
If i restart the tomcat7 service, everything works again. But why?
I really don't know where is the problem. I can connect to my database directly from my project in eclipse, and via command line.
I don't know why if I restart the service, my webservice works again. I know that the service hasn't stoped, because I can access the login page of my webapp.
I really appreciate any kind of help,
Rodrigo Araujo.
ps: Last week, everything was working just fine.
I've seen such behavior before, it is probably tomcat and not ec2. Check the following:
1- Your threading configuration (maxThreads and acceptCount). I've seen this behavior using the blocking connector when currentThreadsBusy > maxThreads. Check that you have enough threads or use the non-blocking (nio) connector.
2- Check that your connection pool can reconnect lost connections automatically (autoReconnect=true in the jdbc url), your threads might be waiting db io on lost connections.
Anyway, your ec2 instance is probably still working...

Atmosphere framework examples do not work. Any idea?

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.

localhost 4848, 8080 problem

this might sound like a stupid question, but i want to clarify a concept:
using netbeans 6.9, ive successfully completed a web application project using a glassfish container (locally). when i run the project, everything works well, except it runs on http://localhost:11494/myApp/. should'nt the accessing task be on http://localhost:8080/myApp/? when i type http://localhost:8080/myApp/, it doesnt connect to localhost.. neither does http://localhost:4848 to access the admin console. why is this? i think my concepts on deployment are not that thorough. i didn't manually deploy anything.. thanks in advance!
EDIT: right now, the university module im taking has lecture notes which specify manual deployment. id rather let netbeans handle deployment. perhaps this is the cause of the difference in port numbers?
All of your settings are in the domain.xml so you can look in there. However, the port (8262) your showing in your connection tab should be your admin console, so you can view the settings in there as well.
I think port number 8080 is not assigned to your application, you can assign 8080 to listen to your application by making changes into server.xml, file all you need to do is add a connector or modify the connector entry to listen to 8080 instead of 11494...!!
When you run the project, do you launch the server from within Netbeans? If so, I'd check there first. If you run from the command line, it has to be a GlassFish configuration issue.
If I got desperate, I'd grep my machine for "11494"!
Remember, the solution should be as simple as possible, but no simpler! ;-)
I think port 8080 is occupied by another process, therefore Glassfish decide to use another port..

Categories

Resources