Solved

MBean operation with parameter?

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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
hash value 2 38
sumDigits  challenge 7 60
maven java path setting 5 50
Java passing arguments (type error) 2 35
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…
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…
Video by: Michael
Viewers learn about how to reduce the potential repetitiveness of coding in main by developing methods to perform specific tasks for their program. Additionally, objects are introduced for the purpose of learning how to call methods in Java. Define …
Viewers will learn about arithmetic and Boolean expressions in Java and the logical operators used to create Boolean expressions. We will cover the symbols used for arithmetic expressions and define each logical operator and how to use them in Boole…

757 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

17 Experts available now in Live!

Get 1:1 Help Now