aspose file tools*
The moose likes Object Relational Mapping and the fly likes Spring3/JPA2 configuration problem Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "Spring3/JPA2 configuration problem" Watch "Spring3/JPA2 configuration problem" New topic
Author

Spring3/JPA2 configuration problem

John Eric Hamacher
Ranch Hand

Joined: Apr 25, 2007
Posts: 230
Hello:

I am getting:

  • Caused by: java.lang.IllegalArgumentException: No PersistenceProvider specified in EntityManagerFactory configuration, and chosen PersistenceUnitInfo does not specify a provider class name either
    at org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean.createNativeEntityManagerFactory(LocalContainerEntityManagerFactoryBean.java:250)
    at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.afterPropertiesSet(AbstractEntityManagerFactoryBean.java:310)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1514)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1452)
    ... 37 more



  • My app context contains:




    My persistence file (located in META-INF under classes). hibernate.cfg.xml is located in WEB-INF but I specified WEB-INF as part of my classpath when I ran the program.




    My hibernate.cfg.xml:



    Thanks , Eric
    Prithvi Sehgal
    Ranch Hand

    Joined: Oct 13, 2009
    Posts: 774
    Hi Eric,

    There are the following issues in your configuration

    1- You need to give a persistance provider in persistance.xml file. JPA2 has many implementations e.g. Hibernate, OpenJPA, EclipseLink. In your case
    provide a persistance provider. You can specify the same in jpaVendor property. Specify the hibernate dialect as well.

    2- Why you are specifying session factory for hibernate? JPA uses entity manager. You don't need to give session-factory configuration.

    HTH,


    Prithvi,
    My Blog, Follow me on Twitter,Scjp Tips, When you score low in mocks, Generics,Scjp Notes, JavaStudyGroup
    Prithvi Sehgal
    Ranch Hand

    Joined: Oct 13, 2009
    Posts: 774
    Hi Eric,

    Here is a sample integration project i created for you. My applicationContext.xml now looks like this



    My persistance.xml is empty and looks like this



    I am writing a small blog article for Spring 3 and JPA2 will be completed by tomorrow. You can have a look at that also in a day or so at my blog.
    HTH,
    John Eric Hamacher
    Ranch Hand

    Joined: Apr 25, 2007
    Posts: 230
    Thank you! Thank you for the responses! It is working now.
    Peter Piddle
    Greenhorn

    Joined: Jun 13, 2012
    Posts: 26

    Hi John,
    I am glad it worked for you . Prithvi i was having the same issue and it helped me as well. Thanks a ton.
    Cheers,


    Peter Piddle - Skype(peter.piddle)
     
    I agree. Here's the link: http://aspose.com/file-tools
     
    subject: Spring3/JPA2 configuration problem