Seems no JNDI reference is found. Hibernate should output the reference
used in the log (at least in 3.1/3.2 - what version are you using?).
  log.fatal( "Could not find datasource: " + jndiName, e );

Have you tried prepending the properties with "hibernate."? That is
  <property
name="hibernate.connection.datasource">java:comp/env/jdbc/RO_DS1</property>

 /Mattias

Guru wrote (2007-12-03 21:24):
> This is the stack trace, there is no data source name printed here. In
> my earlier logs I could see the data source name used "INFO -- Using
> datasource: java:comp/env/jdbc/RO_DS1".
>
> 03 Dec 2007 11:51:13 -- INFO -- JNDI InitialContext properties:{}
> 03 Dec 2007 11:51:13 -- FATAL -- Could not find datasource:
> java.lang.ClassCastException: com.caucho.naming.ContextImpl
>     at
> org.hibernate.connection.DatasourceConnectionProvider.configure(DatasourceConnectionProvider.java
> :52)
>     at
> org.hibernate.connection.ConnectionProviderFactory.newConnectionProvider(ConnectionProviderFactory.java:124)
>     at
> org.hibernate.connection.ConnectionProviderFactory.newConnectionProvider(ConnectionProviderFactory.java
> :56)
>     at
> org.hibernate.cfg.SettingsFactory.createConnectionProvider(SettingsFactory.java:385)
>     at
> org.hibernate.cfg.SettingsFactory.buildSettings(SettingsFactory.java:61)
>     at org.hibernate.cfg.Configuration.buildSettings
> (Configuration.java:1928)
>     at
> org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1211)
>     at
> com.thc.common.util.HibernateFactory.currentSession(HibernateFactory.java:38)
>     at com.thc.common.pages.BasePageDAO.find (BasePageDAO.java:68)
>     at
> com.thc.home.pages.HomePageDAO.findHomeSchedule(HomePageDAO.java:45)
>     at com.thc.home.pages.HomeAction.executeLogic(HomeAction.java:40)
>     at com.thc.common.pages.BaseAction.execute (BaseAction.java:130)
>     at
> org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:484)
>     at
> org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:274)
>     at org.apache.struts.action.ActionServlet.process
> (ActionServlet.java:1482)
>     at
> org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:507)
>     at javax.servlet.http.HttpServlet.service(HttpServlet.java:115)
>     at javax.servlet.http.HttpServlet.service (HttpServlet.java:92)
>     at
> com.caucho.server.dispatch.ServletFilterChain.doFilter(ServletFilterChain.java:99)
>     at
> com.caucho.server.webapp.WebAppFilterChain.doFilter(WebAppFilterChain.java:163)
>     at com.caucho.server.dispatch.ServletInvocation.service
> (ServletInvocation.java:208)
>     at
> com.caucho.server.http.HttpRequest.handleRequest(HttpRequest.java:259)
>     at com.caucho.server.port.TcpConnection.run(TcpConnection.java:363)
>     at com.caucho.util.ThreadPool.runTasks (ThreadPool.java:490)
>     at com.caucho.util.ThreadPool.run(ThreadPool.java:423)
>     at java.lang.Thread.run(Unknown Source)
>
>
> On Dec 3, 2007 3:08 PM, Mattias Jiderhamn < [EMAIL PROTECTED]
> <mailto:[EMAIL PROTECTED]>> wrote:
>
>     Look in the Hibernate log for "Could not find datasource" (fatal
>     level) and you'll see what reference is actually used.
>     If you have info-level, also look for "JNDI InitialContext
>     properties" and post here.
>
>      /Mattias
>
>     Guru wrote (2007-12-03 20:53):
>>     Hi,
>>
>>     I have tried this also. But no luck.
>>
>>
>>
>>     On Dec 3, 2007 12:08 PM, Shane Cruz <[EMAIL PROTECTED]
>>     <mailto:[EMAIL PROTECTED]>> wrote:
>>
>>         Can you try?:
>>
>>          
>>
>>         <property name="connection.datasource">jdbc/RO_DS1</property>
>>
>>          
>>
>>         
>> ------------------------------------------------------------------------
>>
>>         *From:* [EMAIL PROTECTED]
>>         <mailto:[EMAIL PROTECTED]>
>>         [mailto:[EMAIL PROTECTED]
>>         <mailto:[EMAIL PROTECTED]>] *On Behalf Of *Guru
>>         *Sent:* Monday, December 03, 2007 10:39 AM
>>         *To:* General Discussion for the Resin application server
>>         *Subject:* Re: [Resin-interest] Could not find datasource
>>
>>          
>>
>>         Hi,
>>
>>         Thanks for you immediate response. My hibernate config is as
>>         follows.
>>
>>                 <property
>>         name="connection.datasource">java:comp/env/jdbc/RO_DS1</property>
>>                 <property name="dialect">
>>         org.hibernate.dialect.Oracle9Dialect</property>
>>                 <property
>>         name="myeclipse.connection.profile">dev-local</property>
>>                 <property name="show_sql">true</property>
>>                 <property name="format_sql">true</property>
>>                 <property
>>         
>> name="cache.provider_class">org.hibernate.cache.EhCacheProvider</property>
>>                 <property name="generate_statistics">true</property>
>>
>>         Which is referring to the datasource created in resin.conf.
>>         Please let me know is there any other reason for the class
>>         cast exception.
>>
>>         Thanks,
>>         KG
>>
>>
>>         On Dec 3, 2007 11:31 AM, Mattias Jiderhamn <
>>         [EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]>>
>>         wrote:
>>
>>         You should probably check your Hibernate configuration. It
>>         seems you are not providing the JDNI reference to the actual
>>         DataSource.
>>
>>          /Mattias
>>
>>         Guru wrote (2007-12-03 17:18):
>>
>>>         Hi,
>>>
>>>         I am trying to connect to Oracle 10g using Resin 3.0.14. My
>>>         jdk version is 1.5.0.13 <http://1.5.0.13>. I am getting the
>>>         following error while trying to lookup the datasource
>>>         configured in resin.conf.
>>>
>>>         Caused by: org.hibernate.HibernateException: Could not find
>>>         datasource at
>>>         
>>> org.hibernate.connection.DatasourceConnectionProvider.configure(DatasourceConnectionProvider.java:56)
>>>         at
>>>         
>>> org.hibernate.connection.ConnectionProviderFactory.newConnectionProvider(ConnectionProviderFactory.java:124)
>>>         at
>>>         
>>> org.hibernate.connection.ConnectionProviderFactory.newConnectionProvider(ConnectionProviderFactory.java:56)
>>>         at
>>>         
>>> org.hibernate.cfg.SettingsFactory.createConnectionProvider(SettingsFactory.java:385)
>>>         at
>>>         
>>> org.hibernate.cfg.SettingsFactory.buildSettings(SettingsFactory.java:61)
>>>         at
>>>         
>>> org.hibernate.cfg.Configuration.buildSettings(Configuration.java:1928)
>>>         at
>>>         
>>> org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1211)
>>>         at
>>>         
>>> com.thc.common.util.HibernateFactory.currentSession(HibernateFactory.java:38)
>>>         ... 18 more
>>>
>>>         *Caused by: java.lang.ClassCastException:
>>>         com.caucho.naming.ContextImpl at
>>>         
>>> org.hibernate.connection.DatasourceConnectionProvider.configure(DatasourceConnectionProvider.java:52)
>>>         ... 25 more *
>>>
>>>         My database configuration in resin.conf is,
>>>
>>>             <database>
>>>                 <jndi-name>jdbc/RO_DS1</jndi-name>
>>>                 <driver>
>>>                        
>>>         <type>oracle.jdbc.pool.OracleConnectionPoolDataSource </type>
>>>                        
>>>         <url>jdbc:oracle:thin:@localhost:1521:xxxxx</url>
>>>                         <user>username</user>
>>>                         <password>password</password>
>>>                 </driver>
>>>                         <max-connections>20</max-connections>
>>>                         <max-idle-time>30</max-idle-time>
>>>                         <max-active-time>6</max-active-time>
>>>                         <max-pool-time>24</max-pool-time>
>>>                         <connection-wait-time>30</connection-wait-time>
>>>                         <ping-table>dual</ping-table>
>>>                         <spy>false</spy>
>>>             </database>
>>>
>>>         Any help in this regard is greatly appreciated.
>>>
>>>
>>>         Thanks,
>>>         KG
>>>

_______________________________________________
resin-interest mailing list
resin-interest@caucho.com
http://maillist.caucho.com/mailman/listinfo/resin-interest

Reply via email to