Given that Jconsole can connect to the Tomcat JMX without any user credentials (locally), i am guessing that i dont need to supply these credentials but how do i connect to the JMX server without supplying the port number? (by specifying the port number it means i am allowing remote authentication meaning i have to provide the login credentials).
On Thu, Jan 13, 2011 at 4:06 PM, Pid <[email protected]> wrote: > On 1/13/11 3:15 PM, Ziggy wrote: > > Aha... i didnt realise that i needed to supply the credentials from the > > client. I thought Tomcat would get those from the password files. Ok im > off > > to the documentation now. :) > > It could do, but you'd have to point the client at those files and read > their contents too. > > > > >>> try { > >>> url = new > >>> JMXServiceURL("service:jmx:rmi:///jndi/rmi://localhost:18070/jmxrmi"); > >>> jmxc = JMXConnectorFactory.connect(url,null); > > Map<String, Object> environment = new HashMap<String, Object>(); > String[] pair = new String[] { "username", "password" }; > environment.put(JMXConnector.CREDENTIALS, pair); > > jmxc = JMXConnectorFactory.connect(url, environment); > > > From my own efforts: > > https://github.com/pidster/Tomcat-CLI > > > p > > > > >>> mbsc = jmxc.getMBeanServerConnection(); > >>> } catch (MalformedURLException e) { > >>> throw new Exception(methodName + ":" + e); > >>> } catch (IOException e) { > >>> throw new Exception(methodName + ":" + "Failed to > >>> connect to the Tomcat Server " + e); > >>> } >
