Fix deploy and undeploy to use JMX