----- Original Message -----

> From: Savitha Akella <savitha.saraswa...@gmail.com>
> To: Tomcat Users List <users@tomcat.apache.org>
> Cc: 
> Sent: Monday, August 29, 2011 10:36 AM
> Subject: Re: Could not find datasource when starting tomcat
> 
> Hi ,
> 
> Usually in the "resource" tag , we define the name parameter as below:
> 
> name="jndi/dbName"
> 
> Make this change and hopefully it should work.
> 
> Thanks
> 
> On Mon, Aug 29, 2011 at 10:20 AM, Alaeddine HAOUAS <
> a.hao...@nouvellemarque.com> wrote:
> 
>>  Hi,
>> 
>> 
>> 
>>  I try to "backup" a java 1.5 web application with servlet/JSP 
> using
>>  tomcat-6.0.20.
>> 
>> 
>> 
>>  I am having the following error when starting my tomcat in Eclipse (sysdeo
>>  plugin v3.2.1) :
>> 
>> 
>> 
>>  FATAL [main] DatasourceConnectionProvider:47 - Could not find datasource:
>>  dbName
>> 
>>  javax.naming.NameNotFoundException
>> 
>> 
>> 
>> 
>> 
>>  I have read the Context Container documentation to make a correct context
>>  file. I added a context file 'proto.xml' in 
> conf\catalina\localhost. The
>>  file content :
>> 
>> 
>> 
>>  <Context reloadable="true"
>> 
> docBase="C:\eclipse\workspace-intranet\sadeteProto\web"
>> 
> workDir="C:\eclipse\workspace-intranet\sadeteProto\work" 
>> 
>> 
>> 
>> 
>>     <Environment name="server.name"                
> type="java.lang.String"
>>  value="xxxxx" />
>> 
>>     <Environment name="jdbc.prefix"                
> type="java.lang.String"
>>  value="" />
>> 
>> 
>> 
>> 
>> 
>>                 <Resource name="dbName" 
> auth="Container"
>>  type="javax.sql.DataSource"
>> 
>>     driverClassName="com.microsoft.sqlserver.jdbc.SQLServerDriver"
>> 
>> 
>> 
>> 
> url="jdbc:sqlserver://xxx.xx.xx.xxx:1433?database=DB_copie&autoReconnect
>>  =true"
>> 
>>     username="User_DB"
>> 
>>     password="xxx" />
>> 
>> 
>> 
>>  </Context>
>> 
>> 
>> 
>> 
>> 
>>  In the hibernate config file I have the following property :
>> 
>>  <property 
> name="connection.datasource">dbName</property>
>> 
>> 
>> 
>> 
>> 
>>  Any idea how to make the datasource visible for my application ?
>> 
>> 
>> 
>>  Thanks
>> 
>> 
>> 
>> 
>> 
>>  Alaeddine
>> 
>> 
>> 
>> 
>

Read the following Wiki entry: http://wiki.apache.org/tomcat/TomcatHibernate

In particular, pay attention to:

<!-- using container-managed JNDI -->
<propertyname="hibernate.connection.datasource">
   java:comp/env/jdbc/sakila
</property>

in hibernate.cfg.xml.

Change jdbc/sakila as appropriate for your application.

. . . . just my two cents.
/mde/

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

Reply via email to