Topic: 为什么我不能LOOKUP到JNDI呢,请帮啊

  Print this page

1.为什么我不能LOOKUP到JNDI呢,请帮啊 Copy to clipboard
Posted by: horry
Posted on: 2004-05-30 02:34

在JBOSS 3.2.1中
程序是这样子的
private InitialContext getContext() throws NamingException {
      Hashtable props = new Hashtable();
      props.put(
        InitialContext.INITIAL_CONTEXT_FACTORY,
        "org.jnp.interfaces.NamingContextFactory");
      props.put(InitialContext.PROVIDER_URL, "jnp://127.0.0.1:1099");

      InitialContext initialContext = new InitialContext(props);
      return initialContext;
  }
然后在MAIN中
try {
      System.out.println("Looking up the factory ");
    
      InitialContext ctx = getContext();
    
      QueueConnectionFactory factory = (QueueConnectionFactory) ctx.lookup("ConnectionFactory");
这时出错,说得不到ConnectionFactory
为什么呢?


   Powered by Jute Powerful Forum® Version Jute 1.5.6 Ent
Copyright © 2002-2021 Cjsdn Team. All Righits Reserved. 闽ICP备05005120号-1
客服电话 18559299278    客服信箱 714923@qq.com    客服QQ 714923