Hi all,
I'm using JBOSS3.2.4RC2.
I have an MBean A which depends on MBean B and MBean C, as defined in my
jboss-service.xml :
...
<!--
| A depend on B and C
-->
<depends optional-attribute-name="BManager">nusa:service=B
<depends optional-attribute-name="CManager">nusa:service=C
<!--
| BMBean
-->
false
<!--
| CBMBean
-->
false
...
A, B, and C has the usual getter/setter method.
If a method within A calls a method in B, as shown below :
...
public ObjectName getBManager() {
return this.bManager;
}
public void setBManager(ObjectName obj) {
this.bManager = obj;
}
...
public void methodA1() {
try {
log.info("=== A.methodA1() invoke methodB1() ");
server.invoke(bManager ,"methodB1" ,null ,null);
} catch ( Exception e) {
log.debug( "=== Exception in A.methodA1 : " + e);
}
}
public void methodA2(String s) {
try {
log.info("=== A.methodA2() invoke methodB2() ");
Object[] params = new Object[] { s };
String[] signature = new String[] { "java.lang.String" };
server.invoke ( bManager, "methodB2", params, signature );
} catch ( Exception e) {
log.debug( "=== Exception in A.methodA2 : " + e);
}
}
...
and the methods in B are :
...
public void methodB1() {
log.info("=== B.methodB1()");
}
public void methodB2(String s) {
log.info("=== B.methodB2() : " + s);
}
...
I got this error :
...
10:26:36,849 INFO [example.jmx.A] === A.startService()
10:26:36,849 INFO [example.jmx.A] === A.methodA1()
10:26:36,849 DEBUG [example.jmx.A] === Exception in A.methodA1 : ReflectionException:
null
Cause: java.lang.IllegalArgumentException: Unable to find operation methodB1()
10:26:36,849 INFO [example.jmx.A] === A.methodA2()
10:26:36,849 DEBUG [example.jmx.A] === Exception in A.methodA2 : ReflectionException:
null
Cause: java.lang.IllegalArgumentException: Unable to find operation
methodB2(java.lang.String)
...
How to use invoke ? What's wrong with the syntax above ?
The C class has a method which return an instance of C :
...
public Object getInstance() {
return this;
}
...
If a method within A calls a method in C, as shown below :
...
public ObjectName getCManager() {
return this.cManager;
}
public void setCManager(ObjectName obj) {
this.cManager = obj;
}
...
public void methodA1() {
try {
log.info("=== A.methodA1() invoke methodC1() ");
C obj = (C)server.getAttribute(cManager ,"Instance");
obj.methodC1();
} catch ( Exception e) {
log.debug( "=== Exception in A.methodA1 : " + e);
}
}
public void methodA2(String s) {
try {
log.info("=== A.methodA2() invoke methodC2() ");
C obj = (C)server.getAttribute(cManager ,"Instance");
obj.methodC2(s);
} catch ( Exception e) {
log.debug( "=== Exception in A.methodA2 : " + e);
}
}
...
I got this error :
...
12:08:28,634 INFO [example.jmx.A] === A.startService()
12:08:28,634 INFO [example.jmx.A] === A.methodA1() invoke methodC1()
12:08:28,634 DEBUG [example.jmx.A] === Exception in A.methodA1 :
javax.management.AttributeNotFoundException: not found: Instance
12:08:28,634 INFO [example.jmx.A] === A.methodA2() invoke methodC2()
12:08:28,634 DEBUG [example.jmx.A] === Exception in A.methodA2 :
javax.management.AttributeNotFoundException: not found: Instance
...
Any idea why the getInstance() in C is not recognize ?
Thanks for any help/suggestion.
View the original post :
http://www.jboss.org/index.html?module=bb&op=viewtopic&p=3834613#3834613
Reply to the post :
http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=3834613
-------------------------------------------------------
This SF.Net email is sponsored by Sleepycat Software
Learn developer strategies Cisco, Motorola, Ericsson & Lucent use to
deliver higher performing products faster, at low TCO.
http://www.sleepycat.com/telcomwpreg.php?From=osdnemail3
_______________________________________________
JBoss-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-user