Solved

MBean operation with parameter?

Posted on 2014-04-02
2
252 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
topping1 challenge 7 72
Free Alternative to JIRA 4 90
ArrayIndexOutOfBoundException 9 66
Java Loop 6 48
By the end of 1980s, object oriented programming using languages like C++, Simula69 and ObjectPascal gained momentum. It looked like programmers finally found the perfect language. C++ successfully combined the object oriented principles of Simula w…
Java Flight Recorder and Java Mission Control together create a complete tool chain to continuously collect low level and detailed runtime information enabling after-the-fact incident analysis. Java Flight Recorder is a profiling and event collectio…
Viewers learn about the “for” loop and how it works in Java. By comparing it to the while loop learned before, viewers can make the transition easily. You will learn about the formatting of the for loop as we write a program that prints even numbers…
Viewers learn how to read error messages and identify possible mistakes that could cause hours of frustration. Coding is as much about debugging your code as it is about writing it. Define Error Message: Line Numbers: Type of Error: Break Down…

929 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now