WebSphere Application Server中发布的程序中调用System.exit()

如将java EE应用程序发布到was appserver中,如果这些代码中有调用System.exit(),会停掉JVM,那么会导致appserver失效,就是这个应用服务器停止服务。

 

按照IBM网站的说法是

When System.exit() (http://java.sun.com/j2se/1.4.2/docs/api/java/lang/System.html#exit(int)) is called by any code, it terminates the currently running Java™ Virtual Machine. An unexpected call to System.exit() by any code would lead to Java processes vanishing and the appserver will fail.

 

如果这个appserver是集群中的一个节点,那么这个节点会掉。再发布或者卸载应用的时候都会很慢,这时候,需要重新启动节点所在机器。重新启动或者卸载应用。

 

如果想应用服务器在执行这些代码后有日志记录是哪些代码调用了System.exit(),可以

以下是从IBM抓来的一段

To find out which part of the application or server code has called System.exit(), enable the following trace in the appserver. This trace will generate a javacore whenever some code calls System.exit().

Note that a restart of the server is needed after enabling the traces. To enable this trace add the following in the Generic JVM arguments

 

  • For IBM® WebSphere® Application Server V6.1 and 7.0:

    -Xtrace:trigger={method{java/lang/System.exit,javadump}}

  • For IBM® WebSphere® Application Server V6.0 and earlier: -Dibm.dg.trc.trigger=method(java/lang/System.exit,javadump)

你可能感兴趣的:(java,jvm,应用服务器,IBM,websphere)