简体   繁体   English

如何使用Eclipse停止Wildfly 8.2.1最终服务器上的应用程序-Java

[英]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, 所以这是我的棘手方法

  1. Throw Run times error in your test or 测试中的“运行时错误”或
  2. I think you write Java EE application. 我认为您编写Java EE应用程序。 So make your login session invalidate or logout 因此,使您的登录会话无效或注销

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何在 Wildfly-8.2.1.Final 上设置域名(或主机名) - How to set domain name (or host name) on Wildfly-8.2.1.Final 启动Wildfly 8.2.1服务器时出错 - Error starting Wildfly 8.2.1 server 如何检查Wildfly 8.2.1是否以编程方式正确部署了我的应用程序? - How to check if my Application was correctly deployed by Wildfly 8.2.1 programmatically? 如何防止应用程序日志在Wildfly 8.2.0 Final AS中的server.log中登录 - How to prevent application logs getting logged in server.log in Wildfly 8.2.0 Final AS 如何停止从 Eclipse 执行的 Java 应用程序 - How to stop Java application executed from Eclipse 是否可以使用 WildFly 在 Java 应用程序中运行 gRPC 服务器? - Is it possible to run a gRPC server in a Java application using WildFly? 如何将Java Web应用程序部署到远程Wildfly服务器? - How to deploy the java web-application to a remote wildfly server? 如何在不同 java 版本的 Wildfly 服务器上运行两个 web 应用程序? - How to run two web application on wildfly server with different java version? 将Grails(2.2.4)应用程序从JBoss 5.1迁移到Wildfly 8.2.1 - Migrating Grails (2.2.4) application from JBoss 5.1 to Wildfly 8.2.1 将 java 代理添加到 wildfly10.1.Final 服务器 - adding a java agent to wildfly10.1.Final server
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM