?
Solved

MBean operation with parameter?

Posted on 2014-04-02
2
Medium Priority
?
309 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 36

Accepted Solution

by:
mccarl earned 1500 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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
In this post we will learn how to connect and configure Android Device (Smartphone etc.) with Android Studio. After that we will run a simple Hello World Program.
Viewers learn about the scanner class in this video and are introduced to receiving user input for their programs. Additionally, objects, conditional statements, and loops are used to help reinforce the concepts. Introduce Scanner class: Importing…
This theoretical tutorial explains exceptions, reasons for exceptions, different categories of exception and exception hierarchy.
Suggested Courses

719 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