简体   繁体   English

如何测试JBoss服务器是从外部Java应用程序启动的

[英]How to test JBoss server is started from external java application

how can i test from external java application that my server jboss is running ? 我如何从外部Java应用程序测试我的服务器jboss是否正在运行?

I've a JBoss (4.2.3) server and I want know from a stand-alone java application if that server i started or not. 我有一台JBoss(4.2.3)服务器,我想从一个独立的Java应用程序中了解我是否启动了该服务器。

Thanks! 谢谢!

EDIT 编辑

I don't have access to the jboss machine and the jmx console is disabled for safety reasons. 我无权访问jboss机器,出于安全原因禁用了jmx控制台。

You can check inspecting the running processes if you have access to the machine where jboss is running. 如果可以访问运行jboss的计算机,则可以检查正在运行的进程。

If you don't have access to the machine, then you'll have to try to connect to it, checking if it's listening to the http port or if you can reach it via JMX, but then you can't be sure if it's really not running or if some firewall rule is blocking your request. 如果您无法访问该计算机,则必须尝试连接到该计算机,检查它是否正在侦听http端口,或者是否可以通过JMX到达它,但是您无法确定它是否在确实没有运行,或者某些防火墙规则阻止了您的请求。

One of the possible solution if you are running on linux is to execute a shell command like 如果您在Linux上运行,则可能的解决方案之一是执行如下shell命令:

 ps -ef | grep jboss >> somelog.txt

execute it using Runtime class using exec() method in Runtime and check the output of that command from your java program 使用运行时类中的exec()方法使用运行时类执行它,并从Java程序检查该命令的输出

Surely there might be some other better alternative , but this is just a simple thought 当然,可能还有其他更好的选择,但这只是一个简单的想法。

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM