此内容没有您所选择的语言版本。

Chapter 17. Example: Remote JNDI Lookups After an Alert (JBoss EAP 5)


Important
This script is intended to be run directly on the server, such as using the -f parameter or through a server-side alert script. This cannot be run using the interactive CLI.
For information on running server-side scripts in response to alerts, see "Using JBoss Operations Network for Monitoring, Deploying, and Managing Resources."
Important
For security reasons, it is not possible to run a local JNDI lookup from an alert CLI script. It is possible to perform a remote JNDI lookup.
The alert system can run a script in response to a fired alert. One possible response for a JBoss AS 5 server is to check the JNDI directory and look up the JMX information.
This script first connects to the remote JNDI directory over JNP, then uses the assertNotNull method to get the JMX object. The script then prints the JMX information.
//This test requires a remote JBoss AS 5 server running with JNDI directory remotely accessible using JNP (without authz)
//This script assumes that there is a bound object called "jmx" in the directory (which it should be)
var jbossHost = 'localhost';
var jbossJnpPort = 1299;

var env = new java.util.Hashtable();
env.put('java.naming.factory.initial', 'org.jboss.naming.NamingContextFactory');
env.put('java.naming.provider.url', "jnp://" + jbossHost + ":" + jbossJnpPort);
var ctx = new javax.naming.InitialContext(env);
var jmx = ctx.lookup('jmx');
assertNotNull(jmx);
pretty.print(jmx);
Copy to Clipboard Toggle word wrap
返回顶部
Red Hat logoGithubredditYoutubeTwitter

学习

尝试、购买和销售

社区

关于红帽文档

通过我们的产品和服务,以及可以信赖的内容,帮助红帽用户创新并实现他们的目标。 了解我们当前的更新.

让开源更具包容性

红帽致力于替换我们的代码、文档和 Web 属性中存在问题的语言。欲了解更多详情,请参阅红帽博客.

關於紅帽

我们提供强化的解决方案,使企业能够更轻松地跨平台和环境(从核心数据中心到网络边缘)工作。

Theme

© 2025 Red Hat