title: Enabling Flight Recorder in Tomcat causes "Error when initializing JFR"
body: <p>adding <code>-XX:+FlightRecorder</code> to my CATALINA_OPTS causes this error in my catalina.out log:</p>
  
  <pre><code>Error when initializing JFR. JFR will be deactivated.
  
  java.lang.Exception: Unable to create JFR repository directory using base location (/var/cache/tomcat6/temp).
          at oracle.jrockit.jfr.Repository.create(Repository.java:62)
          at oracle.jrockit.jfr.Repository.&lt;init&gt;(Repository.java:26)
          at oracle.jrockit.jfr.JFRImpl.&lt;init&gt;(JFRImpl.java:108)
          at oracle.jrockit.jfr.VMJFR.&lt;init&gt;(VMJFR.java:55)
          at oracle.jrockit.jfr.VMJFR.create(VMJFR.java:393)
          at oracle.jrockit.jfr.JFR.init(JFR.java:91)
  Error occurred during initialization of VM
  Failed to start tracing backend.
  </code></pre>
  
  <p>Here are the full CATALINA_OPTS from <code>/usr/share/tomcat8/bin/setenv.sh</code>:</p>
  
  <pre><code>export CATALINA_OPTS="-Dcom.sun.management.jmxremote=true \
                -Dcom.sun.management.jmxremote.port=9090 \
                -Dcom.sun.management.jmxremote.ssl=false \
                -Dcom.sun.management.jmxremote.authenticate=false \
                -Djava.rmi.server.hostname=10.202.210.173 \
                -XX:+UnlockCommercialFeatures -XX:+FlightRecorder"
  </code></pre>
  
  <p>If I only enable the <code>-XX:+UnlockCommercialFeatures</code> parameter the tomcat instance does not crash, as soon as I enable FlightRecorder though, it crashes. I've tried it with JAVA_OPTS also and I get the same result. </p>
  
  <p>I am just following tutorials on the internet to get Flight Recorder enabled for Tomcat, so I don't really have an idea of what I can be doing wrong. Everything looks right to me. </p>
  
  <p>This is on a 64 bit CentOS 6.4 box, with Tomcat 8. </p>