[jboss-user] [EJB 3.0] - @Management and JBoss 4.2.1

bforney do-not-reply at jboss.com
Sun Aug 31 21:01:46 EDT 2008


I'm new to the forums and new to JBoss, but have used Tomcat and Spring before in at a prior employer. Feel free to ask basic questions or make basic comments given my experience level with JBoss.

I'm trying to deploy a POJO as a JBoss EJB3.0 Service (using the @Service annotation) with a JMX interface (using the @Management annotation). Both of these annotations are JBoss extensions for EJB3.0. The Service is deployed, but the Management annotation doesn't lead to an MBean by the objectName I've specified and hence JMX clients can't find the MBean. I've looked for the MBean in both the JMX console provided on port 8080 and using a JMX connection from a simple Java program. I'd love any help in understanding why the MBean specified by the @Management(objectName=...) isn't appearing the JMX server.

Here's what I am doing:

- JBoss v 4.2.1
- @Service class:

public class RecordManager extends NotificationBroadcasterSupport 
                implements NotificationListener, RecordManagerMBean { 


        public static final ObjectName MBEAN_NAME; 
        private static final Exception MBEAN_NAME_EXCEPTION; 
        static { 
            Exception exception = null; 
            ObjectName objName = null; 
            try { 
                // This should always match the objectName value of the 
                // @Service annotation 
                objName = new ObjectName("integral7:service=RecordManager"); 
            } catch (final Exception e) { 
                exception = e; 
            } finally { 
                MBEAN_NAME = objName; 
                MBEAN_NAME_EXCEPTION = exception; 



- @Management class:
public interface RecordManagerMBean extends NotificationEmitter {


- Client code:

    private Object invokeRecordManager( 
                final String operation, 
                final Object... args 
    ) { 
        try { 
                InitialContext ctx = new InitialContext(); // From jndi.properties 
                MBeanServerConnection server = 
                        (MBeanServerConnection) ctx.lookup("jmx/invoker/RMIAdaptor"); 
                // generate the signature 
                List signature = new ArrayList(); 
                for (final Object arg : args) { 
                return server.invoke( 
                                RecordManager.MBEAN_NAME, operation, 
                                args, signature.toArray(new String[] {}) 
        } catch (final Exception e) { 
            final StringWriter sw = new StringWriter(); 
            final PrintWriter pw = new PrintWriter(sw, true); 
            return e.toString() + ": " + sw.toString(); 

- Have read and tried the different methods outlined in:

In essence, I want a singleton object that can be accessed via JMX remotely. Any suggestions and questions are welcomed.


View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4173481#4173481

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4173481

More information about the jboss-user mailing list