File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Java in General and the fly likes set value for a property of type long using jconsole Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Java » Java in General
Reply Bookmark "set value for a property of type long using jconsole" Watch "set value for a property of type long using jconsole" New topic
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
    
    4
. . . 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
    
    4
Well done
 
I agree. Here's the link: http://zeroturnaround.com/jrebel - it saves me about five hours per week
 
subject: set value for a property of type long using jconsole
 
Similar Threads
jsp:setProperty Unexpected Behavior
SSLExt, Tiles, Struts 1.3.5
Configuring DBCP Vs Configuring JNDI? Difference between them?
using jconsole
Connetion pooling problem