MBeans Question
teufteuf45 Dec 6, 2005 9:11 AMHello again,
I'm starting coding in JBMS but i'm very new to J2EE and i've a problem with MBeans:
I've coded an MBEAN called DestinationManagerMBean and DestinationManager for implementation (names arent good). It works fine and contains a hashmap as attribute that i can manipulate via the jmx console.
Now i would like that another class get the "live" value of this hashtable, so i need it get the MBean. The code in the method is:
(class tesDestination)
(DestinationManagerMBean parent as class field)
public boolean isChanged(MailAddress address){
this.parent = (DestinationManagerMBean) JBMailJMXUtil.getMBean(new DestinationManager().getServiceName(),DestinationManagerMBean.class);
if(parent.changes().containsKey(address.getUser())) return true;
else return false;
}
So what i think i do is getting the DestinationManagerMBean and referencing parent with it, then i invoque the DestinationManager method changes() that return the hashmap.
Tho i get the following exception:
2005-12-06 15:02:03,328 INFO [STDOUT] Exception in thread "Thread-18"
2005-12-06 15:02:03,328 INFO [STDOUT] javax.management.RuntimeOperationsException
2005-12-06 15:02:03,328 INFO [STDOUT] at org.jboss.mx.server.registry.BasicMBeanRegistry.get(BasicMBeanRegistry.java:495)
2005-12-06 15:02:03,328 INFO [STDOUT] at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:638)
2005-12-06 15:02:03,328 INFO [STDOUT] at javax.management.MBeanServerInvocationHandler.invoke(Unknown Source)
2005-12-06 15:02:03,328 INFO [STDOUT] at $Proxy95.changes(Unknown Source)
2005-12-06 15:02:03,328 INFO [STDOUT] at org.jboss.mail.destinationmanager.testDestination.isChanged(testDestination.java:21)
2005-12-06 15:02:03,328 INFO [STDOUT] at org.jboss.mail.smtp.handlers.CmdDATA.handleRequest(CmdDATA.java:79)
2005-12-06 15:02:03,328 INFO [STDOUT] at org.jboss.mail.smtp.handlers.RequireSTARTTLSProxy.handleRequest(RequireSTARTTLSProxy.java:49)
2005-12-06 15:02:03,328 INFO [STDOUT] at org.jboss.mail.smtp.SMTPProtocolInstance.handleRequest(SMTPProtocolInstance.java:167)
2005-12-06 15:02:03,328 INFO [STDOUT] at org.jboss.mail.ConnectionHandler.runSocket(ConnectionHandler.java:168)
2005-12-06 15:02:03,328 INFO [STDOUT] at org.jboss.mail.ConnectionHandler.run(ConnectionHandler.java:73)
2005-12-06 15:02:03,328 INFO [STDOUT] at EDU.oswego.cs.dl.util.concurrent.PooledExecutor$Worker.run(PooledExecutor.java:743)
2005-12-06 15:02:03,328 INFO [STDOUT] at java.lang.Thread.run(Unknown Source)
2005-12-06 15:02:03,328 INFO [STDOUT] Caused by: java.lang.IllegalArgumentException: null object name
2005-12-06 15:02:03,328 INFO [STDOUT] ... 12 more
Anyone can help pls ?
Thanks
Fred