0 Replies Latest reply: Apr 2, 2009 10:42 PM by 843833 RSS

    Persistence provider for EntityManager exception in simple JPA application

    843833
      Hi,

      I am getting the following exception while running a simple JPA applciation.

      This is the exception trace.

      javax.persistence.PersistenceException: No Persistence provider for EntityManager named JPATestPU: No META-INF/persistence.xml was found in classpath.

      at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:154)
      at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:83)

      I have searched and most of the solutions say that the problem is maybe persitence.xml is not in the class path.
      I placed it in the class apth but still i get the same exception.

      I am using SqlServer 2005.

      my 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="JPATestPU" transaction-type="RESOURCE_LOCAL">
              <provider>oracle.toplink.essentials.PersistenceProvider</provider>
              <class>jpatest.CompanyDetailsEntity</class>
              <class>jpatest.UserCompanyEntity</class>
              <class>jpatest.UserTableEntity</class>
              <properties>
                  <property name="toplink.logging.level" value="INFO"/>
                  <property name="toplink.jdbc.url" value="jdbc:jtds:sqlserver://hyddl1518:1433;DatabaseName=ImpactD"/>
                  <property name="toplink.jdbc.user" value="presenter"/>
                  <property name="toplink.jdbc.driver" value="net.sourceforge.jtds.jdbc.Driver"/>
                  <property name="toplink.jdbc.password" value="presenter"/>
                  <property name="toplink.ddl-generation" value="create-tables"/>
              </properties>
          </persistence-unit>
      </persistence>
      Does Toplink work with SQL Server (I googled and it says its possible.)
      Can some one help me regarding this ?