求大神讲下出现这个异常的各种情况。我先说明一下我的情况。1,我现在在做一个关于论坛的项目。
2,我用的是连接SQL数据库。
3,我配置了tomcat的contex的文件。
我把我配置的文件,以及自己的理解发到如下:<Resource name="jdbc/bookdb" -- 数据库名字
type="javax.sql.DataSource" 
username="root"  --用户名
password="root" --密码
driverClassName="com.mysql.jdbc.Driver"
url="jdbc:mysql://localhost:3306/bookdb"
maxActive="8"
maxIdle="4"/>求大神详细说下,如还要哪些文件,我再补上。谢啦!

解决方案 »

  1.   

    这里配置好像没问题,应该在你程序里调用的地方有问题.
    这个错误查看堆栈,点到对应的类,错误在那.
    获得 Context 对象的地方
      

  2.   


    <?xml version="1.0" encoding="UTF-8"?>
    <beans xmlns="http://www.springframework.org/schema/beans"
    xmlns:context="http://www.springframework.org/schema/context"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:schemaLocation="
        http://www.springframework.org/schema/beans 
        http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
        http://www.springframework.org/schema/context
        http://www.springframework.org/schema/context/spring-context-2.5.xsd
        ">
    <bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
    <property name="locations">
    <value>classpath:jdbc.properties</value>
    </property>
    </bean>     
        
    <bean name="dataSource" class="org.apache.commons.dbcp.BasicDataSource">
    <property name="driverClassName">
    <value>oracle.jdbc.driver.OracleDriver</value>
    </property>
    <property name="url">
    <value>jdbc:oracle:thin:@localhost:1521:xe</value>
    </property>
    <property name="username">
    <value>${username}</value>
    </property>
    <property name="password">
    <value>briup</value>
    </property>
    </bean>


    </beans>