What application server are you working with? I'm not sure why when you set the provider to org.apache.openjpa.persistence.PersistenceProviderImp you are getting an exception from EclipseLink. Are there any exceptions in your log prior to "Exception [EclipseLink-7060] (Eclipse Persistence Services -1.1.2.v20090612-r4475): org.eclipse.persistence.exceptions.ValidationException Exception Description: Cannot acquire data source [VacationPool]." ?
On Mon, Dec 21, 2009 at 2:32 AM, alvaroCab <[email protected]>wrote: > > Hello to everybody, I am following the book from IBM redbooks "Experience > JEE > for Websphere" and I am making a project where I have created two JPA > Entities. Everything is set up correctly in my Eclipse IEE application, the > drivers, server connections and rest of things. I have created a JUnit > tester to test the JPA Entities. The problem is that when I execute the > tester, I get this error message: > > [EL Info]: 2009-12-21 09:24:32.462--ServerSession(1655333546)--EclipseLink, > version: Eclipse Persistence Services - 1.1.2.v20090612-r4475 > [EL Severe]: 2009-12-21 09:24:32.478--ServerSession(1655333546)--Local > Exception Stack: > Exception [EclipseLink-4021] (Eclipse Persistence Services - > 1.1.2.v20090612-r4475): > org.eclipse.persistence.exceptions.DatabaseException > Exception Description: Unable to acquire a connection from driver [null], > user [null] and URL [null]. Verify that you have set the expected driver > class and URL. Check your login, persistence.xml or sessions.xml resource. > The jdbc.driver property should be set to a class that is compatible with > your database platform > at > > org.eclipse.persistence.exceptions.DatabaseException.unableToAcquireConnectionFromDriverException(DatabaseException.java:375) > > (....) > > My persistence.xml file is as follows: > > <<?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="VacationUnit"> > > <class>vacation.entities.Employee</class> > <properties> > <property name="openjpa.url" > value="jdbc:derby://localhost:1527/Vacation" > /> > <property name="openjpa.driver" > value="org.apache.derby.jdbc.ClientDriver" /> > <property name="openjpa.user" value="vacation" /> > property name="openjpa.password" value="vacation" /> > <property name="openjpa.Log" value="SQL=TRACE" /> > </properties> > </persistence-unit> > </persistence> > > If I add the line > <provider>org.apache.openjpa.persistence.PersistenceProviderImpl</provider> > I get this error instead: > > Exception [EclipseLink-7060] (Eclipse Persistence Services - > 1.1.2.v20090612-r4475): > org.eclipse.persistence.exceptions.ValidationException > Exception Description: Cannot acquire data source [VacationPool]. > > If I change the openjpa provider to > <provider>org.eclipse.persistence.jpa.PersistenceProvider</provider> and I > make the calls with this provider, it works fine so it shows that the > drivers and the data pools work correctly. > > I want to use openJPA but it seems like It doesn't want to work, Does > anybody know wich could be the problem? > > Thanks! > -- > View this message in context: > http://n2.nabble.com/OpenJPA-not-connecting-the-database-tp4197138p4197138.html > Sent from the OpenJPA Users mailing list archive at Nabble.com. > -- Thanks, Rick
