2011-10-28 61 views
0

您是否曾經使用JMXTrans監控您的weblogic服務器?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; 
+0

爲什麼你的目錄有「/」和「\」?如果您處於UNIX環境中,$ {JAVA_HOME} \ lib \ tools.jar應該是$ {JAVA_HOME} /lib/tools.jar –

回答

0

不幸的是,在服務器對象上設置url沒有任何作用。這可能是/應該對代碼做出的增強。

我不確定你爲什麼搞亂classpath,但這也可能是你的問題的一部分。

您使用的是什麼JDK?

對不起,我沒有任何weblogic的經驗。

(我jmxtrans的作者)

+0

我向您發送一封電子郵件,其中包含一個可用於weblogic的修補程序。實際上,客戶端應該使用特殊設置連接到Weblogic。 我將我的修補程序基於以下文件:http://download.oracle.com/docs/cd/E13222_01/wls/docs90/jmx/accessWLS.html –

0

從錯誤看起來它尋找在weblogic java.naming.factory.initial的環境屬性。

我從weblogic站點得到了這個註釋 - 試試這個 屬性java.naming.factory.initial用來指定InitialContext是如何創建的。要使用WebLogic JNDI,必須始終將java.naming.factory.initial屬性設置爲weblogic.jndi.WLInitialContextFactory。