I have successfully added a remote notification listener using the RMIAdaptor, but I had to do a bit of work first - there must be a better way! But in case anyone wants to know how I did it:
you need a remote version of the non-remote NotificationListener interface - there is one in JBoss 4: org.jboss.jmx.adaptor.rmi.RMINotificationListener which I reused. create a RMI to JMX bridge class that converts remote handleNotification calls to standard non-remote versions, calling the handleNotification on your remote listener. get UnicastRemoteObject to export this bridge class - so you now have a remote proxy that implements the remote interface and will remotely call your local bridge. wrap the proxy in a JMX to RMI bridge (that must be serializable) so that you can send something over the wire that implements the non-remote handleNotification method, since you can't add the remote interface implementation to an MBeanServer. send this over the wire using the RMIAdaptor. Easy! Except: - You have to provide the final bridge with a GUID so that you can remove the listener later (you can't do this directly since you don't have a reference to the listener that was created via deserialization and added to the remote MBeanServer) - and you must also implement equals and hashCode to use the GUID. - You also need to put the final proxy class into JBoss' classpath (create a jar containing this and put it in your server's lib directory). - If you use JDK1.5 to run JBoss, and make your RMI to JMX bridge extend UnicastRemoteObject you have nothing further to do - otherwise you need to use rmic to create a remote stub (the remote proxy) and also include this in the jar - it needs to be on JBoss' classpath too. Please don't tell me I could have done this with a one line change to an XML file somewhere... View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=3874074#3874074 Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=3874074 ------------------------------------------------------- SF email is sponsored by - The IT Product Guide Read honest & candid reviews on hundreds of IT Products from real users. Discover which products truly live up to the hype. Start reading now. http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click _______________________________________________ JBoss-user mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/jboss-user
