javax.persistence.PersistenceException : [PersistenceUnit: vodPersistenceUnit] class or package not found

后端 未结 4 1440
情话喂你
情话喂你 2020-12-19 17:50

I got the following error :

Error creating bean with name \'org.springframework.dao.annotation.PersistenceExceptionTranslationPostProcessor#0\' de

相关标签:
4条回答
  • 2020-12-19 17:56

    I was running into this exception when trying to run a Spring Boot application in WebLogic 12.1.3 In the dependency tree I found out spring-tx was being included from one of the common project libraries. Our particular app only calls web service so there is no need for database access. So in the library dependency I added:

    <exclusions><exclusion> <groupId>org.springframework</groupId><artifactId>spring-tx</artifactId></exclusion></exclusions>
    
    0 讨论(0)
  • 2020-12-19 17:57

    I fixed the issue. I had to comment these three lines in the file "persistence.xml" :

       <!--class>mypackage.persistent.TicketType</class>
        <class>mypackage.persistent.TransactionType</class>
        <class>mypackage.persistent.StatutSession</class--> 
    

    For the moment i have no idea why it fixes the issue. It is really hard to debug this spring file.

    0 讨论(0)
  • 2020-12-19 18:04

    If you had to comment out the "class" elements, it is likely that one of those classes is either not defined, or is not available in the classpath.

    I faced the same exact error, and it was resolved once the fully qualified names were all correct. Ideally, Hibernate should tell you what class is not found, but sadly it does not do it in this case.

    0 讨论(0)
  • 2020-12-19 18:19

    You you haven't done that, put <property name="persistenceUnitName" value="vodPersistenceUnit" /> in your jpaDaoContext.xml as property of your entityManagerFactory bean definition like:

    <bean id="entityManagerFactory" class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">
      <property name="persistenceUnitName" value="vodPersistenceUnit" />
      <property name="dataSource" ref="dataSource" />
      <property name="jpaVendorAdapter">...</property>
    </bean>
    
    0 讨论(0)
提交回复
热议问题