Error connecting to Apache Tomcat instance.Please check that a Tomcat server is running at given location and port

Dears we have up and running two windows/IIS servers with Lucee on a load balancer. Suddenly we get this error: " Error connecting to Apache Tomcat instance.Please check that a Tomcat server is running at given location and port.
No connection could be made because the target machine actively refused it
You can change this message by changing TomcatConnectErrorURL setting in setting file."
First on one server and after 1o minutes on the other server.
Any help will be appreciated

an active refusal means that the tomcat instance is running but not accepting AJP connections.

Are both Tomcat servers running when you see this error?
What happens when you access them individually by directly logging in to them?

If everything looks look please see whether you can get a little more info:
Windows version?
Lucee version?
Tomcat ?
How installed?
Connector version?
What load balance mechanism are you using?


Dear Bilal thank for your response.
The problem is appearing as far as we know from user inputs in both servers but it happens occasionally. That’s the main problem. We can’t isolate it. We are in Lucee on Windows server 2016, Servlet Container Apache Tomcat/8.5.35, BonCode Apache Tomcat AJP 1.3 Connector
We use the native windows server load balancer

I believe this is the problem I’m having. I can navigate to the site using the CommandBox derived port but if I try to access the localhost, I get AJP error but unclear how to resolve it. Any tips or should I start my own thread?

Would you post or screen shot the error you are getting?

You’ve said, you’re running Lucee on CommandBox? With CommandBox there is no Tomcat instance envolved. What runs the Lucee-cfml-servlet in CommandBox is it’s inbuilt servlet engine named “Undertow”. When running Lucee with CommandBox, Undertows AJP is disabled by default. So here are my questions:

  • Did you enable AJP in your server.json?

  • How did you install Boncode? Standalone with the Boncode-Installer?

  • How does your Boncode settings look like? If you post your settings and you have “secrets” in it, please mask the settings.

1 Like

Agree with all Andreas’ suggestions. Also, this screencast will help you setup Boncode with CommandBox.


This screencast in addition to the blog post: helped me resolve my issues. Unfortunately I cannot specifically state what the actual fix was but when I started over using the screen cast and the blog post, it all worked so I assume I must have typo’d something along the way.