main net.sf.hibernate.connection.DatasourceConnectionProvider -[FATAL] -Could not find datasource: java:comp/env/jdbc/sysuser
javax.naming.NamingException: Cannot create resource instance
这是我hibernate中的部分配置:
<session-factory>
<property name="hibernate.jdbc.batch_size">5</property>
<property name="connection.datasource">java:comp/env/jdbc/sysuser</property>
<property name="testConnectionOnCheckin">true</property>
<property name="idleConnectionTestPeriod">60</property>
这是TOMCAT中的配置conf>localhost:
<?xml version="1.0" encoding="utf-8" ?>
<Context docBase="F:\TechMonProject\WebRoot" path="/TechMonProject" debug="0" privileged="true">
<Resource name="jdbc/sysuser" auth="Container" type="com.mchange.v2.c3p0.ComboPooledDataSource"/>
<ResourceParams name="jdbc/sysuser">
<parameter>
<name>factory</name>
<value>org.apache.naming.factory.BeanFactory</value>
</parameter>
<!-- C3P0 database connection settings -->
<parameter>
<name>driverClass</name>
<value>oracle.jdbc.driver.OracleDriver</value>
</parameter>
<parameter>
<name>jdbcUrl</name>
<value>jdbc:oracle:thin:@localhost:1521:yy</value>
</parameter>
<parameter>
<name>user</name>
<value>sysuser</value>
</parameter>
<parameter>
<name>password</name>
<value>itsm0718</value>
</parameter>
<!-- DBCP connection pooling options -->
<parameter>
<name>minPoolSize</name>
<value>5</value>
</parameter>
<parameter>
<name>maxPoolSize</name>
<value>40</value>
</parameter>
<parameter>
<name>acquireIncrement</name>
<value>2</value>
</parameter>
</ResourceParams>
<Resource name="jdbc/msuser" auth="Container" type="com.mchange.v2.c3p0.ComboPooledDataSource"/>
<ResourceParams name="jdbc/msuser">
<parameter>
<name>factory</name>
<value>org.apache.naming.factory.BeanFactory</value>
</parameter>
<parameter>
<name>driverClass</name>
<value>oracle.jdbc.driver.OracleDriver</value>
</parameter>
<parameter>
<name>jdbcUrl</name>
<value>jdbc:oracle:thin:@localhost:1521:yy</value>
</parameter>
<parameter>
<name>user</name>
<value>msuser</value>
</parameter>
<parameter>
<name>password</name>
<value>itsm0718</value>
</parameter>
<parameter>
<name>minPoolSize</name>
<value>1</value>
</parameter>
<parameter>
<name>maxPoolSize</name>
<value>10</value>