JMX传输&网络逻辑
您曾经使用过 JMXTrans 来监控您的 weblogic 服务器吗?
使用以下配置:
{
"servers" : [ {
"host": "a-pfg-admin.fr.net.intra",
"port":9091,
"url": "service:jmx:iiop://a-pfg-admin.fr.net.intra:9091/jndi/weblogic.management.mbeanservers.runtime",
"username": "weblogic",
"password": "****",
"queries" : [ {
"outputWriters" : [ {
"@class" : "com.googlecode.jmxtrans.model.output.KeyOutWriter",
"settings" : {
"outputFile" : "/tmp/jmxtrans1.txt",
"maxLogFileSize" : "10MB",
"maxLogBackupFiles" : 200,
"debug" : true,
"typeNames" : ["name"]
}
} ],
"obj" : "java.lang:type=Memory",
"resultAlias": "heap",
"attr" : [ "HeapMemoryUsage", "NonHeapMemoryUsage" ]
}
]
} ]
}
我得到:
[28 Oct 2011 16:39:54] [ServerScheduler_Worker-8] 1020012 ERROR (com.googlecode.jmxtrans.jobs.ServerJob:39) - Error
java.io.IOException: Failed to retrieve RMIServer stub: javax.naming.NoInitialContextException: Need to specify class name in environment or system property, or as an applet parameter, or in an application resource file: java.naming.factory.initial
at javax.management.remote.rmi.RMIConnector.connect(RMIConnector.java:338)
at javax.management.remote.JMXConnectorFactory.connect(JMXConnectorFactory.java:248)
at com.googlecode.jmxtrans.util.JmxUtils.getServerConnection(JmxUtils.java:413)
at com.googlecode.jmxtrans.util.JmxConnectionFactory.makeObject(JmxConnectionFactory.java:30)
at org.apache.commons.pool.impl.GenericKeyedObjectPool.borrowObject(GenericKeyedObjectPool.java:1212)
at com.googlecode.jmxtrans.jobs.ServerJob.execute(ServerJob.java:36)
at org.quartz.core.JobRunShell.run(JobRunShell.java:216)
at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:549)
Caused by: javax.naming.NoInitialContextException: Need to specify class name in environment or system property, or as an applet parameter, or in an application resource file: java.naming.factory.initial
at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:645)
at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:288)
at javax.naming.InitialContext.getURLOrDefaultInitCtx(InitialContext.java:325)
at javax.naming.InitialContext.lookup(InitialContext.java:392)
at javax.management.remote.rmi.RMIConnector.findRMIServerJNDI(RMIConnector.java:1886)
at javax.management.remote.rmi.RMIConnector.findRMIServer(RMIConnector.java:1856)
at javax.management.remote.rmi.RMIConnector.connect(RMIConnector.java:257)
即使我放入 /etc/init.d/jmxtrans.sh
WL_HOME="/apps/WebLogic/10.3.2/AppServer"
JMXTRANS_OPTS="-Djava.class.path=${JAVA_HOME}\lib\tools.jar;${WL_HOME}/server/lib/wlfullclient.jar -Djmx.remote.protocol.provider.pkgs=weblogic.management.remote"
export JMXTRANS_OPTS;
Have you ever used JMXTrans to monitor your weblogic server?
with the following config:
{
"servers" : [ {
"host": "a-pfg-admin.fr.net.intra",
"port":9091,
"url": "service:jmx:iiop://a-pfg-admin.fr.net.intra:9091/jndi/weblogic.management.mbeanservers.runtime",
"username": "weblogic",
"password": "****",
"queries" : [ {
"outputWriters" : [ {
"@class" : "com.googlecode.jmxtrans.model.output.KeyOutWriter",
"settings" : {
"outputFile" : "/tmp/jmxtrans1.txt",
"maxLogFileSize" : "10MB",
"maxLogBackupFiles" : 200,
"debug" : true,
"typeNames" : ["name"]
}
} ],
"obj" : "java.lang:type=Memory",
"resultAlias": "heap",
"attr" : [ "HeapMemoryUsage", "NonHeapMemoryUsage" ]
}
]
} ]
}
I got:
[28 Oct 2011 16:39:54] [ServerScheduler_Worker-8] 1020012 ERROR (com.googlecode.jmxtrans.jobs.ServerJob:39) - Error
java.io.IOException: Failed to retrieve RMIServer stub: javax.naming.NoInitialContextException: Need to specify class name in environment or system property, or as an applet parameter, or in an application resource file: java.naming.factory.initial
at javax.management.remote.rmi.RMIConnector.connect(RMIConnector.java:338)
at javax.management.remote.JMXConnectorFactory.connect(JMXConnectorFactory.java:248)
at com.googlecode.jmxtrans.util.JmxUtils.getServerConnection(JmxUtils.java:413)
at com.googlecode.jmxtrans.util.JmxConnectionFactory.makeObject(JmxConnectionFactory.java:30)
at org.apache.commons.pool.impl.GenericKeyedObjectPool.borrowObject(GenericKeyedObjectPool.java:1212)
at com.googlecode.jmxtrans.jobs.ServerJob.execute(ServerJob.java:36)
at org.quartz.core.JobRunShell.run(JobRunShell.java:216)
at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:549)
Caused by: javax.naming.NoInitialContextException: Need to specify class name in environment or system property, or as an applet parameter, or in an application resource file: java.naming.factory.initial
at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:645)
at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:288)
at javax.naming.InitialContext.getURLOrDefaultInitCtx(InitialContext.java:325)
at javax.naming.InitialContext.lookup(InitialContext.java:392)
at javax.management.remote.rmi.RMIConnector.findRMIServerJNDI(RMIConnector.java:1886)
at javax.management.remote.rmi.RMIConnector.findRMIServer(RMIConnector.java:1856)
at javax.management.remote.rmi.RMIConnector.connect(RMIConnector.java:257)
Even if i put in /etc/init.d/jmxtrans.sh
WL_HOME="/apps/WebLogic/10.3.2/AppServer"
JMXTRANS_OPTS="-Djava.class.path=${JAVA_HOME}\lib\tools.jar;${WL_HOME}/server/lib/wlfullclient.jar -Djmx.remote.protocol.provider.pkgs=weblogic.management.remote"
export JMXTRANS_OPTS;
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
不幸的是,在服务器对象上设置 url 没有效果。这可能是可以/应该对代码进行的增强。
我不确定你为什么要搞乱类路径,但这也可能是你问题的一部分。
你使用什么JDK?
抱歉,我没有任何 weblogic 经验。
(我是jmxtrans的作者)
Unfortunately, setting a url on a Server object has no effect. This is probably an enhancement that could/should be made to the code.
I'm not sure why you are messing with the classpath, but that could also be part of your issue.
What JDK are you using?
Sorry, I don't have any experience with weblogic.
(I'm the author of jmxtrans)
从错误来看,它看起来像是在 weblogic 中寻找 java.naming.factory.initial 环境属性。
我从 weblogic 网站收到此说明 - 试试这个
属性 java.naming.factory.initial 用于指定如何创建 InitialContext。要使用 WebLogic JNDI,必须始终将 java.naming.factory.initial 属性设置为 weblogic.jndi.WLInitialContextFactory。
From error it looks like its looking for java.naming.factory.initial environment property in weblogic.
I got this note from weblogic site - try this out
The property java.naming.factory.initial is used to specify how the InitialContext is created. To use WebLogic JNDI, you must always set the java.naming.factory.initial property to weblogic.jndi.WLInitialContextFactory.