title: Zabbix JMX Tomcat8 monitoring fails
body: <p>I'm trying to monitor Tomcat8 with JDK8 using JMX.
  I have setup my agents and modified the startup.sh.</p>
  
  <p>On my zabbix_java_gateway.log I get the following exception:</p>
  
  <blockquote>
    <p>WARN  com.zabbix.gateway.SocketProcessor - error processing request
    com.zabbix.gateway.ZabbixException: java.net.SocketTimeoutException:
    connection timed out:
    service:jmx:rmi:///jndi/rmi://server1.example.com:10052/jmxrmi
            at com.zabbix.gateway.JMXItemChecker.getValues(JMXItemChecker.java:97)
    ~[zabbix-java-gateway-2.4.7.jar:na]
            at com.zabbix.gateway.SocketProcessor.run(SocketProcessor.java:63)
    ~[zabbix-java-gateway-2.4.7.jar:na]
            at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    [na:1.8.0_71]
            at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    [na:1.8.0_71]
            at java.lang.Thread.run(Thread.java:745) [na:1.8.0_71] Caused by: java.net.SocketTimeoutException: connection timed out:
    service:jmx:rmi:///jndi/rmi://server1.example.com:10052/jmxrmi
            at com.zabbix.gateway.ZabbixJMXConnectorFactory.connect(ZabbixJMXConnectorFactory.java:123)
    ~[zabbix-java-gateway-2.4.7.jar:na]
            at com.zabbix.gateway.JMXItemChecker.getValues(JMXItemChecker.java:89)
    ~[zabbix-java-gateway-2.4.7.jar:na]
            ... 4 common frames omitted</p>
  </blockquote>
  
  <p>On my <em>startup.sh</em> I added the following to the CATALINA_OPTS</p>
  
  <blockquote>
    <p>-Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.port=10052 -Dcom.sun.management.jmxremote.authenticate=true -Dcom.sun.management.jmxremote.password.file=/opt/tomcat-latest/conf/jmxremote.password
    -Dcom.sun.management.jmxremote.access.file=/opt/tomcat-latest/conf/jmxremote.access
    -Dcom.sun.management.jmxremote.ssl=false -Djava.rmi.server.hostname=server1.example.com</p>
  </blockquote>
  
  <p>My <em>zabbix_agentd.conf</em> contains the following:</p>
  
  <blockquote>
    <p>PidFile=/tmp/zabbix_agentd.pid LogFile=/var/log/zabbix_agentd.log
    LogFileSize=1 DebugLevel=3 Server=monitor.example.com
    Hostname=server1.example.com ListenPort=10050 StartAgents=5 Timeout=30</p>
  </blockquote>
  
  <p>I have already done the following:</p>
  
  <ol>
  <li>successfully connected to the server using jconsole</li>
  <li>remove authentication</li>
  <li>telnet the server over port 10050 / 10052</li>
  </ol>
  
  <p>The weird part is that the same setup works well for Tomcat6 with JDK7.</p>
  
  <h2>EDIT 1</h2>
  
  <p>I've updated the JDK version on the zabbix server to be newer than the JDK installed on my JAVA nodes - still same result - it ends with </p>
  
  <blockquote>
    <p>ZBX_TCP_READ() failed: [4] Interrupted system call</p>
  </blockquote>
  
  <h2>UPDATE</h2>
  
  <p>So I figured it out eventually.
  I had on my tomcat configuration file <code>-Djava.rmi.server.hostname=server1.example.com</code>
  I miss understood that the hostname should be set to the monitoring server and to the monitored server hostname.
  Apparently, there's a bug on Tomcat 6 and this directive does not work.
  Remove it solved the problem completely.</p>
  
  <p>Thanks,</p>
  
  <p>Liron</p>