I've only ever used the explicit path configure method, but I'm pretty sure you are correct that cfg file default path is WEB-INF/classes.
At the risk of stating the obvious, the property tags you quoted should be contained inside session-factory tags of the hibernate.cfg.xml file.
Code:
<?xml version='1.0' encoding='utf-8'?>
<hibernate-configuration>
<session-factory>
<property name="connection.data_source">java:comp/env/jdbc/foundationsDS</property>
<property name="dialect">org.hibernate.dialect.Oracle9Dialect</property>
<property name="connection.driver_class">JdbcOraWrapperDriver</property>
<property name="show_sql">true</property>
</session-factory>
</hibernate-configuration>
You may also need to give the full package name for the driver.
While it's not necessary to instantiate the DataSource object from your setup class, you could do it anyway just for a sanity check:
Code:
InitialContext ctx = new InitialContext();
DataSource ds = (DataSource)ctx.lookup("java:comp/env/jdbc/foundationsDS");
Connection connection = ds.getConnection();
java.sql.Statement statement = connection.createStatement();
ResultSet resultset=statement.executeQuery("SELECT sysdate FROM dual");
if (resultset.next()) out.println("Here is a query result of sysdate from dual: " + resultset.getString(1) + "<BR>");
resultset.close();
connection.close();
In any case you should check your tomcat logs for entries like:
Jul 14, 2006 6:10:12 PM org.apache.coyote.http11.Http11Protocol init
INFO: Initializing Coyote HTTP/1.1 on http-8080
Jul 14, 2006 6:10:12 PM org.apache.catalina.startup.Catalina load
INFO: Initialization processed in 1141 ms
Jul 14, 2006 6:10:12 PM org.apache.catalina.core.StandardService start
INFO: Starting service Catalina
Jul 14, 2006 6:10:13 PM org.apache.catalina.core.StandardEngine start
INFO: Starting Servlet Engine: Apache Tomcat/5.5.9
Jul 14, 2006 6:10:13 PM org.apache.catalina.core.StandardHost start
INFO: XML validation disabled
Jul 14, 2006 6:10:16 PM org.apache.catalina.session.PersistentManagerBase start
SEVERE: No Store configured, persistence disabled
Jul 14, 2006 6:10:17 PM org.hibernate.cfg.Environment <clinit>
INFO: Hibernate 3.0.3
Jul 14, 2006 6:10:17 PM org.hibernate.cfg.Environment <clinit>
INFO: hibernate.properties not found
Jul 14, 2006 6:10:17 PM org.hibernate.cfg.Environment <clinit>
INFO: using CGLIB reflection optimizer
Jul 14, 2006 6:10:17 PM org.hibernate.cfg.Environment <clinit>
INFO: using JDK 1.4 java.sql.Timestamp handling
.
.
.
Jul 14, 2006 6:10:41 PM org.hibernate.util.NamingHelper getInitialContext
INFO: JNDI InitialContext properties:{}
Jul 14, 2006 6:10:41 PM org.hibernate.connection.DatasourceConnectionProvider configure
INFO: Using datasource: java:comp/env/jdbc/<yourDSName>
Jul 14, 2006 6:10:41 PM org.hibernate.cfg.SettingsFactory buildSettings
INFO: RDBMS:
<Your DB info>
Jul 14, 2006 6:10:41 PM org.hibernate.cfg.SettingsFactory buildSettings
INFO: JDBC driver:
<Your JDBC driver info>
Jul 14, 2006 6:10:41 PM org.hibernate.dialect.Dialect <init>
INFO: Using dialect: org.hibernate.dialect.OracleDialect
Jul 14, 2006 6:10:41 PM org.hibernate.transaction.TransactionFactoryFactory buildTransactionFactory
INFO: Using default transaction strategy (direct JDBC transactions)
Jul 14, 2006 6:10:41 PM org.hibernate.transaction.TransactionManagerLookupFactory getTransactionManagerLookup
INFO: No TransactionManagerLookup configured (in JTA environment, use of read-write or transactional second-level cache is not recommended)
Jul 14, 2006 6:10:41 PM org.hibernate.cfg.SettingsFactory buildSettings
INFO: Automatic flush during beforeCompletion(): disabled
Jul 14, 2006 6:10:41 PM org.hibernate.cfg.SettingsFactory buildSettings
INFO: Automatic session close at end of transaction: disabled
Jul 14, 2006 6:10:41 PM org.hibernate.cfg.SettingsFactory buildSettings
INFO: JDBC batch size: 15
Jul 14, 2006 6:10:41 PM org.hibernate.cfg.SettingsFactory buildSettings
INFO: JDBC batch updates for versioned data: disabled
Jul 14, 2006 6:10:42 PM org.hibernate.cfg.SettingsFactory buildSettings
INFO: Scrollable result sets: enabled
Jul 14, 2006 6:10:42 PM org.hibernate.cfg.SettingsFactory buildSettings
INFO: JDBC3 getGeneratedKeys(): disabled
Jul 14, 2006 6:10:42 PM org.hibernate.cfg.SettingsFactory buildSettings
INFO: Connection release mode: null
Jul 14, 2006 6:10:42 PM org.hibernate.cfg.SettingsFactory buildSettings
INFO: Maximum outer join fetch depth: 0
Jul 14, 2006 6:10:42 PM org.hibernate.cfg.SettingsFactory buildSettings
INFO: Default batch fetch size: 1
Jul 14, 2006 6:10:42 PM org.hibernate.cfg.SettingsFactory buildSettings
INFO: Generate SQL with comments: disabled
Jul 14, 2006 6:10:42 PM org.hibernate.cfg.SettingsFactory buildSettings
INFO: Order SQL updates by primary key: disabled
Jul 14, 2006 6:10:42 PM org.hibernate.cfg.SettingsFactory createQueryTranslatorFactory
INFO: Query translator: org.hibernate.hql.ast.ASTQueryTranslatorFactory
Jul 14, 2006 6:10:42 PM org.hibernate.hql.ast.ASTQueryTranslatorFactory <init>
INFO: Using ASTQueryTranslatorFactory
Jul 14, 2006 6:10:42 PM org.hibernate.cfg.SettingsFactory buildSettings
INFO: Query language substitutions: {}
Jul 14, 2006 6:10:42 PM org.hibernate.cfg.SettingsFactory buildSettings
INFO: Second-level cache: enabled
Jul 14, 2006 6:10:42 PM org.hibernate.cfg.SettingsFactory buildSettings
INFO: Query cache: enabled
Jul 14, 2006 6:10:42 PM org.hibernate.cfg.SettingsFactory createCacheProvider
INFO: Cache provider: org.hibernate.cache.EhCacheProvider
Jul 14, 2006 6:10:42 PM org.hibernate.cfg.SettingsFactory buildSettings
INFO: Optimize cache for minimal puts: disabled
Jul 14, 2006 6:10:42 PM org.hibernate.cfg.SettingsFactory buildSettings
INFO: Structured second-level cache entries: enabled
Jul 14, 2006 6:10:42 PM org.hibernate.cfg.SettingsFactory createQueryCacheFactory
INFO: Query cache factory: org.hibernate.cache.StandardQueryCacheFactory
Jul 14, 2006 6:10:42 PM org.hibernate.cfg.SettingsFactory buildSettings
INFO: Echoing all SQL to stdout
Jul 14, 2006 6:10:42 PM org.hibernate.cfg.SettingsFactory buildSettings
INFO: Statistics: enabled
Jul 14, 2006 6:10:42 PM org.hibernate.cfg.SettingsFactory buildSettings
INFO: Deleted entity synthetic identifier rollback: disabled
Jul 14, 2006 6:10:42 PM org.hibernate.cfg.SettingsFactory buildSettings
INFO: Default entity-mode: pojo
Jul 14, 2006 6:10:42 PM org.hibernate.impl.SessionFactoryImpl <init>
INFO: building session factory
Jul 14, 2006 6:10:42 PM org.hibernate.cache.CacheFactory createCache
.
.
.
Jul 14, 2006 6:10:53 PM org.hibernate.cache.UpdateTimestampsCache <init>
INFO: starting update timestamps cache at region: org.hibernate.cache.UpdateTimestampsCache
Jul 14, 2006 6:10:53 PM org.hibernate.cache.StandardQueryCache <init>
INFO: starting query cache at region: org.hibernate.cache.StandardQueryCache
Jul 14, 2006 6:10:53 PM org.hibernate.impl.SessionFactoryImpl checkNamedQueries
INFO: Checking 0 named queries
Jul 14, 2006 6:10:53 PM org.apache.catalina.core.StandardHost start
INFO: XML validation disabled
Jul 14, 2006 6:10:53 PM org.apache.coyote.http11.Http11Protocol start
INFO: Starting Coyote HTTP/1.1 on http-8080
Jul 14, 2006 6:10:53 PM org.apache.jk.common.ChannelSocket init
INFO: JK: ajp13 listening on /0.0.0.0:8009
Jul 14, 2006 6:10:53 PM org.apache.jk.server.JkMain start
INFO: Jk running ID=0 time=0/63 config=null
Jul 14, 2006 6:10:53 PM org.apache.catalina.startup.Catalina start
INFO: Server startup in 40828 ms
The logs should have at least some info that hibernate is starting up...otherwise your config is not set up properly.