如何从MBean将对象绑定到Jboss 7中的JNDI? (命名上下文是只读的)

时间:2012-09-14 06:32:29

标签: jndi jmx jboss7.x mbeans

当从MBean(遗留代码到jboss 7.1)将对象绑定到JNDI时,我遇到以下异常:

Caused by: java.lang.UnsupportedOperationException: JBAS011859: Naming context is read-only
    at org.jboss.as.naming.WritableServiceBasedNamingStore.requireOwner(WritableServiceBasedNamingStore.java:126)
    at org.jboss.as.naming.WritableServiceBasedNamingStore.createSubcontext(WritableServiceBasedNamingStore.java:116)
    at org.jboss.as.naming.NamingContext.createSubcontext(NamingContext.java:338)
    at org.jboss.as.naming.InitialContext.createSubcontext(InitialContext.java:229)
    at org.jboss.as.naming.NamingContext.createSubcontext(NamingContext.java:346)
    at javax.naming.InitialContext.createSubcontext(InitialContext.java:464) [classes.jar:1.6.0_33]
    at org.jboss.as.naming.util.NamingUtils.createSubcontext(NamingUtils.java:63)
    at org.jboss.as.naming.util.NamingUtils.rebind(NamingUtils.java:239)
    at org.jboss.as.naming.util.NamingUtils.rebind(NamingUtils.java:225)
    at com.cdate.hypertable.commons.pool.mgmt.HyperClientConfigMgmt.rebind(HyperClientConfigMgmt.java:79)

如何将对象绑定到MBean中的JNDI? 是否可以在安全上下文中使用某些“所有者”运行MBean中的绑定代码?

1 个答案:

答案 0 :(得分:2)

您只能在部署期间写入JNDI。您拥有的一些选项是:

  • ServletContextListener
  • @Startup @Sigleton EJB
  • SAR
  • RAR