Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

I got the following error :

Error creating bean with name 'org.springframework.dao.annotation.PersistenceExceptionTranslationPostProcessor#0' defined in class path resource [jpaDaoContext.xml]: Initialization of bean failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'vodEntityManagerFactory' defined in class path resource [jpaDaoContext.xml]: Invocation of init method failed; nested exception is javax.persistence.PersistenceException: [PersistenceUnit: vodPersistenceUnit] class or package not found

I had a look on Google and I was told to choose transaction-type=RESOURCE_LOCAL but the settings were already that way. What is wrong with these settings :

 <?xml version="1.0" encoding="UTF-8"?>
<persistence 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"
    version="1.0">

    <!-- transaction-type is RESOURCE_LOCAL or JTA -->
    <persistence-unit name="vodPersistenceUnit"
        transaction-type="RESOURCE_LOCAL">

        <class>mypackage.persistent.HistoriqueAction</class>
        <class>mypackage.persistent.ParametresTechniques</class>
        <class>mypackage.persistent.TicketType</class>
        <class>mypackage.persistent.TransactionType</class>
        <class>mypackage.persistent.StatutSession</class>
        <class>mypackage.persistent.Statistique</class>
        <class>mypackage.persistent.StatUser</class>

        <!-- Avoid to scan *.class and *.hbm.xml -->
        <exclude-unlisted-classes />


    </persistence-unit>

</persistence>

Regards

like image 477
Jean Reno Avatar asked Dec 25 '22 23:12

Jean Reno


1 Answers

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.

like image 143
Jean Reno Avatar answered Dec 30 '22 12:12

Jean Reno