The code is as follows:
ConnectionFactory connectionFactory = new ConnectionFactory();
connectionFactory.setHost("192.168.2.135");
connectionFactory.setPort(5672);
connectionFactory.setUsername("admin");
connectionFactory.setPassword("admin");
connectionFactory.setVirtualHost("/");
Connection connection=null;
Channel channel = null;
try {
//2.create linke Connection
connection = connectionFactory.newConnection("Creator");
Error: Java. Net. Connectexception: connection timed out: connect
Cause analysis: first, the IP port account and password are excluded
Error reason: port 5672 is not open. I always thought that everything would be fine as long as the protective wall was closed
Solution:
1. Restart the firewall: systemctl start firewall
2. Open 5672 port: firewall CMD — zone = public — add port = 5672/TCP — permanent
3. Reload: firewall CMD — reload
Run debug:
success!!!
Similar Posts:
- Zabbix-server Error: No route to host [How to Solve]
- Vsftp: 425 FTP connection failed [How to Solve]
- [Solved] CentOS 7.9 Install MySQL Error: 2003- cannot connect to mysql server on ‘10.10.1.202’(10060 “Unknown error”)
- [Solved] Centos7 Error: Failed to start iptables.service: Unit not found
- [Solved] Centos7 Failed to start iptables.service: Unit not found
- Firewall is not running an error is reported when the remote server opens the port
- [Solved] 2003 – cant connect o mysql server on xxx (10060 unknown error)
- Rabbitmq simple configuration and oserror: [errno 9] bad file descriptor problem
- [Solved] CentOS 7.2 Startup Error: Failed to start IPv4 firewall with iptables
- [Solved] MYSQL ERROR 2003 (HY000): can’t connect to MySQL server (10060)