0

So I've got an application I'm going to be building onto but I can't get it working because Tomcat won't start (error message below). I've found the property file where I can adjust the values listed in the error message, but nothing I try works.

Connection Error: Connection refused: connect (Address=127.0.0.1, Port=1412)

broadcast error message CONNECTION Properties: {PORT=1412, USER=Mark, IP=127.0.0.1, AM=ALL, GATEWAY=http://192.168.0.4:80/gateway-web/gatewayService}

reconnecting... 

I've pretty much ruled out another program using the same port, and I've adjusted the user value as well... Is there any way to troubleshoot connecting to localhost? Maybe via the command line?

Any help would be hugely appreciated!

Mark Hill
  • 161
  • 2
  • 9
  • sure that the gateway thing is ok ? – MrSimpleMind Oct 18 '15 at 19:25
  • I don't know much about networking or even servers, so no. The gateway would be my router yes? Could my router be blocking the applications attempts to connect? Probably not relevant, but my computer connects to my router through a switch. – Mark Hill Oct 18 '15 at 19:28
  • try to give just the ip addr (i.e. 192.168.0.4 without any http / port etc) for the gateway, not the entire url. Try also without any gateway property, if possible. I really dont know how your config looks like. but worth to try this... – MrSimpleMind Oct 18 '15 at 19:29
  • Sounds good, i'll give that a try. As for the config file, I've been editing a file called gw.properties which is what is adjusting the values listed in the error message. It has values set for SSL, Pooling Paramters, Port, Host, Password, Username, and maxMessageSize. The "gateway-web/gatewayService" is appended on somewhere else in the program, but i'm sure i'll be able to find it! – Mark Hill Oct 18 '15 at 19:34
  • So I started opening up jar files and found this: String gatewayURL = "http://" + InetAddress.getLocalHost().getHostAddress() + ":80/gateway-web/gatewayService"; ...I can keep burrowing through thousands of class files, but it seems pointless prior to isolating the problem. Do you know of anyway I can open up a connection to the gateway? – Mark Hill Oct 18 '15 at 20:41
  • if `telnet 192.168.0.4 80` responses then the gateway service is alive – MrSimpleMind Oct 18 '15 at 20:46
  • Oh snap! "connect failed" So now I probably just need to reset the router/google gateway problems/tech support 101 sort of thing? – Mark Hill Oct 18 '15 at 20:51

1 Answers1

1

Check your firewall rules, your firewall could still prevent non well-known ports or some form of that.

Have you also verified your app is listening on that port via netstat command on localhost? See here if you don't know how: Command line for looking at specific port

The only other thing I could think of is SELinux (only applies if you are running on Linux) could be doing some mischief here, try turning it off, if it's not already disabled, command would be:

setenforce 0  
Community
  • 1
  • 1
hughjidette
  • 136
  • 7
  • 1
    Please note while disabling SELinux might be viable for development environments, It is a horrible idea to do so in production environments. You should take the time to investigate what's causing SELinux to prevent access, if that's the case. – Markus W Mahlberg Oct 18 '15 at 19:29
  • Yes, agree with @MarkusWMahlberg, only to debug your issue, then work out a proper SELinux rule! – hughjidette Oct 18 '15 at 19:31
  • Actually just switched back to Windows a couple of days ago! The result of netstat -np TCP | find "1413" is: 127.0.0.1:54484 - 127.0.0.1:1412 - SYN_SENT Does that tell us anything? I've already disabled all firewalls. – Mark Hill Oct 18 '15 at 19:39
  • @MarkHill, Looks like 1412 is listening, but it's in SYN_SENT which means it received a SYN and never replied or it was under the impression one was incoming and never arrived, strange! Any kind of antivirus tools running on your Windows machine? – hughjidette Oct 18 '15 at 19:43
  • Nope, it's a fresh install of Windows as of last week. – Mark Hill Oct 18 '15 at 19:53
  • @MarkHill, so port 1412 is used for JMX, do you have any other java applications running which could use JMX besides tomcat? Just to clarify, you mentioned above the issue is you couldn't get tomcat to start, is that still the basic issue? If that's the case, then tomcat needs port 1412 (unless you change it in the config files and it's used by another proc per your netstat command above), if you run netstat -aonp TCP | find "1412" and then add the PID column to Task Manager (View Menu, Select columns, should be on top) and order the results, see what's currently running on 1412 and kill it? – hughjidette Oct 18 '15 at 20:51
  • That's still the issue, and the only other thing I can think of is NetBeans which also has a tomcat server installed. It's not running though, I've checked the task manager. – Mark Hill Oct 18 '15 at 20:55
  • Right, so if you run the exact netstat command I mentioned above: netstat -aonp TCP | find "1412" or maybe netstat -aonp TCP | find "1413", do you get any output which has a number at the very end (that's your PID) and then modify task mgr to show the pid in the processes list. – hughjidette Oct 18 '15 at 20:56
  • It's odd, but i'm actually not getting any results from the prompts now. I'll restart my PC, and see if anything changes. – Mark Hill Oct 18 '15 at 21:03