-
1. Re: remote mbean operations
adrian.brock Aug 17, 2002 1:19 PM (in response to berkgypsy)Can you catch the RuntimeMBeanException and
print out the result of getTargetException();
Regards,
Adrian -
2. Re: remote mbean operations
juha Aug 17, 2002 1:24 PM (in response to berkgypsy)> I am trying to connect to the SystemProperties mBean
> from a client to retreive some property values.
> First of all, is this possible?
Yes =)
> This is my client's code...
>
> Context ctx = new InitialContext();
> String adaptorName = "jmx:local:rmi";
> RMIAdaptor adaptor = (RMIAdaptor)
> ctx.lookup(adaptorName);
> RemoteMBeanServer server = new
> RMIConnectorImpl(adaptor);
>
> String DEPLOYER_NAME =
> "jboss.system:service=MainDeployer";
> ObjectName objectName = new
> ObjectName(DEPLOYER_NAME);
> System.err.println("getMBeanCount()="+server.getMBeanC
> unt());
>
> System.err.println("isRegistered("+objectName.getCanon
> calName()+")="+server.isRegistered(objectName));
>
>
> And here is the client's output:
> getMBeanCount()=217
You are succesfully connecting to the server, since you are able to get the MBean count (217).
IsRegistered seems to fail, not sure why. Maybe a bug in the RMI connector (the returned exception is not very helpful either, you should check the exception it wraps).
Connector rewrite is on the todo list.
Try if you can retrieve the attributes though, server.getAttribute(objectName, "ServerName");
That should work.
>
> Thanks,
> Emily
-- Juha -
3. Re: remote mbean operations
berkgypsy Aug 19, 2002 2:10 PM (in response to berkgypsy)I caught the Runtime Exception and printed out the target exception, with this result:
org.jboss.util.NestedRuntimeException: RemoteException occurred in server thread; nested exception is:
java.rmi.UnmarshalException: error unmarshalling arguments; nested exception is:
java.io.InvalidClassException: javax.management.ObjectName; local class incompatible: stream classdesc seri
alVersionUID = 1081892073854801359, local class serialVersionUID = 2846767152916764670; - nested throwable: (java.r
mi.ServerException: RemoteException occurred in server thread; nested exception is:
java.rmi.UnmarshalException: error unmarshalling arguments; nested exception is:
java.io.InvalidClassException: javax.management.ObjectName; local class incompatible: stream classdesc seri
alVersionUID = 1081892073854801359, local class serialVersionUID = 2846767152916764670)
serviceURL is null
- javax.management.RuntimeMBeanException
javax.management.RuntimeMBeanException
at org.jboss.jmx.connector.rmi.RMIConnectorImpl.getMBeanInfo(RMIConnectorImpl.java:527)
at com.scilearn.client.UploadClient.upload(UploadClient.java:102)
at com.scilearn.client.UploadClient.main(UploadClient.java:185)
So it looks like my client's copy of ObjectName is incompatible with the server's copy? How can this be and how do I fix it?
Thanks again,
Emily
OH, I was also unable to get server.getAttribute to work, I also got the same RuntimeException, which makes sense. -
4. Re: remote mbean operations
adrian.brock Aug 19, 2002 2:45 PM (in response to berkgypsy)I've only just added the code to make JBoss
Serialization compatible with the jmx 1.1 spec.
Sun forgot to specify serialization in the 1.0 spec :-)
You can get this version from CVS on Branch_3_2 or HEAD.
Looks like you are using jmxri.jar 1.1 so you don't
have to change any system properties.
Alternatively, use jboss-jmx.jar on the client.
Regards,
Adrian -
5. Re: remote mbean operations
berkgypsy Aug 19, 2002 9:46 PM (in response to berkgypsy)Thank you so much for your prompt help. I now have my client working.
I have another quick, rather silly question. Why is the RMI adaptor named "jmx:local:rmi" instead of "jmx:localhost:rmi" as I would expect? From where is the hostname retreived? I noticed there is also another adaptor named "jmx:eshort:rmi" in my JNDIView (eshort is the name of my machine).
Thanks,
Emily -
6. Re: remote mbean operations
adrian.brock Aug 20, 2002 11:22 AM (in response to berkgypsy)I think because sometimes localhost is a valid host name,
it would register it twice.
Regards,
Adrian -
7. Re: remote mbean operations
muteki Oct 28, 2002 2:18 PM (in response to berkgypsy)Hi Adrian,
If I am compiling the server and client separately in two different platforms with the same source code and same version of JVM (the server version is 2.4.4). Will I encounter the same problem? I am currently having the serialVersionUID mismatched as well and wondering is it a problem in my side.
Thanks,
--Chris -
8. Re: remote mbean operations
muteki Oct 28, 2002 3:13 PM (in response to berkgypsy)I bet I must be having some stale classes in my classpath. After rerunning everything, my problem is solved. Please ignore my previous mail...
Thanks,
--Chris