here is the name you specify

<res-ref-name>jdbc/my_jdbc_name</res-ref-name>

and here is your error
Could not find datasource:jdbc/workout_logger

as you can see, somewhere you have configured the string workout_logger, and that one doesn't exist

Filip

arturoguedez wrote:
Hi!

I have been reading how to setup datasources for Tomcat 6.0.18 in
http://tomcat.apache.org/tomcat-6.0-doc/jndi-datasource-examples-howto.html
and nothing I have done has allowed my web application to view the
datasource i have created.

Here are some snippets of my web.xml, and my server.xml
In the web.xml

<resource-ref>
        <description>DB Connection</description>
        <res-ref-name>jdbc/my_jdbc_name</res-ref-name>
        <res-type>javax.sql.DataSource</res-type>
        <res-auth>Container</res-auth>
</resource-ref>

In server.xml
I have tried to place the following snip it anywhere I saw in the docs it
could belong to (ei, in the GlobalNamingResources, inside the Host tag, or
inside the Context tag in all possible locations (under
META-INF/context.xml, under $CATALINA_BASE/conf/[engine]/[host]/[path].xml)
and I haven't been successful.

 <Resource name="jdbc/my_jdbc_name" auth="Container"
type="javax.sql.DataSource"
               maxActive="100" maxIdle="30" maxWait="10000"
               username="user" password="password"
driverClassName="com.mysql.jdbc.Driver"
url="jdbc:mysql://localhost:3306/database_name?autoReconnect=true"/>


I am using Entity Managers to get my connections opened, here is the snip it
of my persistence.xml

       <persistence-unit name="my_pu_name"
transaction-type="RESOURCE_LOCAL">
                <non-jta-data-source>jdbc/my_jdbc_name</non-jta-data-source>
        </persistence-unit>

Here is what I get in my tomcat logs:

08/12/21 17:32:17 ERROR ceConnectionProvider: Could not find datasource:
jdbc/workout_logger
javax.naming.NameNotFoundException: Name jdbc is 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(InitialContext.java:392)
        at
org.hibernate.connection.DatasourceConnectionProvider.configure(DatasourceConnectionProvider.java:75)
        at
org.hibernate.connection.ConnectionProviderFactory.newConnectionProvider(ConnectionProviderFactory.java:137)
        at
org.hibernate.ejb.InjectionSettingsFactory.createConnectionProvider(InjectionSettingsFactory.java:29)
        at 
org.hibernate.cfg.SettingsFactory.buildSettings(SettingsFactory.java:89)
        at 
org.hibernate.cfg.Configuration.buildSettings(Configuration.java:2101)
        at
org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1325)
        at
org.hibernate.cfg.AnnotationConfiguration.buildSessionFactory(AnnotationConfiguration.java:867)
        at
org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:669)
        at
org.hibernate.ejb.HibernatePersistence.createEntityManagerFactory(HibernatePersistence.java:126)
        at
javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:52)
....



Does anybody know what I am doing wrong? Is there any way to check which
resources Tomcat makes avaiable? I am having a really hard time
understanding what I am doing wrong.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org

Reply via email to