Hakan Inanc
Hakan Inanc

Reputation: 31

No Persistence provider for EntityManager named- when try to deploy from weblogic console

I'm struggling for a few days about this error.

When I try to deploy from ide(IntelliJ-eclipse), it works correct.

But when I try to deploy from WebLogic console, I got these errors;

Error Unable to access the selected application. 
Error Unable to invoke Annotation processoror.
Error Unable to invoke Annotation processoror.

For more information, I checked logs and errors from stack trace. It looks like the main error is: javax.persistence.PersistenceException: No Persistence provider for EntityManager named.

In debug, throwing from this code; Persistence.createEntityManagerFactory("persistanceUnitName");

Persistence classes are coming from javaee-web-abi-7.0.jar.

Everything looks fine in persistence.xml.

<?xml version="1.0" encoding="UTF-8"?>
<persistence version="2.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_2_0.xsd">
    <persistence-unit name="persistanceUnitName"
        transaction-type="JTA">
        <provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>
        <jta-data-source>dataSource</jta-data-source>
        <exclude-unlisted-classes>false</exclude-unlisted-classes>
        <properties>
            <property name="eclipselink.target-database" value="Oracle" />
            <property name="eclipselink.logging.parameters" value="true" />
            <property name="eclipselink.logging.logger" value="DefaultLogger" />
            <property name="eclipselink.logging.level" value="WARNING" />
            <property name="eclipselink.refresh" value="true" />
            <property name="eclipselink.query-results-cache" value="false" />
            <!-- <property name="eclipselink.ddl-generation" value="create-or-extend-tables" />-->
        </properties>
    </persistence-unit>
</persistence>

persistance.xml located in /WEB-INF/classes/META-INF

We got a case like that: we have a test and prep environment. In test, it works, in prep doesn't work, in local doesn't work (from WebLogic console). Unfortunately, I can't see test server configs. But I expect the same options with prep. Anyway forget other environments, firstly I need to deploy successful from local.

Could you pls help me, I really don't know what I miss. Read every topic, tried everything

Upvotes: 3

Views: 465

Answers (1)

semihunaldi
semihunaldi

Reputation: 44

It looks like a classpath issue. Check your weblogic classpath. If you are using eclipselink library must be loaded first when you are deploying.

Check this.

Add eclipselink into your project with scope provided:

<dependency>
    <groupId>org.eclipse.persistence</groupId>
    <artifactId>eclipselink</artifactId>
    <version>2.5.0</version>
    <scope>provided<scope>
</dependency>

add same dependency into your weblogic classpath:

$WEBLOGIC_HOME/user_projects/domains/base_domain/lib

Then, add below to your weblogic.xml to use eclipselink library.

<wls:container-descriptor>
    <wls:prefer-application-packages>
        <wls:package-name>org.eclipse.persistence.*</wls:package-name>
    </wls:prefer-application-packages>
</wls:container-descriptor>

Upvotes: 1

Related Questions