title: org.hibernate.HibernateException: Could not find datasource
body: <p>I am using JPA with Hibernate implementation and i have created a datasource in websphere server. I am trying to access this datasource in my JPA application. But, when i try to access , i am getting the below exception . Please help me out if you have come across such situation. Thanks</p>
  
  <p>org.hibernate.HibernateException: Could not find datasource
  Caused by: 
  javax.naming.NameNotFoundException: Name comp/env/jdbc not found in context "java:".</p>
  
  <p>Please find the below details:
  Datasource Name: pieportaldev_0
  JNDI Name: pie/logDB 
  And my Persistance.xml is </p>
  
  <p>
  http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd" version="1.0"></p>
  
  <p></p>
  
  <pre><code>&lt;provider&gt;org.hibernate.ejb.HibernatePersistence&lt;/provider&gt;
  &lt;!-- the JNDI data source --&gt;
  &lt;jta-data-source&gt;java:comp/env/jdbc/pieportaldev_0&lt;/jta-data-source&gt;
  &lt;class&gt;com.test.jpa.UserInfo&lt;/class&gt;
  &lt;properties&gt;
    &lt;!-- if this is true, hibernate will print (to stdout) the SQL it executes, so you can check it to ensure it's not doing anything crazy --&gt;
   &lt;!--  &lt;property name="hibernate.show_sql" value="true" /&gt; --&gt;
    &lt;property name="hibernate.format_sql" value="true" /&gt;
    &lt;!-- since most database servers have slightly different versions of the SQL, Hibernate needs you to choose a dialect so it knows the subtleties of talking 
      to that server --&gt;
    &lt;property name="hibernate.dialect" value="org.hibernate.dialect.OracleDialect" /&gt;
    &lt;!-- this tell Hibernate to update the DDL when it starts, very useful for development, dangerous in production --&gt;
    &lt;property name="hibernate.hbm2ddl.auto" value="update" /&gt;
  &lt;/properties&gt;
  </code></pre>
  
  <p>
  </p>