Guys, https://github.com/apache/tomee/pull/111
I've created this PR to kill the JVM on any deployment failure. I need to get an error code from TomEE so docker knows the server died due to some application error. This way, it will know it needs to start a new container and try it again until the application is successfully deployed. Do we have something like this already implemented? If yes, how to use it? If no, do you guys agree with this approach, or do you think theres a better way to get a system error? If you guys agree with the approach, do you have any tip on how to unit test this? It looks like we can do it with junit ( https://stackoverflow.com/questions/309396/java-how-to-test-methods-that-call-system-exit), but I would like to know if you guys can see any clever way to test it without too much bytecode trickery. Example of output with this PR... 09-Nov-2017 02:38:39.532 INFO [main] org.apache.openejb.config.AutoConfig.createContainer Auto-creating a container for bean servlets.Comp1358857082: Container(type=MANAGED, id=Default Managed Container) 09-Nov-2017 02:38:39.591 INFO [main] org.apache.openejb.config.OutputGeneratedDescriptors.writeEjbJar Dumping Generated ejb-jar.xml to: /opt/tomee/temp/ejb-jar-4480173124784608261ejbs.xml 09-Nov-2017 02:38:39.842 INFO [main] org.apache.openejb.config.OutputGeneratedDescriptors.writeOpenejbJar Dumping Generated openejb-jar.xml to: /opt/tomee/temp/openejb-jar-1229834934073978679ejbs.xml 09-Nov-2017 02:38:39.888 SEVERE [main] org.apache.openejb.config.ReportValidationResults.logResults FAIL ... Hello: Missing class <home> com.lala.support.demo.ear.ejb2.hello.HelloHomeeeee 09-Nov-2017 02:38:39.889 SEVERE [main] org.apache.openejb.config.ReportValidationResults.logResults Invalid EjbModule(name=ejbs, path=/opt/tomee/apps/app/ejbs.jar) 09-Nov-2017 02:38:39.892 INFO [main] org.apache.openejb.config.ReportValidationResults.deploy Set the 'openejb.validation.output.level' system property to VERBOSE for increased validation details. 09-Nov-2017 02:38:39.893 WARNING [main] org.apache.openejb.config.ConfigurationFactory.configureApplication Jar not loaded. /opt/tomee/apps/app.ear. Module failed validation. AppModule(name=app) 09-Nov-2017 02:38:39.893 WARNING [main] org.apache.openejb.config.ConfigurationFactory.getOpenEjbConfiguration System property tomee.kill.jvm.on.deployment.failure activated. We will kill the JVM due to deployment failure. laplata:demo-tomee-ear tveronezi$ []s, Thiago.
