Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 323
  • Last Modified:

MBean operation with parameter?

Hi,

I have MBean operations (methods).
Those methods without any parameters or primitive types parameters work fine.

I have customer type (say Person class(String name, int age, boolean employeed)

I get List<Person> result from the getAllPeople() operation.
I am trying to make the addNewPerson(Person p) operation to work.
But it is not taking the Person parameter.

1) so I tried to pass it as primitive types (addNewPerson(p.name,p.age,p.employeed))
but I am get the avax.management.ReflectionException: Target method not found error message
My service layer which I am invoking has the same parameter types like above.
2) Do you know how I can change this to CompositeData type?
I looked for an example but couldn't find something I can understand.


MBeanServer server = ManagementFactory.getPlatformMBeanServer();
				ObjectName name = new ObjectName(
						"bean:name=catalogMbean");

				String[] sig = { String.class.getName(),String.class.getName()				Object[] arg = { svc.getName(),svc.getDescription(),				
				
				
				
				rowNo = (int) server.invoke(name, "addCatalog", arg, sig);

Open in new window

0
dkim18
Asked:
dkim18
1 Solution
 
mccarlIT Business Systems Analyst / Software DeveloperCommented:
Can you post the code for what you have already tried? And also, if you can, post the code for the MBean that you are trying to call the methods on?
0
 
dkim18Author Commented:
So I have user created classes like a Person class and I get casting errors when I pass around my user created class object whether I get them back from my mbean methods or I pass it as an argument into my mbean methods all due to being on different jvm class loaders.

Would like to know how to create a compositetype so I can pass around my user created class object.
Just cannot find an example how to create the compositedata and pass it to my mbean method(invoke) or receive that argument in my service or dao method.

Can you show me example to do this?

Just use Person class as an example if you want.
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now