You could try this as a cronjob on machine A, the below checks tomcat is running each hour through the business day (8am - 5pm) and if it's not uses ssh to start it on machineB:
0 9-17 * * * if ! service tomcat status > /dev/null; then ssh machineB service tomcat start; fi
Of course this requires password-less ssh from machineA to machineB to be setup. There should be plenty of threads that discuss how it's done on this forum.