[英]How to stop application on Wildfly 8.2.1 final server using Eclipse - Java
I'm writing unit tests for Java EE beans that run on Wildfly 8.2.1 final, I've been tasked to stop the application in code, after all the tests have been completed. 我正在为在Wildfly 8.2.1 final上运行的Java EE bean编写单元测试,在完成所有测试之后,我的任务是停止代码中的应用程序。 Can someone direct me how to do that, I'm quite new to Java EE and web programming.
有人可以指导我该怎么做,我对Java EE和Web编程还是很陌生。
I've tried using this code: 我尝试使用此代码:
String jbossBinDir = System.getProperty("jboss.server.base.dir").replace("standalone", "bin");
Runtime.getRuntime().exec("sh " + jbossBinDir + "/jboss-cli.sh -c command=shutdown");
But all this seems to do is stop the entire Wildfly server. 但是,所有这些似乎要做的就是停止整个Wildfly服务器。
I think this dzone article gives you something about how to stop programmatically java application. 我认为这篇dzone文章为您提供了一些有关如何以编程方式停止Java应用程序的信息。 I believe you are writing unit test then no need to implements long code.
我相信您正在编写单元测试,那么无需实现长代码。 So here my tricky ways,
所以这是我的棘手方法
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.