[hibernate-issues] [Hibernate-JIRA] Issue Comment Edited: (HHH-7012) Jndi lookup doesn't found datasource with tomcat

Jeff Cyre (JIRA) noreply at atlassian.com
Mon Feb 27 13:35:48 EST 2012


    [ https://hibernate.onjira.com/browse/HHH-7012?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=45716#comment-45716 ] 

Jeff Cyre edited comment on HHH-7012 at 2/27/12 12:34 PM:
----------------------------------------------------------

There is a line of code in org.hinbernate.service.jndi.internal.JndiServiceImpl.locate(String jndiName).  The line is <code>return initialContext.lookup( name );</code>

Change it to 
{code:borderStyle=solid}
return initialContext.lookup( nametoString() );
{code}

I use Tomcat 6.0 and this solved it for me.  This is essentially how previous version of Hibernate did it.

      was (Author: jwcyre):
    There is a line of code in org.hinbernate.service.jndi.internal.JndiServiceImpl.locate(String jndiName).  The line is <code>return initialContext.lookup( name );</code>

Change it to <code>return initialContext.lookup( nametoString() );</code>

I use Tomcat 6.0 and this solved it for me.  This is essentially how previous version of Hibernate did it.
  
> Jndi lookup doesn't found datasource with tomcat
> ------------------------------------------------
>
>                 Key: HHH-7012
>                 URL: https://hibernate.onjira.com/browse/HHH-7012
>             Project: Hibernate ORM
>          Issue Type: Bug
>    Affects Versions: 4.0.1
>         Environment: oracle 10g, tomcat 7
>            Reporter: Mathevet
>
> I migrate my application from hibernate 3 to 4, but at startup I got an exception that I couldn't get datasource. Seem that InitialContext is empty. I let tomcat manages connection.
> Caused by: org.hibernate.service.jndi.JndiException: Unable to lookup JNDI name [java:comp/env/jdbc/myCompDb]
>    at org.hibernate.service.jndi.internal.JndiServiceImpl.locate(JndiServiceImpl.java:68)
>    at org.hibernate.service.jdbc.connections.internal.DatasourceConnectionProviderImpl.configure(DatasourceConnectionProviderImpl.java:116)
> I ask on forum at:
> https://forum.hibernate.org/viewtopic.php?f=1&t=1013101

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        


More information about the hibernate-issues mailing list