Cannot connect to jetty 9 - jetty-9

Why can I not successfully connect to jetty?
I have the latest version of jetty 9.x running. I have the jetty_base folder setup and when I drop war files into the folder I see them get expanded into the /tmp folder.
lsof -i :8080
java 26488 jetty 85u IPv6 400595 0t0 TCPlocalhost.localdomain:webcache (LISTEN)
curl 'http://localhost:8080' curl: (7) Failed connect to
localhost:8080; Connection refused
curl http://127.0.0.1:8080 curl: (7) Failed connect to 127.0.0.1:8080;
Connection refused

From the below output of lsof -i:8080
java 26488 jetty 85u IPv6 400595 0t0
TCPlocalhost.localdomain:webcache (LISTEN)
It seems jetty is using ipv6 rather ipv4.
For ipv6, use ::1 as your loopback address. For ipv4, it is 127.0.0.1.
Changes you can make for localhost to work :
If you wish to set localhost to work for both ipv6 and ipv4 you can make below changes to /etc/hosts file.
127.0.0.1 localhost
# ... and below
::1 localhost ipv6-localhost ipv6-loopback
As always, you can test the connectivity using ping6 ::1 for an ipv6 ip and ping 127.0.0.1 for ipv4.
Give a try!

Related

What port does elasticsearch listen on when installed via homebrew?

I'm using Mac 10.13.6. I just installed elasticsearch via homebrew and launched it ...
brew services start elasticsearch
Service `elasticsearch` already started, use `brew services restart elasticsearch` to restart.
In my /usr/local/etc/elasticsearch/elasticsearch.yml configuration file, I have
http.port: 9200
However, when I attempt to see if that port is available, I get a connection refused ...
localhost:tmp davea$ telnet localhost 9200
Trying ::1...
telnet: connect to address ::1: Connection refused
Trying 127.0.0.1...
telnet: connect to address 127.0.0.1: Connection refused
telnet: Unable to connect to remote host
What port is elasticsearch getting launched on and how can I change that?
That may be the problem of Mac firewall? Edit elasticsearch.yml file in elasticsearch/config folder. Change the localhost to 127.0.0.1 to take a try?
network.host: 127.0.0.1
#
# Set a custom port for HTTP:
#
http.port: 9200
#

What localhost exactly domains name resolution to ip?

My timing database influx sets the listening port 8088 to address 127.0.0.1, and the spring boot listens to the same port 8088 to any addresses, as shown below.
~ lsof -nP -i:8088
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
influxd 420 zyx 3u IPv4 0xf4af94bc970b15e9 0t0 TCP 127.0.0.1:8088 (LISTEN)
java 34029 zyx 171u IPv6 0xf4af94bc9a0d12e9 0t0 TCP *:8088 (LISTEN)
When I try to access spring boot restful using url localhost:8088/api, I get the right result. But when I use url 127.0.0.1:8088/api, I get error java.net.SocketException: Connection reset.I guess it is caused by mapping to influd instead of spring boot.
But why localhost can get the right result? As far as I konw, localhost will resolve to 127.0.0.1.
I run my program on Mac 2019.
~ nslookup localhost
Server: 192.168.15.1
Address: 192.168.15.1#53
Name: localhost.cluster.peidan.me
Address: 127.0.0.1

Curl Localhost Issue in Mac Terminal

I'm getting the error
curl: (7) Failed to connect to localhost port 80: Connection refused
when I execute the command
curl localhost
in Mac terminal.
My /etc/hosts file content
127.0.0.1 localhost
255.255.255.255 broadcasthost
::1 localhost
How can I fix this?
Start a webserver that listens on port 80.

MAC, MAMP, 127.0.0.1 connection refused, localhost fine

As title says, I can access localhost fine but my app needs a callback from twitter through 127.0.0.1:8000 and 127.0.0.1:8000 is getting "connection refused"
EDIT: This looks to be an IPv6 conflict, I can access my local server through (Apache Port) http://127.0.0.1:8888/
EDITEDIT: It appears if I serve an angular app on port 9000 I can reach it with 127.0.0.1:9000 in my browser fine, however if I run php artisan serve --port=9000 then then I still get a connection refused error.
So my issue has been refined to: How can I get php artisan serve (for laravel app) to work with http://127.0.0.1:8000/
Lewiss-MBP:stripe2 Lewis$ php artisan serve
Laravel development server started on http://localhost:8000/
The meat:
OSX YOSOMITE 10.10.5
MAMP (non pro) is set to Apache not NGINX
etc/hosts : file -b /etc/hosts === ASCII English text
127.0.0.1 localhost
255.255.255.255 broadcasthost
::1 localhost
Lewiss-MBP:applications Lewis$ telnet -6 ::1 8000 </dev/null
Trying ::1...
Connected to localhost.
Escape character is '^]'.
Connection closed by foreign host.
Lewiss-MBP:applications Lewis$ telnet -4 127.0.0.1 8000 </dev/null
Trying 127.0.0.1...
telnet: connect to address 127.0.0.1: Connection refused
telnet: Unable to connect to remote host
l;dr; SOLVED : after a LOT of trawling, if I run php artisan serve --host 0.0.0.0 my app works fine, as does twitter app callbacks to 127.0.0.1
The issue must be in how Artisan listens..

Unable to telnet on ec2 even when HTTPS /port 443 is open

Settings of my security group on EC2
TCP
Port(Service) Source Action
22 (SSH) 0.0.0.0/0 Delete
80 (HTTP) 0.0.0.0/0 Delete
443 (HTTPS) 0.0.0.0/0 Delete
Output: When I run the telnet
JP$ telnet passionate4.net
Trying 50.18.159.124...
telnet: connect to address 50.18.159.124: Operation timed out
telnet: Unable to connect to remote host
on ubuntu ec2 server
ubuntu#ip-10-166-185-18:~$ sudo netstat -nup -l
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
udp 0 0 0.0.0.0:68 0.0.0.0:* 400/dhclient3
Telnet uses port 23, you don't have it in your security group.
type this:
JP$ telnet passionat4.net 80
80, 443, 3389, or whatever port you're testing for.
Windows example:
C:/> telnet www.google.com 80

Resources