try this one---maybe!!
public static Context getInitialContext()
        throws javax.naming.NamingException
{
  Properties p=new Properties();
  p.put(Context.INITIAL_CONTEXT_FACTORY,
           "weblogic.jndi.TengahInitialContextFactory");
  p.put(Context.PROVIDER_URL, "t3://localhost:7001");
      return new InitialContext(p);
    } catch (NamingException ne) {
      System.out.println("We were unable to get a connection to the WebLogic server at ");
      System.out.println("Please make sure that the server is running.");
      throw ne;
    }
    }

解决方案 »

  1.   

        public static Context getWeblogicInitialContext() 
                              throws javax.naming.NamingException {
        try
        {
          Properties p = new Properties();
          p.put(Context.INITIAL_CONTEXT_FACTORY,
                "weblogic.jndi.TengahInitialContextFactory");
          p.put(Context.PROVIDER_URL, "t3://localhost:7001");
          return new InitialContext(p);
        } catch (NamingException ne) {
          System.out.println("We were unable to get a connection to the WebLogic server at ");
          System.out.println("Please make sure that the server is running.");
          throw ne;
        }
        }
      

  2.   

          Properties p = new Properties();
          p.put(Context.INITIAL_CONTEXT_FACTORY,
                "weblogic.jndi.TengahInitialContextFactory");
          p.put(Context.PROVIDER_URL, "t3://localhost:7001");
          return new InitialContext(p);
        
    改成
          Hashtable ht = new Hashtable();  
    ht.put(Context.INITIAL_CONTEXT_FACTORY,
             "weblogic.jndi.WLInitialContextFactory");
               ht.put(Context.PROVIDER_URL,
                        "t3://localhost:7001");
          return new InitialContext(ht);试试看,祝你成功!
      

  3.   

    错误是说没找到weblogic.jndi.TengahInitialContextFactory
    它是在哪个包里?
    我按weblogic的ejb例子做的呀,应该不会错
    我的classpath是:
    CLASSPATH=.;e:\jdk\lib\Tools.jar;e:\jdk\lib\dt.jar;E:\jakarta-tomcat\lib\servlet.jar;e:\myjsp;e:\myjsp\server;E:\jdk\driver\xml4j.jar;E:\jdk\driver\xerces.jar;e:\BORLAND\VBROKER\lib\vbcpp.jar;E:\weblogic\lib\unpacked_jars\javax_ejb.zip;E:\Oracle\Ora81\jdbc\lib\classes111.zip;
      

  4.   

    你在客户端的classpath中有没有加入weblogic ejb package的path?
      

  5.   

    把你的qq号码写出来吧,我直接问你,ok?
    我的是1504937
      

  6.   

    E:\weblogic\lib\unpacked_jars\javax_ejb.zip;
    是这个吗?我已经加了
      

  7.   

    你要是本机使用ejb的话,这样也可以:
    public static Context getWeblogicInitialContext() 
                              throws javax.naming.NamingException {
        try
        {
          return new InitialContext();
        } catch (NamingException ne) {
          System.out.println("We were unable to get a connection to the WebLogic server at ");
          System.out.println("Please make sure that the server is running.");
          throw ne;
        }
        }
      

  8.   

    你要是想使用welogic.jndi.WLInitialContextFactory类,你把d:\weblogic\lib\的路径加入到classpath里面试试
      

  9.   

    那它怎么找到ejb的服务器呢?
      

  10.   

    刚才那个问题解决,import weblogic.jndi.*即可
    但出现了新的错误,hehe
    java.lang.Noclassdeffounderror:weblogic/rmi/extensions/RemoteObjectReference
    我在weblogic510sp9.jar中没有找到这个类,why?
      

  11.   

    问题都已经解决!
    你们都是用jbuilder做的吗?不然这个问题应该很容易
    就是在classpath加上路径,唉,折腾了我两天。
    晚上结帖,一人十分,感谢大家。
      

  12.   

    再请教:
    java.sql.SQLException: Exception raised by connection pool :java.lang.SecurityException: User "guest" does not have Permission "reserve" based on ACL "weblogic.jdbc.connectionPool.mysqlPool".entity bean:
    在home.create(1)时出错,怎么解决呢?
      

  13.   

    上面的问题又解决了,可又来一个wt,sigh,层出不穷
    给分吧,有人知道的跟我说一声,[email protected]
    新wt是:bingo.cabin not found
    bingo为服务器名
    cabin为表名
    连接池的testtable为cabin