Reputation: 1049
I have SAR archive for JBoss and there is one MBean registered in jboss-service.xml
.
Now I want to migrate to TomEE and use standard javax.management
annotation @MBean
, but I can't find out how to specify name of it and it creates with default name.
Can anyone help me?
Upvotes: 1
Views: 639
Reputation: 3422
TomEE doesnt support it yet (see https://issues.apache.org/jira/browse/TOMEE-1668) but DeltaSpike does and keeps the CDI integration: https://github.com/apache/deltaspike/blob/1572c07eb8d5f892308e1060a9fa1ccdbf18435e/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/api/jmx/MBean.java#L57
Upvotes: 2
Reputation: 16209
You have to specify the name when registering the bean as described here:
MBeanServer mbs = ManagementFactory.getPlatformMBeanServer();
ObjectName name = new ObjectName("com.example.mbeans:type=Hello");
Hello mbean = new Hello();
mbs.registerMBean(mbean, name);
Upvotes: 1