Título: Error al intentar especificar el JDBC con tomee y JTA Publicado por: bertamax en 25 Mayo 2015, 00:07 am Hola. Estoy intentando hacer una aplicación web y para ello uso tomee y persistencia EJB y me da error al intentar obtener el EntityManager porque no encuentra el JDBC.
Mi fichero tomee.xml es el siguiente: <?xml version="1.0" encoding="UTF-8"?> <tomee> <!-- see http://tomee.apache.org/containers-and-resources.html --> <!-- activate next line to be able to deploy applications in apps --> <!-- <Deployments dir="apps" /> --> <Resource id="TestDS" type="DataSource"> JdbcDriver com.mysql.jdbc.Driver JdbcUrl jdbc:mysql://localhost:3306/databaseName UserName user Password 123 JtaManaged true </Resource> </tomee> Y el fichero persistence.xml el siguiente: <?xml version="1.0" encoding="UTF-8"?> <persistence version="2.1" 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_2_1.xsd"> <persistence-unit name="TestDSunit" transaction-type="JTA"> <provider>org.apache.openjpa.persistence.PersistenceProviderImpl</provider> <jta-data-source>TestDS</jta-data-source> <class>dao.User</class> <properties> <property name="openjpa.jdbc.SynchronizeMappings" value="buildSchema(ForeignKeys=true)"/> </properties> </persistence-unit> </persistence> He probado poniendo en jta-data-source las siguientes opciones java:openejb/Resource/TestDS java:comp/env/TestDS java/TestDS Y siempre me da el mismo error: <openjpa-2.4.0-nonfinal-1598334-r422266:1599166 fatal user error> org.apache.openjpa.persistence.ArgumentException: The persistence provider is attempting to use properties in the persistence.xml file to resolve the data source. A Java Database Connectivity (JDBC) driver or data source class name must be specified in the openjpa.ConnectionDriverName or javax.persistence.jdbc.driver property. The following properties are available in the configuration: "org.apache.openjpa.jdbc.conf.JDBCConfigurationImpl@fdaf18ee". Y es que ya no sé como solucionar para que lo pueda localizar, ¿alguna ayuda? gracias |