context.xml配置了数据源正常。
服务器重启一次,数据源消失了。
肯定就报错了。。
org.apache.tomcat.dbcp.dbcp.SQLNestedException: Cannot create JDBC driver of class '' for connect URL 'null'org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in ServletContext resource [/WEB-INF/configs/beans-jpa.xml]: Cannot resolve reference to bean 'adDataSource' while setting bean property 'dataSource';忘了是改哪个了
服务器重启一次,数据源消失了。
肯定就报错了。。
org.apache.tomcat.dbcp.dbcp.SQLNestedException: Cannot create JDBC driver of class '' for connect URL 'null'org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in ServletContext resource [/WEB-INF/configs/beans-jpa.xml]: Cannot resolve reference to bean 'adDataSource' while setting bean property 'dataSource';忘了是改哪个了
解决方案 »
- [求救]dotcms中 在Container 里遍历所有Contents 时,怎么没遍历前(Pre Loop)得到Contents的总数量?
- 怎么用Ajax实现jsp页面局部实时刷新(紧急求救,在线等大虾帮忙)
- jsp:include失败求助!
- 如何控制(table)表与表的相对距离
- servlet如何实现include包含页面功能?
- 有哪位大侠知道怎么设置IMail服务器的连接外部数据库的?
- Struts程序员薪水如何?
- JSP返回XML/XSL问题
- 如何使关闭子窗口时将自窗口的session值传到父窗口,但父窗口的除了得到session之外,什么都不变!!??
- 关于Eclipse运行问题
- jsp表单的值到Servlet时,给javabean赋值不成功。
- Property 'usertype' not found on type oracle.jdbc.driver.OracleResultSetImpl的问题
我的意思是TOMCAT里 数据源设置好了,ECLIPSE里启动、应用都没有问题。但是,当重启TOMCAT的时候,
context.xml里边配置的数据源消失了然后才报错。看来我贴的错误信息误导了你们
问题的关键是context.xml里的数据源,tomcat只要一重启就消失,忘了改哪个了。。
数据源配置在context.xml里面啊,比如:
<Resource
auth = "Container"
name = "jdbc/adbDataSource"
type = "javax.sql.DataSource"
driverClassName = "oracle.jdbc.driver.OracleDriver"
url = "jdbc:oracle:thin:@10.xx.xx.xx:1521:xxx"
username = "ad"
password = "adxxx"
maxIdle = "5"
maxWait = "5000"
maxActive = "10"/>然后web.xml <resource-ref>
<description></description>
<res-ref-name>jdbc/adDataSource</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
</resource-ref>
spring配置 <bean id = "adDataSource" class = "org.springframework.jndi.JndiObjectFactoryBean">
<property name = "jndiName" value = "java:comp/env/jdbc/adbDataSource"/>
</bean> <bean id = "adJdbcDao" class = "xx.xx.xx.jdbc.SpringJdbcDao">
<property name = "dataSource" ref = "adDataSource" />
</bean>
不一一贴了。配置好了在ECLIPSE里启动该项目没有问题
但是当重启TOMCAT的时候,context.xml里边配置的数据源]<Resource>消失了。。没有了
auth = "Container"
name = "jdbc/adbDataSource"
type = "javax.sql.DataSource"
driverClassName = "oracle.jdbc.driver.OracleDriver"
url = "jdbc:oracle:thin:@10.xx.xx.xx:1521:xxx"
username = "ad"
password = "adxxx"
maxIdle = "5"
maxWait = "5000"
maxActive = "10"/>
如果是这样,那应该是被覆盖了。