此回复为自动发出,仅用于显示而已,并无任何其他特殊作用
楼主【zhao9302】截止到2008-07-26 20:50:35的历史汇总数据(不包括此帖):
发帖的总数量:4                        发帖的总分数:70                       每贴平均分数:17                       
回帖的总数量:4                        得分贴总数量:1                        回帖的得分率:25%                      
结贴的总数量:4                        结贴的总分数:70                       
无满意结贴数:0                        无满意结贴分:0                        
未结的帖子数:0                        未结的总分数:0                        
结贴的百分比:100.00%               结分的百分比:100.00%                  
无满意结贴率:0.00  %               无满意结分率:0.00  %                  
敬礼!

解决方案 »

  1.   

    HTTP Status 500 - --------------------------------------------------------------------------------type Exception reportmessage description The server encountered an internal error () that prevented it from fulfilling this request.exception org.apache.jasper.JasperException: An exception occurred processing JSP page /TestDatabase.jsp at line 1916:  ResultSet rs = null;
    17: 
    18:  InitialContext ic = new InitialContext();
    19:  DataSource ds = (DataSource)ic.lookup("java:comp/env/jdbc/bbs");
    20:  Connection conn = ds.getConnection();
    21:  Statement stmt = conn.createStatement();
    22:  String sql = "select * from article ";
    Stacktrace:
    org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:505)
    org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:398)
    org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:337)
    org.apache.jasper.servlet.JspServlet.service(JspServlet.java:266)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
    root cause javax.servlet.ServletException: javax.naming.NameNotFoundException: Name jdbc is not bound in this Context
    org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:850)
    org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:779)
    org.apache.jsp.TestDatabase_jsp._jspService(TestDatabase_jsp.java:122)
    org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
    org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:374)
    org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:337)
    org.apache.jasper.servlet.JspServlet.service(JspServlet.java:266)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
    root cause javax.naming.NameNotFoundException: Name jdbc is not bound in this Context
    org.apache.naming.NamingContext.lookup(NamingContext.java:770)
    org.apache.naming.NamingContext.lookup(NamingContext.java:140)
    org.apache.naming.NamingContext.lookup(NamingContext.java:781)
    org.apache.naming.NamingContext.lookup(NamingContext.java:140)
    org.apache.naming.NamingContext.lookup(NamingContext.java:781)
    org.apache.naming.NamingContext.lookup(NamingContext.java:153)
    org.apache.naming.SelectorContext.lookup(SelectorContext.java:137)
    javax.naming.InitialContext.lookup(Unknown Source)
    org.apache.jsp.TestDatabase_jsp._jspService(TestDatabase_jsp.java:73)
    org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
    org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:374)
    org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:337)
    org.apache.jasper.servlet.JspServlet.service(JspServlet.java:266)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
    note The full stack trace of the root cause is available in the Apache Tomcat/6.0.16 logs.
    --------------------------------------------------------------------------------Apache Tomcat/6.0.16
    可能是我的程序也有点问题,但是不知道应该怎么弄才对。。请指教
      

  2.   

    <Context path="/web" docBase="web" debug="0"      reloadable="true" crossContext="true">
    path是你的web应用发布名吗?docBase是你的系统的当地目录吗(如:c:\**\你的系统目录)?Exception说"Name jdbc is not bound in this Context" 
      

  3.   

    数据连接池也可以在项目下的 META-INF 文件夹下 建立一个context.xml <?xml version='1.0' encoding='utf-8'?><Context>    <Resource name="jdbc/mysql"   
           auth="Container"   
               
           type="javax.sql.DataSource"   
           driverClassName="com.mysql.jdbc.Driver"   
           url="jdbc:mysql://localhost/bbs"   
           username="root"   
           password="root"   
           maxActive="50"   
           maxIdle="20"   
           maxWait="10000" />   </Context>
      

  4.   

    配置web.xml
    添加  <resource-ref>
       <description>DB Connection</description>
       <res-ref-name>jdbc/mysql</res-ref-name>
       <res-type>javax.sql.DataSource</res-type>
       <res-auth>Container</res-auth>
      </resource-ref>
    这是获得Connection的代码 package xushun.util;import java.sql.*;
    import javax.sql.*;
    import javax.naming.*;public class DBHelper {
        
        public static Connection getConnection() throws SQLException ,NamingException
        {
            // 初始化查找命名空间
            Context initContext = new InitialContext();
            Context envContext = (Context)initContext.lookup("java:/comp/env");
            // 找到DataSource
            DataSource ds = (DataSource)envContext.lookup("jdbc/mysql");
            return ds.getConnection();
        }}
    呵呵 ,我也是正在做bbs项目
      

  5.   

    解决了 Name jdbc is not bound in this Context"
    又来了 Cannot create JDBC driver of class '' for connect URL 'null'  郁闷 这到底咋回事 。。郁闷。。
    我在 WEB-INF 下加了
       <resource-ref>
        <description>DB Connection</description>
        <res-ref-name>jdbc/bbs</res-ref-name>
        <res-type>javax.sql.DataSource</res-type>
        <res-auth>Container</res-auth>
      </resource-ref>
      可以解决前面的问题
    哎 要不有谁能把完整的Tomcat6.0的 数据库连接池 配置发来
      

  6.   

    把mysql的驱动包,考到Tomcat6.0文件
    lib目录下面,   OK
      

  7.   

    不要用TOMCAT的啊,,,不好啊,我最近也弄这个 ,我觉得proxool配置起来实在是太方便了
    Connection conn = null;Class.forName("org.logicalcobwebs.proxool.ProxoolDriver");conn = DriverManager.getConnection("proxool.example1:org.gjt.mm.mysql.Driver:jdbc:mysql://localhost:3306/test1","root","111111");
    就改这么点东西就行了,驱动改成他这个,然后把MYSQL或者是要用的数据库的驱动写到getConnection里的proxool.example1:后面proxool.example1:中的example1是连接池的名字,你可以按照你的需求改http://proxool.sourceforge.net/这个是proxool的网址我测试过了用了这个连接池,本地测试啊链接100次用了1.7秒不用连接池33秒左右用连接池1000次 6秒多不用连接池。。我没敢测
      

  8.   

    将资源配置写在GlobalNamingResources下:
    <Resource name="jdbc/bbs"     
              auth="Container" type="javax.sql.DataSource"
              driverClassName="com.mysql.jdbc.Driver"
              maxIdle="20"
              maxWait="5000"
              username="root"
              password="admin"
              url="jdbc:mysql://localhost:3306/bbs"     
              maxActive="100" 
              removeAbandoned="true"
              removeAbandonedTimeout="60"
              logAbandoned="true"/> 在Context下写:
    <ResourceLink name="jdbc/bbs" global="jdbc/bbs" type="javax.sql.DataSource"/> 再调用即可
      

  9.   

    context.xml
    <Resource 
    name="jdbc/mysql"  
    type="javax.sql.DataSource" 
    driverClassName="sun.jdbc.odbc.JdbcOdbcDriver"
    url="jdbc:mysql://localhost:3306/qq" 
    username="root" 
    password="111111" 
    maxActive="50"  
    maxIdle="10"  
    maxWait="10000" 
    removeAbandonedTimeout="5"/>
    web.xml
    <resource-ref>
    <description>DB Connection</description>
    <res-ref-name>jdbc/mysql></res-ref-name>
    <res-type>javax.sql.DataSource</res-type>
    <res-auth>Container</res-auth>
    </resource-ref>
      

  10.   

    你最好是重新装一次tomcat6.0,因为改了配置文件后可能会把它破坏了,我就是重装后然后就ok了,O(∩_∩)O~