2012-06-07 58 views
0

我已經安裝了alfresco 4.0d,並試圖設置使用cacti進行監視。我從percona獲得了模板。當我嘗試運行以下命令時出現錯誤。我使用了tomcat/lib目錄下的percona鏈接中提到的jar文件。ant無法檢索RMIServer存根NameNotFoundException jmxrmi

/opt/apache-ant-1.8.1/bin/ant -f jmx-monitor.xml -v -d 

    Apache Ant version 1.8.1 compiled on April 30 2010 
Buildfile: /home/cacti/jmx-monitor.xml 
Adding reference: ant.PropertyHelper 
Detected Java version: 1.6 in: /opt/alfresco-4.0.d/java/jre 
Detected OS: Linux 
Adding reference: ant.ComponentHelper 
Setting ro project property: ant.file -> /home/cacti/jmx-monitor.xml 
Setting ro project property: ant.file.type -> file 
Adding reference: ant.projectHelper 
Adding reference: ant.parsing.context 
Adding reference: ant.targets 
parsing buildfile /home/cacti/jmx-monitor.xml with URI = file:/home/cacti/jmx-monitor.xml 
Setting ro project property: ant.project.name -> JMX Monitor 
Adding reference: JMX Monitor 
Setting ro project property: ant.project.default-target -> status 
Setting ro project property: ant.file.JMX Monitor -> /home/cacti/jmx-monitor.xml 
Setting ro project property: ant.file.type.JMX Monitor -> file 
Project base dir set to: /home/cacti 
+Target: 
+Target: status 
Adding reference: ant.LocalProperties 
parsing buildfile jar:file:/opt/apache-ant-1.8.1/lib/ant.jar!/org/apache/tools/ant/antlib.xml with URI = jar:file:/opt/apache-ant-1.8.1/lib/ant.jar!/org/apache/tools/ant/antlib.xml from a zip file 
Setting project property: jmx.server.name -> hector 
Setting project property: jmx.server.port -> 50500 
Setting ro project property: ant.project.invoked-targets -> status 
Attempting to create object of type org.apache.tools.ant.helper.DefaultExecutor 
Adding reference: ant.executor 
Build sequence for target(s) `status' is [status] 
Complete build sequence is [status, ] 

status: 
parsing buildfile jar:file:/home/cacti/.ant/lib/catalina-ant.jar!/org/apache/catalina/ant/jmx/antlib.xml with URI = jar:file:/home/cacti/.ant/lib/catalina-ant.jar!/org/apache/catalina/ant/jmx/antlib.xml from a zip file 
Class org.apache.catalina.ant.jmx.JMXAccessorTask loaded from parent loader (parentFirst) 
+Datatype antlib:org.apache.catalina.ant.jmx:open org.apache.catalina.ant.jmx.JMXAccessorTask 
Class org.apache.catalina.ant.jmx.JMXAccessorSetTask loaded from parent loader (parentFirst) 
+Datatype antlib:org.apache.catalina.ant.jmx:set org.apache.catalina.ant.jmx.JMXAccessorSetTask 
Class org.apache.catalina.ant.jmx.JMXAccessorGetTask loaded from parent loader (parentFirst) 
+Datatype antlib:org.apache.catalina.ant.jmx:get org.apache.catalina.ant.jmx.JMXAccessorGetTask 
Class org.apache.catalina.ant.jmx.JMXAccessorInvokeTask loaded from parent loader (parentFirst) 
+Datatype antlib:org.apache.catalina.ant.jmx:invoke org.apache.catalina.ant.jmx.JMXAccessorInvokeTask 
Class org.apache.catalina.ant.jmx.JMXAccessorQueryTask loaded from parent loader (parentFirst) 
+Datatype antlib:org.apache.catalina.ant.jmx:query org.apache.catalina.ant.jmx.JMXAccessorQueryTask 
Class org.apache.catalina.ant.jmx.JMXAccessorCreateTask loaded from parent loader (parentFirst) 
+Datatype antlib:org.apache.catalina.ant.jmx:create org.apache.catalina.ant.jmx.JMXAccessorCreateTask 
Class org.apache.catalina.ant.jmx.JMXAccessorUnregisterTask loaded from parent loader (parentFirst) 
+Datatype antlib:org.apache.catalina.ant.jmx:unregister org.apache.catalina.ant.jmx.JMXAccessorUnregisterTask 
Class org.apache.catalina.ant.jmx.JMXAccessorEqualsCondition loaded from parent loader (parentFirst) 
+Datatype antlib:org.apache.catalina.ant.jmx:equals org.apache.catalina.ant.jmx.JMXAccessorEqualsCondition 
Class org.apache.catalina.ant.jmx.JMXAccessorCondition loaded from parent loader (parentFirst) 
+Datatype antlib:org.apache.catalina.ant.jmx:condition org.apache.catalina.ant.jmx.JMXAccessorCondition 

BUILD FAILED 
/home/cacti/jmx-monitor.xml:29: java.io.IOException: Failed to retrieve RMIServer stub: javax.naming.NameNotFoundException: jmxrmi 
    at javax.management.remote.rmi.RMIConnector.connect(RMIConnector.java:338) 
    at javax.management.remote.JMXConnectorFactory.connect(JMXConnectorFactory.java:248) 
    at org.apache.catalina.ant.jmx.JMXAccessorTask.createJMXConnection(JMXAccessorTask.java:385) 
    at org.apache.catalina.ant.jmx.JMXAccessorTask.accessJMXConnection(JMXAccessorTask.java:441) 
    at org.apache.catalina.ant.jmx.JMXAccessorTask.getJMXConnection(JMXAccessorTask.java:479) 
    at org.apache.catalina.ant.jmx.JMXAccessorTask.execute(JMXAccessorTask.java:346) 
    at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:291) 
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) 
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) 
    at java.lang.reflect.Method.invoke(Method.java:597) 
    at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106) 
    at org.apache.tools.ant.Task.perform(Task.java:348) 
    at org.apache.tools.ant.Target.execute(Target.java:390) 
    at org.apache.tools.ant.Target.performTasks(Target.java:411) 
    at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1397) 
    at org.apache.tools.ant.Project.executeTarget(Project.java:1366) 
    at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41) 
    at org.apache.tools.ant.Project.executeTargets(Project.java:1249) 
    at org.apache.tools.ant.Main.runBuild(Main.java:801) 
    at org.apache.tools.ant.Main.startAnt(Main.java:218) 
    at org.apache.tools.ant.launch.Launcher.run(Launcher.java:280) 
    at org.apache.tools.ant.launch.Launcher.main(Launcher.java:109) 
Caused by: javax.naming.NameNotFoundException: jmxrmi 
    at com.sun.jndi.rmi.registry.RegistryContext.lookup(RegistryContext.java:99) 
    at com.sun.jndi.toolkit.url.GenericURLContext.lookup(GenericURLContext.java:185) 
    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) 
    ... 22 more 

Total time: 0 seconds 

JMX-monitor.xml的內容如下

<project name="JMX Monitor" 
     xmlns:jmx="antlib:org.apache.catalina.ant.jmx" 
     default="status" 
     basedir="."> 
    <property name="jmx.server.name" value="hector" /> 
    <property name="jmx.server.port" value="50500" /> 

    <target name="status" description="Show JMX Cluster state"> 
     <jmx:open 
      host="${jmx.server.name}" 
      port="${jmx.server.port}" 
      username="controlRole" 
      password="change_asap"/> 
     <jmx:get 
      name="java.lang:type=Memory" 
      attribute="HeapMemoryUsage" 
      resultproperty="HeapMemoryUsage" 
      /> 
     <jmx:get 
      name="java.lang:type=Memory" 
      attribute="NonHeapMemoryUsage" 
      resultproperty="NonHeapMemoryUsage" 
      /> 
     <jmx:get 
      name="java.lang:type=OperatingSystem" 
      attribute="OpenFileDescriptorCount" 
      resultproperty="OpenFileDescriptorCount" 
      /> 
     <jmx:get 
      name="java.lang:type=OperatingSystem" 
      attribute="MaxFileDescriptorCount" 
      resultproperty="MaxFileDescriptorCount" 
      /> 
      <jmx:get 
        name="Catalina:type=ThreadPool,name=${jmx.catalina.threadpool.name}" 
        attribute="currentThreadsBusy" 
        resultproperty="currentThreadsBusy" 
        /> 
      <jmx:get 
        name="Catalina:type=ThreadPool,name=${jmx.catalina.threadpool.name}" 
        attribute="currentThreadCount" 
        resultproperty="currentThreadCount" 
        /> 
      <jmx:get 
        name="Catalina:type=ThreadPool,name=${jmx.catalina.threadpool.name}" 
        attribute="maxThreads" 
        resultproperty="maxThreads" 
        /> 
    <echo>heap_memory_used: ${HeapMemoryUsage.used} 
heap_memory_committed: ${HeapMemoryUsage.committed} 
heap_memory_max: ${HeapMemoryUsage.max} 
non_heap_memory_used: ${NonHeapMemoryUsage.used} 
non_heap_memory_committed: ${NonHeapMemoryUsage.committed} 
non_heap_memory_max: ${NonHeapMemoryUsage.max} 
open_file_descriptors: ${OpenFileDescriptorCount} 
max_file_descriptors: ${MaxFileDescriptorCount} 
current_threads_busy: ${currentThreadsBusy} 
current_thread_count: ${currentThreadCount} 
max_threads: ${maxThreads} 
</echo> 
    </target> 

</project> 

UPDATE

我可以使用jconsole在Windows 64位一旦我設定所需的值監測的東西。

### RMI service ports ### 
alfresco.rmi.services.port=50500 
monitor.rmi.service.port=50508 
alfresco.rmi.services.external.host=172.16.0.49 

而且在ctl.sh - -Dcom.sun.management.jmxremote=true -Djava.rmi.server.hostname=172.16.0.36

我的仙人掌服務器是172.16.0.15和我的Windows 64位與JConsole的是172.16.0.49和我的露天服務器172.16.0.36。如果我可以用jconsole做到這一點,我如何監控仙人掌?

當我運行ant -e -q -f jmx-monitor.xml我得到以下

BUILD FAILED 
/home/cacti/jmx-monitor.xml:22: Problem: failed to create task or type antlib:org.apache.catalina.ant.jmx:open 
Cause: The name is undefined. 
Action: Check the spelling. 
Action: Check that any custom tasks/types have been declared. 
Action: Check that any <presetdef>/<macrodef> declarations have taken place. 
No types or tasks have been defined in this namespace yet 

This appears to be an antlib declaration. 
Action: Check that the implementing library exists in one of: 
     -/usr/share/ant/lib 
     -/root/.ant/lib 
     -a directory added on the command line with the -lib argument 

我一直在使用端口9012,50500試過,50508

在JConsole的我用下面的命令service:jmx:rmi:///jndi/rmi://172.16.0.36:50500/alfresco/jmxrmi並將其與證書工程webapps/alfresco/WEB-INF/classes/alfresco/alfresco-jmxrmi.*

我已更新setenv.sh並添加了

CATALINA_OPTS="-Dcom.sun.management.jmxremote 
    -Dcom.sun.management.jmxremote.port=%9012% 
    -Dcom.sun.management.jmxremote.ssl=false 
    -Dcom.sun.management.jmxremote.authenticate=false" 
export CATALINA_OPTS 

我可以使用jconsole監視tomcat url:service:jmx:rmi:///jndi/rmi://172.16.0.36:9012/jmxrmi

回答

1

JMX在Alfresco Community Edition中不可用。

+0

如何監控tomcat – shorif2000

+0

@sharif,你能更具體嗎? –

+0

問題已更新 – shorif2000