需要指定情景工厂类jboss的我不清楚,你看一下文档,或者在jboss文档中搜索javax.naming.Context.INITIAL_CONTEXT_FACTORY,很快就可以找到。javax.naming.Context ctx = null;
Hashtable ht = new Hashtable();webshpere3.5 and up is :
ht.put(javax.naming.Context.INITIAL_CONTEXT_FACTORY,"com.ibm.websphere.naming.WsnInitialContextFactory");
ht.put(javax.naming.Context.PROVIDER_URL,"iiop://localhost:900");
ctx = new javax.naming.InitialContext(ht); weblogic is :ht.put(Context.INITIAL_CONTEXT_FACTORY,"weblogic.jndi.WLInitialContextFactory");
ht.put(Context.PROVIDER_URL,"t3:localhost:7001");
ctx = new InitialContext(ht);

解决方案 »

  1.   

    手动改这个  :
    //get naming context
          Context ctx = new InitialContext();改成:
    Hashtable env = new Hashtable();
           env.put(Context.INITIAL_CONTEXT_FACTORY,"org.jnp.interfaces.NamingContextFactory");
           env.put(Context.URL_PKG_PREFIXES,"org.jboss.naming");
           env.put(Context.PROVIDER_URL,"localhost:1099") ;
          Context ctx = new InitialContext(env);
      

  2.   

    我照你说的做了,但jbuilder提示说Hashtable这个类没找到,不知到要
    包含哪个包啊
      

  3.   

    再问一下eyeieye:
    jboss与sqlserver相连,driver和url怎么设置
    在weblogic中是这样的:
    Driver myDriver = (Driver)Class.forName("weblogic.jdbc.mssqlserver4.Driver").newInstance();

    String url = "jdbc:weblogic:mssqlserver4";     
    可jboss呢??
     望不吝赐教。
      

  4.   

    还有使用的是哪个版本的slqserverjdbc驱动,要是m$自己那个不是很好办的吗?
      

  5.   

    我用的是jboss-3.0.0RC3_tomcat-4.0.3,RC是什么意思啊,听说它比没RC的
    版本好,sqlserver2000
    weblogic下好像跟版本无关吧,只要是sqlserver,都采用一样的设置。