Ae galera, o que eu tô colocando de errado? para dar o erro abaixo? configurei o persistence.xml, coloquei os dados da conexão no server.xml e não pega de geito nenhum.
Alguma luz para mim ae por favor. Obrigado
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="teste" transaction-type="RESOURCE_LOCAL">
<provider>oracle.toplink.essentials.ejb.cmp3.EntityManagerFactoryProvider</provider>
<non-jta-data-source>java:comp/env/jdbc/teste</non-jta-data-source>
<class>modelo.cliente</class><properties>
<property name="toplink.session.customizer" value="util.customizer"/>
<property name="toplink.jdbc.user" value="root"/>
<property name="toplink.jdbc.password" value="xxx"/>
<property name="toplink.jdbc.url" value="jdbc:mysql://localhost:3306/testejpa"/>
<property name="toplink.jdbc.driver" value="com.mysql.jdbc.Driver"/>
</properties>
</persistence-unit>
</persistence>
Recurso no server.xml do TomCat
<Resource auth="Container"
driverClassName="com.mysql.jdbc.Driver"
factory="org.apache.tomcat.dbcp.dbcp.BasicDataSourceFactory"
maxActive="20"
maxIdle="10"
maxWait="10000"
name="teste"
password="xxx"
scope="shareable"
type="javax.sql.DataSource"
url="jdbc:mysql://localhost:3306/testejpa"
username="root"/>
erro:
HTTP Status 500 -
type Exception report
message
description The server encountered an internal error () that prevented it from fulfilling this request.
exception
javax.persistence.PersistenceException: Exception [TOPLINK-7060] (Oracle TopLink Essentials - 2006.8 (Build 060908)): oracle.toplink.essentials.exceptions.ValidationException
Exception Description: Cannot acquire data source [java:comp/env/jdbc/teste].
Internal Exception: javax.naming.NameNotFoundException: Name jdbc is not bound in this Context
oracle.toplink.essentials.internal.ejb.cmp3.EntityManagerSetupImpl.deploy(EntityManagerSetupImpl.java:240)
oracle.toplink.essentials.internal.ejb.cmp3.base.EntityManagerFactoryImpl.getServerSession(EntityManagerFactoryImpl.java:78)
oracle.toplink.essentials.internal.ejb.cmp3.base.EntityManagerFactoryImpl.createEntityManagerImpl(EntityManagerFactoryImpl.java:113)
oracle.toplink.essentials.internal.ejb.cmp3.base.EntityManagerFactoryImpl.createEntityManagerImpl(EntityManagerFactoryImpl.java:107)
oracle.toplink.essentials.internal.ejb.cmp3.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:76)
util.DatabaseManagerSingleton.<init>(DatabaseManagerSingleton.java:45)
util.DatabaseManagerSingleton.getInstancia(DatabaseManagerSingleton.java:37)
dao.PacienteDAO.<init>(PacienteDAO.java:20)
servlet.InsertPaciente.doPost(InsertPaciente.java:29)
javax.servlet.http.HttpServlet.service(HttpServlet.java:710)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
root cause
Exception [TOPLINK-7060] (Oracle TopLink Essentials - 2006.8 (Build 060908)): oracle.toplink.essentials.exceptions.ValidationException
Exception Description: Cannot acquire data source [java:comp/env/jdbc/teste].
Internal Exception: javax.naming.NameNotFoundException: Name jdbc is not bound in this Context
oracle.toplink.essentials.exceptions.ValidationException.cannotAcquireDataSource(ValidationException.java:353)
oracle.toplink.essentials.jndi.JNDIConnector.connect(JNDIConnector.java:120)
oracle.toplink.essentials.sessions.DatasourceLogin.connectToDatasource(DatasourceLogin.java:170)
oracle.toplink.essentials.internal.sessions.DatabaseSessionImpl.loginAndDetectDatasource(DatabaseSessionImpl.java:537)
oracle.toplink.essentials.ejb.cmp3.EntityManagerFactoryProvider.login(EntityManagerFactoryProvider.java:180)
oracle.toplink.essentials.internal.ejb.cmp3.EntityManagerSetupImpl.deploy(EntityManagerSetupImpl.java:230)
oracle.toplink.essentials.internal.ejb.cmp3.base.EntityManagerFactoryImpl.getServerSession(EntityManagerFactoryImpl.java:78)
oracle.toplink.essentials.internal.ejb.cmp3.base.EntityManagerFactoryImpl.createEntityManagerImpl(EntityManagerFactoryImpl.java:113)
oracle.toplink.essentials.internal.ejb.cmp3.base.EntityManagerFactoryImpl.createEntityManagerImpl(EntityManagerFactoryImpl.java:107)
oracle.toplink.essentials.internal.ejb.cmp3.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:76)
util.DatabaseManagerSingleton.<init>(DatabaseManagerSingleton.java:45)
util.DatabaseManagerSingleton.getInstancia(DatabaseManagerSingleton.java:37)
dao.PacienteDAO.<init>(PacienteDAO.java:20)
servlet.InsertPaciente.doPost(InsertPaciente.java:29)
javax.servlet.http.HttpServlet.service(HttpServlet.java:710)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
root cause
javax.naming.NameNotFoundException: Name jdbc is not bound in this Context
org.apache.naming.NamingContext.lookup(NamingContext.java:770)
org.apache.naming.NamingContext.lookup(NamingContext.java:140)
org.apache.naming.NamingContext.lookup(NamingContext.java:781)
org.apache.naming.NamingContext.lookup(NamingContext.java:140)
org.apache.naming.NamingContext.lookup(NamingContext.java:781)
org.apache.naming.NamingContext.lookup(NamingContext.java:153)
org.apache.naming.SelectorContext.lookup(SelectorContext.java:137)
javax.naming.InitialContext.lookup(InitialContext.java:392)
oracle.toplink.essentials.jndi.JNDIConnector.connect(JNDIConnector.java:112)
oracle.toplink.essentials.sessions.DatasourceLogin.connectToDatasource(DatasourceLogin.java:170)
oracle.toplink.essentials.internal.sessions.DatabaseSessionImpl.loginAndDetectDatasource(DatabaseSessionImpl.java:537)
oracle.toplink.essentials.ejb.cmp3.EntityManagerFactoryProvider.login(EntityManagerFactoryProvider.java:180)
oracle.toplink.essentials.internal.ejb.cmp3.EntityManagerSetupImpl.deploy(EntityManagerSetupImpl.java:230)
oracle.toplink.essentials.internal.ejb.cmp3.base.EntityManagerFactoryImpl.getServerSession(EntityManagerFactoryImpl.java:78)
oracle.toplink.essentials.internal.ejb.cmp3.base.EntityManagerFactoryImpl.createEntityManagerImpl(EntityManagerFactoryImpl.java:113)
oracle.toplink.essentials.internal.ejb.cmp3.base.EntityManagerFactoryImpl.createEntityManagerImpl(EntityManagerFactoryImpl.java:107)
oracle.toplink.essentials.internal.ejb.cmp3.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:76)
util.DatabaseManagerSingleton.<init>(DatabaseManagerSingleton.java:45)
util.DatabaseManagerSingleton.getInstancia(DatabaseManagerSingleton.java:37)
dao.PacienteDAO.<init>(PacienteDAO.java:20)
servlet.InsertPaciente.doPost(InsertPaciente.java:29)
javax.servlet.http.HttpServlet.service(HttpServlet.java:710)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
note The full stack trace of the root cause is available in the Apache Tomcat/6.0.14 logs.
Apache Tomcat/6.0.14