Can't get PersistenceUnit to work

Hi all,
I am setting up the Netbeans 6.0 IDE with JSF1.2, Tomcat 6.0 and Hibernate through JPA. I am newbie on JavaEE though not on JavaSE and Netbeans. However I am having painfully difficulties in making some tests and trials, to gain deeper knowledge of the technologies involved in such JavaEE applications.
My problem is that can't create an EntityManager, because Hibernae doesn't locate de data source.
Any guide point is highly appreciated. Many thanks for your help.
My context.xml and persistence.xml are as follows:
Exception:
++Caused by: org.hibernate.HibernateException: Could not find datasource++
++at org.hibernate.connection.DatasourceConnectionProvider.configure(DatasourceConnectionProvider.java:56)++
<---- context.xml ---->
<?xml version="1.0" encoding="UTF-8"?>
<Context path="/EnsayoJavaServerFaces">
<Resource auth="Container" driverClassName="com.mysql.jdbc.Driver" maxActive="20" maxIdle="10" maxWait="-1" name="coreba" password="" type="javax.sql.DataSource" url="jdbc:mysql://localhost:3306/coreba2" username="root"/>
</Context>
<---- ------------>
and
<------- persistence.xml ----------->
<?xml version="1.0" encoding="UTF-8"?>
<persistence version="1.0" xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd">
<persistence-unit name="EnsayoJavaServerFacesPU" transaction-type="JTA">
<provider>org.hibernate.ejb.HibernatePersistence</provider>
<jta-data-source>coreba</jta-data-source>
<properties>
<property name="hibernate.hbm2ddl.auto" value="update"/>
</properties>
</persistence-unit>
</persistence>
<-- -->

Well in fact it is a bit more basic than that....
I tried the examples with InitialContext and didn't work, such as...
            Context context = new InitialContext();
            Context envCtx = (Context) context.lookup("java:/comp/env");
            Hashtable ht  = envCtx.getEnvironment();
            DataSource ds = (DataSource) envCtx.lookup("java:comp/env/jdbc/Coreba");the way I saw the datasource was correct, was creating a jsp page (without faces) as a test, extracted from one of the links you sent me...
this doesn't make much sense to me... i can't figure out what i am missing...
Following the content of the testDataSource.jsp file, which worked!... therefore I presume the datasource is correctly settled...
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
   "http://www.w3.org/TR/html4/loose.dtd">
<%@ taglib uri="http://java.sun.com/jsp/jstl/sql" prefix="sql" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<sql:query var="rs" dataSource="jdbc/Coreba">
select TITULO_INCIDENCIA from incidencias
</sql:query>
<html>
  <head>
    <title>Coreba Test</title>
  </head>
  <body>
  <h2>Results</h2>
<c:forEach var="row" items="${rs.rows}">
    Título =  ${row.TITULO_INCIDENCIA}<br/>
</c:forEach>
  </body>
</html>

Similar Messages

Maybe you are looking for

  • How to display result of a query in browser?

    I have to write a simple application where I use EJB to access a database and then use Servlet/JSP to display the data to a browser. can anyone help me out please?

  • Masking GL account in Manual Bank configuration

    I have done a new bank accounting configuration Created the new House bank and Bank accounts , with account key, mainly , main bank , clearing accounts and used the masking for Bank accounts . There are some old bank GL accounts in which last digit i

  • Search feature with dreamweaver template

    I'm building a site with products ids, I need to include a search feature that can find a specific product within the site. I found a template in Dreamweaver that includes the search form. How can I learn how to make it work? Is there any script out

  • Establishing ELSTER/DATEV for ERP2005 systems

    Hi! I have 2 systems (ERP 2005) landscape and have to set up the ELSTER/DATEV approach for these systems. The system landscape is: DEV-system (Clients: 100 and 200) PRD-system (Clients: 100) We do not have SAP XI, so we need to use SAP Business Conne

  • Verifying if number in a text field will evaluate to a date format

    I have a field, FieldA, that contains 6 numbers, (although the field is a text field). I need to know if that field's numbers evaluate to a true date in the format of mmddyy. For example, if FieldA contains 060110, then that would evaluate to a true