[
https://issues.jboss.org/browse/WFLY-4008?page=com.atlassian.jira.plugin....
]
Amos Feng commented on WFLY-4008:
---------------------------------
I thinks I find the root clause of this issue. There are two action in the setupActions:
org.jboss.as.ee.naming.JavaNamespaceSetup and
org.jboss.as.weld.arquillian.WeldContextSetup. When the following codes run in
MBeanRegistrationService.java
{code}
public synchronized void start(final StartContext context) throws StartException {
final MBeanServer mBeanServer = getMBeanServer();
final T value = this.value.getValue();
try {
objectName = new ObjectName(name);
} catch (MalformedObjectNameException e) {
throw JmxLogger.ROOT_LOGGER.mbeanRegistrationFailed(e, name);
}
try {
for (SetupAction action : setupActions) {
action.setup(Collections.<String, Object>emptyMap());
}
try {
ROOT_LOGGER.debugf("Registering [%s] with name [%s]", value,
objectName);
mBeanServer.registerMBean(value, objectName);
} catch (Exception e) {
throw ROOT_LOGGER.mbeanRegistrationFailed(e, name);
}
} finally {
for (SetupAction action : setupActions) {
action.teardown(Collections.<String, Object>emptyMap());
}
}
}
{code}
The JavaNamespaceSetup teardown happens before the WeldContextSetup so it throws
NameNotFound Exception in the WeldContextSetup teardown.
The possible fix is to reverse the setupActions before running the teardown method.
MBean deployment causes javax.naming.NameNotFoundException:
java:comp/BeanManager
----------------------------------------------------------------------------------
Key: WFLY-4008
URL:
https://issues.jboss.org/browse/WFLY-4008
Project: WildFly
Issue Type: Bug
Components: CDI / Weld, JMX, Naming
Affects Versions: 8.1.0.Final
Reporter: Darryl Miles
Assignee: Stuart Douglas
Labels: mbean
If you create an MBean in your EJB and deploy the EJB.
<pre>
@SuppressWarnings("serial")
public class Monitor implements MonitorMXBean, Serializable {
private static final Logger log = LoggerFactory.getLogger(Monitor.class);
private Boolean enabled = Boolean.FALSE;
private Long valueOne;
public Monitor() {
log.debug("CTOR");
}
@Override
public Boolean isEnabled() {
return enabled;
}
@Override
public void setEnabled(Boolean enabled) {
this.enabled = enabled;
}
@Override
public Long getValueOne() {
return valueOne;
}
@Override
public void setValueOne(Long valueOne) {
this.valueOne = valueOne;
}
}
</pre>
And JMX MXBean
<pre>
import javax.management.MXBean;
@MXBean
public interface MonitorMXBean {
void setEnabled(Boolean enabled);
Boolean isEnabled();
void setValueOne(Long valueOne);
Long getValueOne();
}
</pre>
17:34:42,455 ERROR [org.jboss.as.weld] (MSC service thread 1-1) JBAS016001: Failed to
tear down Weld contexts: javax.naming.NameNotFoundException: java:comp/BeanManager
at
org.jboss.as.naming.InitialContext$DefaultInitialContext.findContext(InitialContext.java:187)
at
org.jboss.as.naming.InitialContext$DefaultInitialContext.lookup(InitialContext.java:231)
at org.jboss.as.naming.NamingContext.lookup(NamingContext.java:188)
at org.jboss.as.naming.NamingContext.lookup(NamingContext.java:184)
at javax.naming.InitialContext.lookup(InitialContext.java:417) [rt.jar:1.8.0_25]
at javax.naming.InitialContext.lookup(InitialContext.java:417) [rt.jar:1.8.0_25]
at org.jboss.as.weld.arquillian.WeldContextSetup.teardown(WeldContextSetup.java:108)
at org.jboss.as.jmx.MBeanRegistrationService.stop(MBeanRegistrationService.java:132)
[wildfly-jmx-8.1.0.Final.jar:8.1.0.Final]
at
org.jboss.msc.service.ServiceControllerImpl$StopTask.stopService(ServiceControllerImpl.java:2056)
[jboss-msc-1.2.2.Final.jar:1.2.2.Final]
at
org.jboss.msc.service.ServiceControllerImpl$StopTask.run(ServiceControllerImpl.java:2017)
[jboss-msc-1.2.2.Final.jar:1.2.2.Final]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
[rt.jar:1.8.0_25]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
[rt.jar:1.8.0_25]
at java.lang.Thread.run(Thread.java:745) [rt.jar:1.8.0_25]
Is this related to:
https://issues.jboss.org/browse/WFLY-822 ?
--
This message was sent by Atlassian JIRA
(v6.3.8#6338)