title: Systemd Service for jar file gets "operation timed out" error after few minues or stay in "activating mode"
body: <p>the service unit is:</p>
  
  <pre><code>[Unit]
  Description=test
  After=syslog.target
  After=network.target
  
  [Service]
  Type=forking
  ExecStart=/bin/java -jar /home/ec2-user/test.jar
  TimeoutSec=300
  
  [Install]
  WantedBy=multi-user.target
  </code></pre>
  
  <p>it starts fine for 1-4 minues. But later it fails:</p>
  
  <p>tail  /var/log/messages:</p>
  
  <pre><code>Feb 27 18:43:44 ip-172-31-40-48 systemd: Reloading.
  Feb 27 18:44:06 ip-172-31-40-48 systemd: Starting test...
  Feb 27 18:44:06 ip-172-31-40-48 java: 5.1.73
  Feb 27 18:44:06 ip-172-31-40-48 java: Starting the internal [HTTP/1.1] server on port 8182
  Feb 27 18:49:06 ip-172-31-40-48 systemd: test.service operation timed out.Terminating.
  Feb 27 18:49:06 ip-172-31-40-48 systemd: test.service: control process exited, code=exited status=143
  Feb 27 18:49:06 ip-172-31-40-48 systemd: Failed to start test.
  Feb 27 18:49:06 ip-172-31-40-48 systemd: Unit test.service entered failed state.
  </code></pre>
  
  <p>systemctl status test.service (while restarting- stays in activating mode):</p>
  
  <pre><code>test.service - Setsnew
  Loaded: loaded (/etc/systemd/system/test.service; enabled)
  Active: activating (start) since Sun 2015-03-01 14:29:36 EST; 2min 30s ago
  Control: 32462 (java)
  CGroup: /system.slice/test.service
  </code></pre>
  
  <p>systemctl status test.service (after fail):</p>
  
  <pre><code>test.service - test
  Loaded: loaded (/etc/systemd/system/test.service; enabled)
  Active: failed (Result: exit-code) since Fri 2015-02-27 18:49:06 EST; 18min ago
  Process: 27954 ExecStart=/bin/java -jar /home/ec2-user/test.jar (code=exited, status=143)
  </code></pre>
  
  <ul>
  <li>when running the jar in command line it works just fine.  </li>
  <li>tried changing the jar location because I thought it's a permissions problem</li>
  <li>selinux is off</li>
  </ul>
  
  <p>How can i fix this issue so I could start the jar on boot? there any alternatives? (RHEL7 do not include service command)</p>