testsqlBean 是什么东西? ejb吗? 是的话就是你的ejb没有发布成功.
不是的话......

解决方案 »

  1.   

    weblogic 里面的连接池没配或者配置有错误。
      

  2.   

    我才用ejbClient方式可以连接oracleShare,可以从数据将数据取出来。
    但我采用HttpServlet,却报如下错误,不知道怎么解决。那位大侠有Ejb用HttpServlet发布的例子share一下,或给我点启示,谢谢。
    C:\bea\jdk131_06\bin\javaw -classpath "C:\bea\weblogic700\server\lib\weblogic_sp.jar;C:\bea\weblogic700\server\lib\weblogic.jar;C:\bea\weblogic700\server\lib\webservices.jar"   -ms64m -mx64m -Djava.library.path=/bea/weblogic700/server/bin -Dbea.home=C:/bea -Dweblogic.Name=myserver -Djava.security.policy==/bea/weblogic700/server/lib/weblogic.policy -Dweblogic.management.discover=false -Dweblogic.ProductionModeEnabled=false -Dweblogic.management.username=ouyang -Dweblogic.management.password=123454321 -Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,address=ouyang:1661,suspend=y weblogic.Server  
    Starting WebLogic Server...<2003-5-21 上午10时55分33秒> <Notice> <Management> <140005> <Loading configuration C:\bea\user_projects\mydomain\.\config.xml> <2003-5-21 上午10时55分41秒> <Error> <EmbeddedLDAP> <171516> <Could not get exclusive access to the embedded LDAP data files directory: .\myserver\ldap\ldapfiles> <2003-5-21 上午10时55分41秒> <Critical> <WebLogicServer> <000364> <Server failed during initialization. Exception:weblogic.server.ServiceFailureException: Could not get exclusive access to embedded LDAP data files due to existing serverweblogic.server.ServiceFailureException: Could not get exclusive access to embedded LDAP data files due to existing server at weblogic.ldap.EmbeddedLDAP.ensureExclusiveAccess(EmbeddedLDAP.java:899) at weblogic.ldap.EmbeddedLDAP.initialize(EmbeddedLDAP.java:204) at weblogic.t3.srvr.T3Srvr.initialize1(T3Srvr.java:717) at weblogic.t3.srvr.T3Srvr.initialize(T3Srvr.java:594) at weblogic.t3.srvr.T3Srvr.run(T3Srvr.java:282) at weblogic.Server.main(Server.java:32)> <2003-5-21 上午10时55分41秒> <Emergency> <WebLogicServer> <000342> <Unable to initialize the server: Fatal initialization exception
    Throwable: weblogic.server.ServiceFailureException: Could not get exclusive access to embedded LDAP data files due to existing server
    weblogic.server.ServiceFailureException: Could not get exclusive access to embedded LDAP data files due to existing server at weblogic.ldap.EmbeddedLDAP.ensureExclusiveAccess(EmbeddedLDAP.java:899) at weblogic.ldap.EmbeddedLDAP.initialize(EmbeddedLDAP.java:204) at weblogic.t3.srvr.T3Srvr.initialize1(T3Srvr.java:717) at weblogic.t3.srvr.T3Srvr.initialize(T3Srvr.java:594) at weblogic.t3.srvr.T3Srvr.run(T3Srvr.java:282) at weblogic.Server.main(Server.java:32)> ***************************************************************************The WebLogic Server did not start up properly.Exception raised: weblogic.server.ServiceFailureException: Could not get exclusive access to embedded LDAP data files due to existing server at weblogic.ldap.EmbeddedLDAP.ensureExclusiveAccess(EmbeddedLDAP.java:899) at weblogic.ldap.EmbeddedLDAP.initialize(EmbeddedLDAP.java:204) at weblogic.t3.srvr.T3Srvr.initialize1(T3Srvr.java:717) at weblogic.t3.srvr.T3Srvr.initialize(T3Srvr.java:594) at weblogic.t3.srvr.T3Srvr.run(T3Srvr.java:282) at weblogic.Server.main(Server.java:32)Reason: Fatal initialization exception
    Throwable: weblogic.server.ServiceFailureException: Could not get exclusive access to embedded LDAP data files due to existing server
    weblogic.server.ServiceFailureException: Could not get exclusive access to embedded LDAP data files due to existing server at weblogic.ldap.EmbeddedLDAP.ensureExclusiveAccess(EmbeddedLDAP.java:899) at weblogic.ldap.EmbeddedLDAP.initialize(EmbeddedLDAP.java:204) at weblogic.t3.srvr.T3Srvr.initialize1(T3Srvr.java:717) at weblogic.t3.srvr.T3Srvr.initialize(T3Srvr.java:594) at weblogic.t3.srvr.T3Srvr.run(T3Srvr.java:282) at weblogic.Server.main(Server.java:32)***************************************************************************
      

  3.   

    它是说没有找到你的JNDI名字,是不是你的EJB没有正确发布啊
      

  4.   

    EJB正确发布啦,我采用ejbClient方式进行测试,一切正常呀,并且将数据从oracle取出来啦,主要代码如下:Context context = getInitialContext();
        //look up jndi name
        Object ref = context.lookup("testsqlBean");
        //look up jndi name and cast to Home interface
        testsqlHomeObject = (testsqlHome) PortableRemoteObject.narrow(ref, testsqlHome.class);
        testsqlObject = testsqlHomeObject.create();
        testsqlObject.getMyConn(sql);
    但我才用我采用HttpServlet,却有问题呀,问题处在下列代码呀:
        Context context =getInitialContext();//test.getContext();//
          System.out.println("context is "+context);
          Object objref = context.lookup("testsqlBean"); // EJB中那个SessionBean的名字
          testsqlHome home = (testsqlHome) javax.rmi.PortableRemoteObject.narrow(objref, testsqlHome.class);
          testsql servletsql = home.create();
          String myStr = servletsql.getMyConn(sql);
    他们getInitialContext函数一样,但ejbClient没有报错,而HttpServlet报错,说初始化错误,不知道怎么解决。
       请高手帮忙。
      

  5.   

    private Context getInitialContext() throws Exception {
        String url = "t3://localhost:7001";
        String user = null;
        String password = null;
        Properties properties = null;
        try {
          properties = new Properties();
          properties.put(Context.INITIAL_CONTEXT_FACTORY, "weblogic.jndi.WLInitialContextFactory");
          properties.put(Context.PROVIDER_URL, url);
          if (user != null) {
            properties.put(Context.SECURITY_PRINCIPAL, user);
            properties.put(Context.SECURITY_CREDENTIALS, password == null ? "" : password);
          }      return new InitialContext(properties);
        }
        catch(Exception e) {
          log("Unable to connect to WebLogic server at " + url);
          log("Please make sure that the server is running.");
          throw e;
        }
      }
    为何HttpServlet调用此函数却报错哪?而EjbClient却不会呢?