Solved

invoking Mbean operation with arguement?

Posted on 2014-03-31
3
472 Views
Last Modified: 2014-04-02
Hi,

I have MBean operations.
I am able to invoke getXXX operations without arguements.
But when I try to invoke operations (delete, update, and add) with arguement?
I am getting runtime error.

Do I need to do anything differently when I invoke those operations with arguement?
Can you help?

public List<Catalog> getAllCatalogs() {
try {

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

			String[] sig = {};
			Object[] arg = {};
			list = (List<Catalog>) server.invoke(name,
					"getAllCatalogs", arg, sig);

			Iterator<Catalog> it = list.iterator();
....
skipped rest

Open in new window


The above returns fine.

public void deleteCatalog(Catalog cat) {

      if (cat != null) {
                  try {

                        MBeanServer server = ManagementFactory.getPlatformMBeanServer();
                        ObjectName name = new ObjectName("bean:name=CatalogMbean");                        
                        
                        String[] sig = { int.class.getName() };
                        Object[] arg = {cat.getId()};
                        rowNo = (int) server.invoke(name,"deleteCataglo", arg, sig);

                  } catch (Exception e) {
But I try to delete using id, it gives me a runtype error

)javax.management.RuntimeOperationsException: RuntimeException occurred in RequiredModelMBean while trying to invoke operation deleteCatalog(Catalog cat)
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
3 Comments
 
LVL 35

Expert Comment

by:mccarl
ID: 39968525
Two things...

- I hope that the method name in your invoke call above, "deleteCataglo" is just a typo and you are using the real method name?

- Can you post the full stack trace that you get?
0
 

Author Comment

by:dkim18
ID: 39968853
Yes it was a typo.

That is all i get for the error message. Not that helpful.
0
 
LVL 35

Accepted Solution

by:
mccarl earned 500 total points
ID: 39968973
That is all i get for the error message.
I see in the code above that you are catching all exceptions thrown. What are you doing with the exception? ie. what is directly after the code that you posted above?
0

Featured Post

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
printf performancy 11 101
java mysql insert application 14 68
junit example issue 2 54
DTD and JAVA versions 1 55
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…
Introduction This article is the last of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers our test design approach and then goes through a simple test case example, how …
This tutorial covers a practical example of lazy loading technique and early loading technique in a Singleton Design Pattern.
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …
Suggested Courses

739 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