Solved

MBean operation with parameter?

Posted on 2014-04-02
2
265 Views
Last Modified: 2014-05-06
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
Comment
Question by:dkim18
2 Comments
 
LVL 35

Accepted Solution

by:
mccarl earned 500 total points
ID: 39973924
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
 

Author Comment

by:dkim18
ID: 39981846
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

Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Java had always been an easily readable and understandable language.  Some relatively recent changes in the language seem to be changing this pretty fast, and anyone that had not seen any Java code for the last 5 years will possibly have issues unde…
Introduction Java can be integrated with native programs using an interface called JNI(Java Native Interface). Native programs are programs which can directly run on the processor. JNI is simply a naming and calling convention so that the JVM (Java…
Viewers will learn about if statements in Java and their use The if statement: The condition required to create an if statement: Variations of if statements: An example using if statements:
Viewers will learn about basic arrays, how to declare them, and how to use them. Introduction and definition: Declare an array and cover the syntax of declaring them: Initialize every index in the created array: Example/Features of a basic arr…

830 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question