EclipseLink in OSGI Bundle persistence.xml not found

I have a problem with EclipseLink. I am using GlassFish v3.1 and I am trying to use EclipseLink for my save level. I followed all the tutorials available on the Eclipse wiki without any success. My persistence.xml file cannot be parsed, and I get this error when trying to create an EntityManagerFactory:

org.eclipse.persistence.exceptions.PersistenceUnitLoadingException Exception Description: Fixed error when processing persistence.xml from URL: bundle: //307.1: 1 /

Here is my persistence.xml located in / WEB -INF / classes / META-INF /:

<persistence version="1.0" 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">
    <persistence-unit name="generic">
        <class>com.generic.domain.Service</class>

        <properties>
            <!-- Embedded MySQL Login -->
            <property name="javax.persistence.jdbc.driver" value="com.mysql.jdbc.Driver"/>
            <property name="javax.persistence.jdbc.url" value="jdbc:mysql://localhost:3306"/>

            <!-- TODO: replace with connection pool -->
            <property name="javax.persistence.jdbc.userid" value="root"/>
            <property name="javax.persistence.jdbc.password" value=""/>

            <property name="eclipselink.target-database" value="MySQL"/>
            <property name="eclipselink.jdbc.read-connections.min" value="1"/>
            <property name="eclipselink.jdbc.write-connections.min" value="1"/>
            <property name="eclipselink.jdbc.batch-writing" value="JDBC"/>

            <!-- Logging Settings -->
            <property name="eclipselink.logging.level" value="FINE" />
            <property name="eclipselink.logging.thread" value="false" />
            <property name="eclipselink.logging.session" value="false" />
            <property name="eclipselink.logging.exceptions" value="true" />
            <property name="eclipselink.logging.timestamp" value="false"/>            
        </properties>
    </persistence-unit>
</persistence>

I added this line to my MANIFEST.MF file:

JPA-PersistenceUnits: generic
+3
source share
2 answers

, EclipseLink. , EntityManagerFactory JNDI, @PersistenceUnit Persistence.createEntityManagerFactory().

+1

1) , OSGi/JPA WAB. ? 2) , eclipselink? , ? 3) ?

0

Source: https://habr.com/ru/post/1789002/


All Articles