Win a copy of Svelte and Sapper in Action this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Bear Bibeault
  • Junilu Lacar
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • salvin francis
  • Frits Walraven
Bartenders:
  • Scott Selikoff
  • Piet Souris
  • Carey Brown

Spring3/JPA2 configuration problem

 
Ranch Hand
Posts: 230
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
     
    Ranch Hand
    Posts: 774
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    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 Sehgal
    Ranch Hand
    Posts: 774
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    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
    Posts: 230
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    Thank you! Thank you for the responses! It is working now.
     
    Greenhorn
    Posts: 26
    IntelliJ IDE jQuery Tomcat Server
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    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,
     
    With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
      Bookmark Topic Watch Topic
    • New Topic