2

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

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 运行绑定代码?

4

1 回答 1

2

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

  • ServletContextListener
  • @Startup @SigletonEJB
  • 特区
  • RAR
于 2012-09-14T09:10:58.823 回答