通过twidle检索系统属性



我正试图使用jboss4.3中的twiddle从JMX控制台检索系统属性。

以下命令有效,并为我提供单个属性的值。。。

twiddle.sh -u<username> -p<password> -Djnp.disableDiscovery 
--server=localhost:<port>
invoke 'jboss:name=SystemProperties,type=Service' get 
<SYSTEM PROPERTY NAME>

但当我试图在一次尝试中获得所有属性时,它不起作用。。。

twiddle.sh -u<username> -p<password> -Djnp.disableDiscovery 
--server=localhost:<port> 
invoke 'jboss:name=SystemProperties,type=Service' showAll

并显示以下异常:

00:02:21,773 ERROR [Twiddle] Exec failed
java.lang.reflect.UndeclaredThrowableException
        at $Proxy0.invoke(Unknown Source)
        at org.jboss.console.twiddle.command.InvokeCommand.invoke(InvokeCommand.java:234)
        at org.jboss.console.twiddle.command.InvokeCommand.execute(InvokeCommand.java:282)
        at org.jboss.console.twiddle.Twiddle.main(Twiddle.java:306)
Caused by: java.lang.ClassNotFoundException: org.jboss.varia.property.SystemPropertiesService$HTMLMap (no security manager: RMI class loader disabled)
        at sun.rmi.server.LoaderHandler.loadClass(LoaderHandler.java:375)
        at sun.rmi.server.LoaderHandler.loadClass(LoaderHandler.java:165)
        at java.rmi.server.RMIClassLoader$2.loadClass(RMIClassLoader.java:620)
        at java.rmi.server.RMIClassLoader.loadClass(RMIClassLoader.java:247)
        at sun.rmi.server.MarshalInputStream.resolveClass(MarshalInputStream.java:197)
        at java.io.ObjectInputStream.readNonProxyDesc(ObjectInputStream.java:1575)
        at java.io.ObjectInputStream.readClassDesc(ObjectInputStream.java:1496)
        at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1732)
        at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1329)
        at java.io.ObjectInputStream.readObject(ObjectInputStream.java:351)
        at java.rmi.MarshalledObject.get(MarshalledObject.java:142)
        at org.jboss.invocation.jrmp.interfaces.JRMPInvokerProxy.invoke(JRMPInvokerProxy.java:134)
        at org.jboss.invocation.InvokerInterceptor.invokeInvoker(InvokerInterceptor.java:365)
        at org.jboss.invocation.InvokerInterceptor.invoke(InvokerInterceptor.java:197)
        at org.jboss.jmx.connector.invoker.client.InvokerAdaptorClientInterceptor.invoke(InvokerAdaptorClientInterceptor.java:66)
        at org.jboss.proxy.SecurityInterceptor.invoke(SecurityInterceptor.java:70)
        at org.jboss.proxy.ClientMethodInterceptor.invoke(ClientMethodInterceptor.java:74)
        at org.jboss.proxy.ClientContainer.invoke(ClientContainer.java:100)
        ... 4 more

有线索吗??

编辑

添加properties-plugin.jar后,错误变为:

01:51:36,366 ERROR [Twiddle] Exec failed
java.lang.RuntimeException: No property editor for type: class org.jboss.varia.property.SystemPropertiesService$HTMLMap
        at org.jboss.util.propertyeditor.PropertyEditors.getEditor(PropertyEditors.java:176)
        at org.jboss.console.twiddle.command.InvokeCommand.invoke(InvokeCommand.java:244)
        at org.jboss.console.twiddle.command.InvokeCommand.execute(InvokeCommand.java:282)
        at org.jboss.console.twiddle.Twiddle.main(Twiddle.java:306)

此错误的原因是showAll返回的自定义类org.jboss.varia.property.SystemPropertiesService$HTMLMap的对象不存在于twidle的类路径中。

只需添加到你的推文中即可。sh:

JBOSS_CLASSPATH="$JBOSS_CLASSPATH:$JBOSS_HOME/server/default/lib/properties-plugin.jar"

注意,它是针对JBoss4.x的。您没有提到版本。但stacktrace表明它是JBoss4.x.

最新更新