Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/jpa/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Websphere 我们有没有办法在代码中找出部署EAR的环境?_Websphere_Restlet - Fatal编程技术网

Websphere 我们有没有办法在代码中找出部署EAR的环境?

Websphere 我们有没有办法在代码中找出部署EAR的环境?,websphere,restlet,Websphere,Restlet,我在restlet项目中面临一个问题,只有当EAR部署在Websphere的restlet服务器项目中时,我才能编写一些操作。我们是否有办法通过代码获取信息,以确定EAR/WAR部署在何处?(EAR是否部署在Websphere、Tomcat或其他服务器中)。尝试实例化一些Websphere API类。如果您找到一个NoClassDefFound,它可能没有在WebSphere上运行。您可能必须执行class.forName(Websphere类),这样您的代码将在Websphere外部编译。如果

我在restlet项目中面临一个问题,只有当EAR部署在Websphere的restlet服务器项目中时,我才能编写一些操作。我们是否有办法通过代码获取信息,以确定EAR/WAR部署在何处?(EAR是否部署在Websphere、Tomcat或其他服务器中)。

尝试实例化一些Websphere API类。如果您找到一个NoClassDefFound,它可能没有在WebSphere上运行。您可能必须执行class.forName(Websphere类),这样您的代码将在Websphere外部编译。

如果您只需要检查,例如在Servlet/Filter类中,您可以查找与Websphere相关的Servlet上下文属性,例如
com.ibm.Websphere.Servlet.application.name=默认Web应用程序
。如果安装了looi=king,可以在
/snoop
servlet中找到一些属性

或者,正如Bruce所建议的,尝试加载一些WebSphere类,并在它们不存在时准备好错误