重起一下weblogic吧
看你的配置没什么问题记得把oracle  jdbc的包放到启动路径里

解决方案 »

  1.   

    oracle  jdbc的包已经放到启动路径里了。重启weblogic后是没有异常的,但是当我再去Targets,把原来选了的myserver撤下,再点右箭头,把myserver再选进入Chosen栏目,按apply后又出现以上的异常了。
      

  2.   

    与oracle的版本有关吗?我的版本是8i的Oracle8 Enterprise Edition Release 8.0.5.0.0 - Production
      

  3.   

    我查过数据库了,的确已经建立了jdbc连接,是不是证明连接池已经设置成功。
      

  4.   

    使用weblogic连接池的相关配置、示例与说明
    配置:
    1、进入console
    2、选择:mydomain-->Services-->JDBC-->Connection Pools-->Configure a new JDBC Connection Pool...
    出现connection pool的Configuration页面
    Name: My Connection Pool (可任意给出名称)
    URL: jdbc:oracle:thin:@192.168.10.240:1521:orcl (这里使用Oracle的thin方式,
    只要把URL中的"192.168.10.240"替换成你所使用的数据库服务器地址即可)
    Driver Classname: oracle.jdbc.driver.OracleDriver
    Properties(key=value): user=user
    ACLName: 可不填
    Password: pwd点create按钮3、在上个页面中,选择Connections,
       Initial Capacity:   2 //初始连接数
       Maximum Capacity:   10 //最大连接数
       Capacity Increment:   2 //连接池增长步长
       Login Delay Seconds:  1 seconds 
       Refresh Period: 10  minutes 
    4、选择Testing
    Test Table Name:   tab (随便填入一个当前表空间中的表名,注意:必填!)
      √   Test Reserved Connections 
      √   Test Released Connections (以上两个checkbox必选)
    点apply按钮5、选择:mydomain-->Services-->JDBC-->Data Sources-->Configure a new JDBC Data Source...
    Name: My Data Source (自己给定名称)
    JNDI Name: mypool (自己给定名称,这是在JNDI中注册的名称,以后创建连接时要用到)
    Pool Name: My Connection Pool (这里填入第三步中填入的Name)6、重新启动weblogic
    7、选择mydomain-->Services-->JDBC-->Connection Pools-->My Connection Pool-->Target
    chosen:myserver
    点apply按钮
    8、选择:mydomain-->Services-->JDBC-->Data Sources-->My Data Source-->Target
    chosen:myserver
    点apply按钮
    使用例程如下:<%
    /**
     * testConn.jsp
     * weblogic下用获得数据库连接的范例代码
     * 最新修改日期:2003-6-4
     */
    %><%@ page contentType = "text/html;charset=GBK" %>
    <%@ page import="java.sql.*" %>
    <%

    out.println("Testing my connection pool...<BR>"); // The JDBC Connection object
    Connection conn = null; // The JDBC statement object
    Statement stmt = null; // The JDBC ResultSet object
    ResultSet rs = null;
    try
    {
    //获得连接,其中:"mypool"是本范例使用的Data Source注册在weblogic中的JNDI名称
    //注意:jdk1.3.1中并没有javax.sql包,到j2sdkee1.3或者jdk1.4中可以找到
    javax.naming.Context ctx = new javax.naming.InitialContext();
    javax.sql.DataSource ds = (javax.sql.DataSource)ctx.lookup("mypool");
    conn = ds.getConnection();

    // Create a statement object that we can execute queries with
    stmt = conn.createStatement() ; String query1 = "SELECT SYSDATE FROM DUAL";

    rs = stmt.executeQuery(query1);
    if (rs.next())
    {
    out.println("OK!");
    }
    }
    catch (Exception ex) 
    {
    // Send the error back to the client
    out.println("Exception:" + ex.getMessage());
    }
    finally 
    {
    try
    {
    if(rs != null)
    {
    rs.close();
    }
    }
    catch(Exception ex) {}
    try 
    {
    if (stmt != null) 
    {
    stmt.close();
    }
    }
    catch(Exception ex) {}
    try 
    {
    if (conn != null) 
    {
    conn.close();
    }
    }
    catch (Exception ex) 
    {
    // Ignore any errors here
    }
    }
    %>完成以上工作后,确定在weblogic上配置的Data Source是可用的,就可以考虑将获得数据库连接的
    过程封装起来,如下例所示:package MyBeans;public class MyConn 
    {
    javax.naming.Context ctx = null;
    //初始化
    public MyConn()
    throws Exception
    {
    ctx = new javax.naming.InitialContext();
    } //获得连接
    public java.sql.Connection getConn(String JndiName) 
    throws java.sql.SQLException,Exception
    {
    javax.sql.DataSource ds = (javax.sql.DataSource)ctx.lookup(JndiName);
    java.sql.Connection Conn = ds.getConnection(); return Conn;
    } //关闭连接
    //注意,在使用完Connection对象之后,必须在程序中显式地调用此方法
    public void close(java.sql.Connection conn)
    throws java.sql.SQLException,Exception
    {
    if (conn != null) 
    {
    conn.close();
    }
    }
    }
    调用的例子如下:
    <%
    /**
     * testMyConn.jsp
     * 测试MyConn
     * 最新修改日期:2003-6-4
     */
    %><%@ page contentType = "text/html;charset=GBK" %>
    <jsp:useBean id="mconn" scope="page" class="MyBeans.MyConn" />
    <%@ page import="java.sql.*" %>
    <%
    out.println("Testing MyConn...<BR>"); // The JDBC Connection object
    java.sql.Connection con = null; // The JDBC statement object
    java.sql.Statement stmt = null; // The JDBC ResultSet object
    java.sql.ResultSet rs = null; try
    {
    //获得连接,其中:"mypool"是本范例使用的Data Source注册在weblogic中的JNDI名称
    con = mconn.getConn("mypool"); // Create a statement object that we can execute queries with
    stmt = con.createStatement() ; String query1 = "SELECT SYSDATE FROM DUAL";

    rs = stmt.executeQuery(query1);
    if (rs.next())
    {
    out.println("ok!");
    }
    }
    catch (Exception ex) 
    {
    // Send the error back to the client
    out.println("SQLException:" + ex.getMessage());
    }
    finally 
    {
    try
    {
    if(rs != null)
    {
    rs.close();
    }
    }
    catch(Exception ex) {}
    try 
    {
    if (stmt != null) 
    {
    stmt.close();
    }
    }
    catch(Exception ex) {}
    try 
    {
    if (conn != null) 
    {
    //显式关闭连接
    mconn.close(conn);
    }
    }
    catch (Exception ex) 
    {
    // Ignore any errors here
    }
    }
    %>
      

  5.   

    你的问题可能在于
    没有配Testing一项就去设target了
      

  6.   

    已经配了testing。现在问题已经解决,那个问题是weblogic的一个小bug,其实连接池已经成功设置好。不过还是很感谢你!