[英]Configuring Mysql DataSource with IBM WebSphere Application Server Liberty Profile
[英]How can an application tell if its running on IBM WebSphere Application Server or IBM WebSphere Liberty Profile?
我正在使用一個應用程序,需要知道它是在WAS上運行還是在Liberty Profile上運行。
在WAS上,它必須調用Admin API,但在Liberty Profile上它必須使用JNDI來執行相同的操作。
應用程序可以判斷它是否在Liberty上運行的一種方法是搜索以下MBean: WebSphere:name=com.ibm.ws.config.mbeans.FeatureListMBean
以下是Liberty中提供的所有MBean的列表
以下是如何查詢MBean的代碼示例:
private boolean isLiberty() throws Exception {
MBeanServer mbs = ManagementFactory.getPlatformMBeanServer();
ObjectName obn = new ObjectName("WebSphere:name=com.ibm.websphere.config.mbeans.FeatureListMBean");
Set<ObjectInstance> s = mbs.queryMBeans(obn, null);
return s.size() > 0;
}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.