| Author |
set value for a property of type long using jconsole
|
sam bartl
Ranch Hand
Joined: Oct 29, 2010
Posts: 43
|
|
I created an mbean I have a property of type long , when I try to set its value from jconsole I get exception
java.lang.illegalArgument:argument type mismatch
becasue its of type long I using number how can I set the value of long from, jconsole, String it works no problems but how about any othert objects like long double etc?
|
 |
sam bartl
Ranch Hand
Joined: Oct 29, 2010
Posts: 43
|
|
Please help me with this ,
I have mbean here is my code
for this mbean I can change values using jconsole.
The problem I have is I am unable to update the property sysInfoId using jconsole becasue its of type long , if its a string like the other two properties no problem , but for long I am unable to please advice me is it ok to use fileds other than string in a mbean (JMX)
Please advice me.
|
 |
Jan Hoppmann
Ranch Hand
Joined: Jul 19, 2010
Posts: 98
|
|
|
I assume the method you use to read your sysId returns a String, but you need a long. Try googling for Java wrapper classes, that should point you in the right direction.
|
Life is full of choices. Sometimes you make the good ones, and sometimes you have to kill all the witnesses.
|
 |
Campbell Ritchie
Sheriff
Joined: Oct 13, 2005
Posts: 32611
|
|
|
. . . and either pass a String to the Long() constructor in line 9, or use the L at the end of the number.
|
 |
sam bartl
Ranch Hand
Joined: Oct 29, 2010
Posts: 43
|
|
Campbell Ritchie wrote: . . . and either pass a String to the Long() constructor in line 9, or use the L at the end of the number.
Thanks passing L at the end worked.
|
 |
Campbell Ritchie
Sheriff
Joined: Oct 13, 2005
Posts: 32611
|
|
Well done
|
 |
 |
|
|
subject: set value for a property of type long using jconsole
|
|
|