The shutdown script is located under target\cargo\installs\apache-tomcat-6.0-latest\apache-tomcat-6.0.37\bin. Your version of tomcat may differ. If you run it, you get the exception "java.net.ConnectException: Connection refused: connect". It seems to me that the shutdown port is disabled in the cargo profile.\\
The shutdown script is located under target\cargo\installs\apache-tomcat-6.0-latest\apache-tomcat-6.0.37\bin. Your version of tomcat may differ. If you run it, you get the exception "java.net.ConnectException: Connection refused: connect". It seems to me that the shutdown port is disabled in the cargo profile.
Kind regards,
Robert de Vries
On Mon, Jan 13, 2014 at 2:18 PM, Robert de Vries <Robert....@hinttech.com> wrote:
The shutdown script is located under target\cargo\installs\apache-tomcat-6.0-latest\apache-tomcat-6.0.37\bin. Your version of tomcat may differ. If you run it, you get the exception "java.net.ConnectException: Connection refused: connect". It seems to me that the shutdown port is disabled in the cargo profile.
I think it is here: you can telnet 8009 which is the default Tomcat AJP port (we could even send the signal like that if it was a text protocol).
Oh I see. Then I don’t know how to activate this with Cargo, but for sure the port is not opened on my machine.
Anyway I thought of another way to do it: use the JMX management beans of Tomcat. Just add this to the Cargo profile:
<systemProperties>
<java.rmi.server.hostname>127.0.0.1</java.rmi.server.hostname>
<com.sun.management.jmxremote.port>8888</com.sun.management.jmxremote.port>
<com.sun.management.jmxremote.ssl>false</com.sun.management.jmxremote.ssl>
<com.sun.management.jmxremote.authenticate>false</com.sun.management.jmxremote.authenticate>
</systemProperties>
I tried with the jconsole and it worked fine: if you call stop() on the Server bean the .lock file disappears. There’s just one catch: you still have to hit CTRL-C :)
This Groovy script will stop the server without leaving a .lock file:
import javax.management.remote.JMXConnectorFactory as JmxFactory
import javax.management.remote.JMXServiceURL as JmxUrl
def serverUrl = 'service:jmx:rmi:///jndi/rmi://localhost:8888/jmxrmi'
def server = JmxFactory.connect(new JmxUrl(serverUrl)).MBeanServerConnection
def serverInfo = new GroovyMBean(server, 'Catalina:type=Server').serverInfo
println "Connected to: $serverInfo"
def engine = new GroovyMBean(server, 'Catalina:type=Engine')
println "Stopping Tomcat..." + engine.stop()
And I don’t have the warning anymore. Now I just need to find a way to stop the Cargo script as well.