Sorry,  pretty new to hibernate/tomcat.
I would like to use tomcat's connection pooling for my hibernate project.  I first got the project working with a direct connect to the db, but when I try to switch to tomcat connection pooling and use a data source (yes, I deployed it to tomcat), I keep getting a "datasource not found".   Can somebody please let me know what I'm doing wrong?  I have looked at the forums and googled for help for the entire day!  Just can't get it to work!
Thanks for any help!!!
Tomcat v5.5
hibernate v3.6
First I added a resource to the tomcat/conf/context.xml file:
Code:
<Resource name="app1/DB" auth="Container"
        type="javax.sql.DataSource" 
        driverClassName="com.informix.jdbc.IfxDriver"
        username="usr1" password="usr1"
        url="jdbc:informix-sqli://us:9999/mydb:INFORMIXSERVER=testtcp1;dbdate=MDY4"
        validationQuery="select first 1 type from animals"
        defaultAutoCommit="false"
        maxActive="10" maxIdle="5" maxWait="1000"
        removeAbandoned="true" removeAbandonedTimeout="300" logAbandoned="true"/>
I then configured the persistence.xml file as follows:
Code:
<?xml version="1.0" encoding="UTF-8"?>
<persistence version="2.0" xmlns="http://java.sun.com/xml/ns/persistence">
   <persistence-unit name="HibernateTest" transaction-type="RESOURCE_LOCAL">
      <provider>org.hibernate.ejb.HibernatePersistence</provider>
      
      <class>jpa.common.Class1</class>
   
      <properties>
         <property name="hibernate.connection.datasource" value="app1/DB" />
      </properties>
   </persistence-unit>
</persistence>
And finally, the file I use to get the data:
Code:
public class MyService
{
   public static EntityManagerFactory emf = Persistence.createEntityManagerFactory("HibernateTest");
   public static EntityManager em;
   
   public List<Class1> getClass1(int type)
   {
      em =  emf.createEntityManager();
      
      em.getTransaction().begin();
      String classQuery="select c from Class1 c where c.type = :type";
      Query q = em.createQuery(classQuery);
      q.setParameter("type", type);
      
      @SuppressWarnings("unchecked")
      List<Class1> classs = q.getResultList();
   }
The Error I'm getting is:
Code:
610 [TP-Processor2] INFO org.hibernate.util.NamingHelper - JNDI InitialContext properties:{}
610 [TP-Processor2] ERROR org.hibernate.connection.DatasourceConnectionProvider - Could not find datasource: app1/DB
javax.naming.NameNotFoundException: Name app1is not bound in this Context
    at org.apache.naming.NamingContext.lookup(NamingContext.java:770)
    at org.apache.naming.NamingContext.lookup(NamingContext.java:153)
    at org.apache.naming.SelectorContext.lookup(SelectorContext.java:137)
    at javax.naming.InitialContext.lookup(Unknown Source)
    at org.hibernate.connection.DatasourceConnectionProvider.configure(DatasourceConnectionProvider.java:75)
    at org.hibernate.connection.ConnectionProviderFactory.newConnectionProvider(ConnectionProviderFactory.java:143)
    at org.hibernate.ejb.InjectionSettingsFactory.createConnectionProvider(InjectionSettingsFactory.java:51)
    at org.hibernate.cfg.SettingsFactory.buildSettings(SettingsFactory.java:91)
    at org.hibernate.cfg.Configuration.buildSettingsInternal(Configuration.java:2833)
    at org.hibernate.cfg.Configuration.buildSettings(Configuration.java:2829)
    at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1840)
    at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:902)
    at org.hibernate.ejb.HibernatePersistence.createEntityManagerFactory(HibernatePersistence.java:57)
    at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:48)
    at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:32)