Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to configure wildfly to use EclipseLink?

i have installed wildfly 8.1 and because i have already a project configured to use EclipseLink, i have tried to configure wildfly to use it.

However, it always gives the same error :

at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:166) [wildfly-server-8.1.0.Final.jar:8.1.0.Final]
 at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1948) [jboss-msc-1.2.2.Final.jar:1.2.2.Final]
 at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1881) [jboss-msc-1.2.2.Final.jar:1.2.2.Final]
 at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) [rt.jar:1.7.0_25]
 at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) [rt.jar:1.7.0_25]
 at java.lang.Thread.run(Thread.java:724) [rt.jar:1.7.0_25]
Caused by: javax.persistence.PersistenceException: JBAS011466: PersistenceProvider '
org.eclipse.persistence.jpa.PersistenceProvider
' not found
 at org.jboss.as.jpa.processor.PersistenceUnitServiceHandler.lookupProvider(PersistenceUnitServiceHandler.java:990)
 at org.jboss.as.jpa.processor.PersistenceUnitServiceHandler.addPuService(PersistenceUnitServiceHandler.java:258)
 at org.jboss.as.jpa.processor.PersistenceUnitServiceHandler.handleWarDeployment(PersistenceUnitServiceHandler.java:191)
 at org.jboss.as.jpa.processor.PersistenceUnitServiceHandler.deploy(PersistenceUnitServiceHandler.java:126)
 at org.jboss.as.jpa.processor.PersistenceBeginInstallProcessor.deploy(PersistenceBeginInstallProcessor.java:52)
 at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:159) [wildfly-server-8.1.0.Final.jar:8.1.0.Final]
 ... 5 more

I have followed the instructions of the official documentation, but nothing changed. I have added the eclipseLink's jar to "modules\system\layers\base\org\eclipse\persistence\main" and the module.xml :

<module xmlns="urn:jboss:module:1.3" name="org.eclipse.persistence">
    <resources>
        <resource-root path="jipijapa-eclipselink-1.0.1.Final.jar"/>
        <resource-root path="eclipselink.jar"/>
    </resources>

    <dependencies>
        <module name="asm.asm"/>
        <module name="javax.api"/>
        <module name="javax.annotation.api"/>
        <module name="javax.enterprise.api"/>
        <module name="javax.persistence.api"/>
        <module name="javax.transaction.api"/>
        <module name="javax.validation.api"/>
        <module name="javax.xml.bind.api"/>
        <module name="org.antlr"/>
        <module name="org.apache.commons.collections"/>
        <module name="org.dom4j"/>
        <module name="org.javassist"/>
        <module name="org.jboss.as.jpa.spi"/>
        <module name="org.jboss.logging"/>
        <module name="org.jboss.vfs"/>
    </dependencies>
</module>

Do you know what is the problem ?

Tks

Edit : My persistence.xml

<?xml version="1.0" encoding="UTF-8"?>
<persistence version="2.1" xmlns="http://xmlns.jcp.org/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/persistence http://xmlns.jcp.org/xml/ns/persistence/persistence_2_1.xsd">
    <persistence-unit name="AppPu">
        <provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>
        <jta-data-source>java:/H2Ds</jta-data-source>
        <exclude-unlisted-classes>false</exclude-unlisted-classes>
    </persistence-unit>
</persistence>
like image 820
Seb Avatar asked Sep 10 '14 13:09

Seb


People also ask

How do I deploy a Java Web application in WildFly?

Deploy an application But if you are running a standalone WildFly service, a simple way to deploy your application is to copy your application archive ( war/ear/jar ) into the $JBOSS_HOME/standalone/deployments directory in the server installation. The deployment-scanner subsystem detects the archive and deploys it.

Is EclipseLink a framework?

Eclipse Persistence Services Project (EclipseLink) is a comprehensive persistence framework delivering a set of persistence services based around leading standards with advanced extensions. Consumers can use EclipseLink within Java EE, SE, and OSGi/Equinox environments.

How do you use WildFly?

Use the script <WildFly directory>\bin\standalone. bat to start the WildFly server and check the installation. After startup, you should be able to access the web server at http://localhost:8080. Open the link Administration Console and follow the instructions to add a new management user.


2 Answers

New lines in provider section of persistence.xml won't work (how could it help?). Wildfly hasn't got provided eclipseLink implementation in libs. To fix this follow this steps:

  1. Download eclipselink.jar (or copy from your maven repo)
  2. Copy it to destination : ...Wildfly\modules\system\layers\base\org\eclipse\persistence\main
  3. Edit module.xml (same path). Add section <resource-root path="eclipselink.jar"><filter><exclude path="javax/**" /></filter></resource-root>

After server restart everything should work.

like image 138
graczun Avatar answered Oct 05 '22 22:10

graczun


Finally I solved the problem!

in fact, I have a composite unit, all persistence.xml are correct, but the persistence.xml which declared the composite unit was a bad statement of the provider:

<provider>
   org.eclipse.persistence.jpa.PersistenceProvider
</provider>

replaced by :

<provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>

and now work fine.

like image 30
Seb Avatar answered Oct 05 '22 21:10

Seb