I agree with kbrasee that this is not a good situation to be, so if you could, I would choose it if possible.
However, if you have no choice and need to do this, they do so in the implementation of Liferay. Take a look at the ServerDetector class
In the _dectect method (below), you will notice that they are looking for the class that they defined, is present if it is running on this server. They define classes at the top in the constants TOMCAT_BOOTSTRAP_CLASS and TOMCAT_EMBEDDED_CLASS.
We had a problem finding the built-in tomcat inside the glass fish. I'm not sure if this is fixed in the version I am associated with, but this may not be a problem for you.
source
share