Problem using JPA console

I'm having problems runing the JPA console. I have a simple Java EE project and wanted to try this but all I got is this message:

jpa-ql> select from Cliente c
java.lang.RuntimeException: javax.persistence.PersistenceException: No Persistence provider for EntityManager named EscuderServerPersistenceUnit
    at javax.persistence.Persistence.createEntityManagerFactory(
    at javax.persistence.Persistence.createEntityManagerFactory(

The datasource console (simple jdbc + sql) works fine. The such "EscuderServerPersistenceUnit" is configured to the datasource. I'm using GlassFish 3 so I've configured the JPA provider to EclipseLink.

Comment actions Permalink

This is because of incorrect JPA configuration. Make sure you could start your persistence unit manually. I hope you googled the message. See Probably, you just need this in the persistence.xml:


Also, you should properly configure jpa facet - choose available datasourcee, appropriate persitence unit, correct provider. Also, you have to provide more data regarding your configuration to get the answer. At least persistence.xml + jpa facet configuration.

Comment actions Permalink

Thanks for the answer.

Make sure you could start your persistence unit manually.

Don't know how to do this. Or perhaps is what I'm doing right now. I just open the persistence tab, it shows my persistence unit, right click, select "Open Query Console".

I hope you googled the message. See Probably, you just need this in the persistence.xml:

<?xml version="1.0" encoding="UTF-8"?>
<persistence xmlns="" version="2.0">
  <persistence-unit name="EscuderServerPersistenceUnit">

And my face configuration:

    <facet type="jpa" name="JPA">
        <setting name="validation-enabled" value="true" />
        <setting name="provider-name" value="EclipseLink" />
          <factory-entry name="EscuderServerPersistenceUnit" value="0bc06bd8-3355-418c-afbc-9bcb4f8a150e" />
        <deploymentDescriptor name="persistence.xml" url="file://$MODULE_DIR$/src/META-INF/persistence.xml" />

The hex mapping for the datasource has a match on dataSources.ids and the datasource works ok on IDEA (using the plain sql console).

Ok, so with your hint I've found that my problem was that I was not including the classes for eclipselink. So, after adding some jars to the application server library, now the problem seems to be configuration of the eclipselink parameters:

java.lang.RuntimeException: javax.persistence.PersistenceException: Exception [EclipseLink-4021] (Eclipse Persistence Services - 2.0.1.v20100213-r6600): 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.internal.jpa.EntityManagerSetupImpl.deploy(
    at org.eclipse.persistence.internal.jpa.EntityManagerFactoryImpl.getServerSession(
    at org.eclipse.persistence.internal.jpa.EntityManagerFactoryImpl.createEntityManagerImpl(
    at org.eclipse.persistence.internal.jpa.EntityManagerFactoryImpl.createEntityManager(

I can see EclipseLink doesn't know the driver, url and so... but I don't know how to configure it and... shouldn't idea pick that up from the link to the datasource it already has?

Thank you!

Comment actions Permalink

idea couln't connect to the database using jta datasource configured in the glassfish. You can see there are no any information in the facet descriptor, there are no any association with the datasource. try to create an alternate persistence.xml providing the jdbc url and credentials explicitly:

Regards, Alex


Please sign in to leave a comment.