Proper JPA Console Setting

Hi there,
I require help in setting up the JPA Console in 13.1.4.A SELECT command produces an "java.lang.RuntimeException: javax.persistence.PersistenceException: No Persistence provider for EntityManager named EnterpriseApplication3-warPU"
The persistence.xml seems to work because I am able to get information from the REST service that uses it as a source.

I've included the persistence.xml and one of the entity classes I'd like to read with the console.
The project SDK is 1.7.0_55 and the project level is 6.0, I'm using Glassfish 3.1.2.1-SNAPHOT

Any help would be appriciated.

Thanks,
Arthur

The full error message is:
[2014-07-24 10:12:13] java.lang.RuntimeException: javax.persistence.PersistenceException: No Persistence provider for EntityManager named EnterpriseApplication3-warPU
 at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:61)
 at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:39)
 in JpaFacadeImpl.createEntityManagerFactory(JpaFacadeImpl.java:16)
 in RemoteUtil.executeWithClassLoader(RemoteUtil.java:167)
 in RemoteUtil$2$1.invoke(RemoteUtil.java:102)
 at com.sun.proxy.$Proxy126.createEntityManagerFactory(Unknown Source)
 in JpaEngine.ensureInitialized(JpaEngine.java:97)

persistence.xml:
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<persistence xmlns="http://xmlns.jcp.org/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="2.1" xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/persistence http://xmlns.jcp.org/xml/ns/persistence/persistence_2_1.xsd">
    <persistence-unit name="EnterpriseApplication3-warPU" transaction-type="JTA">
        <jta-data-source>ULTDBResource</jta-data-source>
        <exclude-unlisted-classes>false</exclude-unlisted-classes>
        <properties/>
    </persistence-unit>
</persistence>

LanguageEntity.java
package com.rest.model;


import javax.persistence.*;
import javax.xml.bind.annotation.XmlRootElement;
import java.util.Collection;


@Entity
@XmlRootElement
@NamedQueries({
        @NamedQuery(name = "LanguageEntity.findAll", query = "SELECT l FROM LanguageEntity l")
              })
@Table(name = "ULT_LANGUAGES", schema = "SYSTEM", catalog = "")
public class LanguageEntity
{
    private Long id;
    private String name;
    private String description;
    private String locale;
    private String localeMac;
    private Collection<MarketLanguageEntity> marketLanguageById;
    private Collection<TranslationTextEntity> translationTextById;


    @Id
    @Column(name = "ID")
    public Long getId()
    {
        return id;
    }


    public void setId(Long id)
    {
        this.id = id;
    }


    @Basic
    @Column(name = "NAME")
    public String getName()
    {
        return name;
    }


    public void setName(String name)
    {
        this.name = name;
    }


    @Basic
    @Column(name = "DESCRIPTION")
    public String getDescription()
    {
        return description;
    }


    public void setDescription(String description)
    {
        this.description = description;
    }


    @Basic
    @Column(name = "LOCALE")
    public String getLocale()
    {
        return locale;
    }


    public void setLocale(String locale)
    {
        this.locale = locale;
    }


    @Basic
    @Column(name = "LOCALE_MAC")
    public String getLocaleMac()
    {
        return localeMac;
    }


    public void setLocaleMac(String localeMac)
    {
        this.localeMac = localeMac;
    }


    @Override
    public int hashCode()
    {
        int result = id != null ? id.hashCode() : 0;
        result = 31 * result + (name != null ? name.hashCode() : 0);
        result = 31 * result + (description != null ? description.hashCode() : 0);
        result = 31 * result + (locale != null ? locale.hashCode() : 0);
        result = 31 * result + (localeMac != null ? localeMac.hashCode() : 0);
        return result;
    }


    @Override
    public boolean equals(Object o)
    {
        if (this == o)
        {
            return true;
        }
        if (o == null || getClass() != o.getClass())
        {
            return false;
        }


        LanguageEntity that = (LanguageEntity) o;


        if (description != null ? !description.equals(that.description) : that.description != null)
        {
            return false;
        }
        if (id != null ? !id.equals(that.id) : that.id != null)
        {
            return false;
        }
        if (locale != null ? !locale.equals(that.locale) : that.locale != null)
        {
            return false;
        }
        if (localeMac != null ? !localeMac.equals(that.localeMac) : that.localeMac != null)
        {
            return false;
        }
        if (name != null ? !name.equals(that.name) : that.name != null)
        {
            return false;
        }


        return true;
    }


    @OneToMany(mappedBy = "languageByLanguageId")
    public Collection<MarketLanguageEntity> getMarketLanguageById()
    {
        return marketLanguageById;
    }


    public void setMarketLanguageById(Collection<MarketLanguageEntity> marketLanguageById)
    {
        this.marketLanguageById = marketLanguageById;
    }


    @OneToMany(mappedBy = "languageByLanguageId")
    public Collection<TranslationTextEntity> getTranslationTextById()
    {
        return translationTextById;
    }


    public void setTranslationTextById(Collection<TranslationTextEntity> translationTextById)
    {
        this.translationTextById = translationTextById;
    }
}


LanguageResourceBean.java
package com.rest.controller.service;


import com.rest.model.LanguageEntity;


import javax.ejb.Stateless;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
import javax.persistence.TypedQuery;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import java.util.List;




@Path("languages")
@Produces({"application/xml", "application/json"})
@Stateless(name = "LanguageResourceEJB")
public class LanguageResourceBean
{
    @PersistenceContext(unitName = "EnterpriseApplication3-warPU")
    private EntityManager entityManager;


    public LanguageResourceBean()
    {
    }


    public EntityManager getEntityManager()
    {
        return entityManager;
    }


    @GET
    public List<LanguageEntity> findAll()
    {
        TypedQuery<LanguageEntity> languageEntityTypedQuery =
                getEntityManager().createNamedQuery("LanguageEntity.findAll", LanguageEntity.class);


        List<LanguageEntity> languageEntityList = languageEntityTypedQuery.getResultList();


        return languageEntityList;
    }
}
2 comments
Comment actions Permalink

Since then I've changed the persistence.xml to the following with the same result
persistence.xml

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<persistence xmlns="http://xmlns.jcp.org/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="2.1" xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/persistence http://xmlns.jcp.org/xml/ns/persistence/persistence_2_1.xsd">
    <persistence-unit name="EnterpriseApplication3-warPU" transaction-type="JTA">
        <provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>
        <class>com.rest.model.LanguageEntity</class>
        <properties>
            <property name="eclipselink.jdbc.url" value="jdbc:oracle:thin:SYSTEM@//rootmachine:1521/ULT"/>
            <property name="eclipselink.jdbc.driver" value="oracle.jdbc.OracleDriver"/>
            <property name="eclipselink.jdbc.user" value="SYSTEM"/>
            <property name="eclipselink.jdbc.password" value="oracle"/>
        </properties>
    </persistence-unit>
</persistence>

0
Comment actions Permalink

Added eclipse link jar to the project.

0

Please sign in to leave a comment.