Our J2EE Application is deployed to JBoss and sometimes to OC4J .
Can I know which one is being used?
I hope there is a method returning the container information on runt
Most likely JMX is what you are going to need to use. Both containers likely expose details about themselves as MBeans. Here is some Oracle documentation on JMX and JBoss documentation.