Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Spring3/JPA2 configuration problem

 
John Eric Hamacher
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
     
    Prithvi Sehgal
    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.
     
    Peter Piddle
    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,
     
    • Post Reply
    • Bookmark Topic Watch Topic
    • New Topic