Reputation: 5729
Our EJB3 application can run on top of Oracle AS or JBoss AS. Is there a way to find out type of AS during runtime?
Upvotes: 4
Views: 3995
Reputation: 121599
Another way is to check for an app-server specific value in System properties.
// EXAMPLE:
if (System.getProperty("catalina.base") != null) {
// Using Tomcat
...
else if (System.getProperty("jboss.server.name") != null) {
// Using JBoss
...
else if (System.getProperty("was.install.root") != null) {
// Using WebSphere
...
Upvotes: 2
Reputation: 38605
You can check the concrete type of object at runtime using reflection, e.g. the EJBContext
that is injected by the app. server.
Upvotes: 1