Skip to content

Instantly share code, notes, and snippets.

@massahud
Last active October 28, 2021 13:16
Show Gist options
  • Save massahud/1436e12c21e17c1bfe9c02c5fbde45f0 to your computer and use it in GitHub Desktop.
Save massahud/1436e12c21e17c1bfe9c02c5fbde45f0 to your computer and use it in GitHub Desktop.
Wildfly 10.1.0

Adicionar módulo do oracle

  1. Criar o diretório modules\system\layers\base\com\oracle\ojdbc6\main
  2. Adicionar ojdbc6.jar no diretório acima
  3. Adicionar o arquivo module.xml ao diretório acima, com os seguinte conteúdo:
<?xml version="1.0" encoding="UTF-8"?>
<module xmlns="urn:jboss:module:1.3" name="com.oracle.ojdbc6">
  <resources>
    <resource-root path="ojdbc6.jar"/>
  </resources>
  <dependencies>
    <module name="javax.api"/>
	<module name="javax.transaction.api"/>
  </dependencies>
</module>

Adicionar driver no standalone.xml

Adicionar o seguinte driver dentro do elemento <drivers> do standalone.xml

<driver name="oracle" module="com.oracle.ojdbc6">
   <xa-datasource-class>oracle.jdbc.OracleDriver</xa-datasource-class>
</driver>
https://docs.jboss.org/author/display/WFLY10/JPA+Reference+Guide#JPAReferenceGuide-UsingEclipseLink
Using EclipseLink
You need to copy the EclipseLink jar (e.g. eclipselink-2.6.0.jar or eclipselink.jar as in the example below) into the WildFly modules/system/layers/base/org/eclipse/persistence/main folder and update modules/system/layers/base/org/eclipse/persistence/main/module.xml to include the EclipseLink jar (take care to use the jar name that you copied in). If you happen to leave the EclipseLink version number in the jar name, the module.xml should reflect that.
<module xmlns="urn:jboss:module:1.1" name="org.eclipse.persistence">
<resources>
<resource-root path="jipijapa-eclipselink-10.0.0.Final.jar"/>
<resource-root path="eclipselink.jar">
<filter>
<exclude path="javax/**" />
</filter>
</resource-root>
</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="javax.ws.rs.api"/>
<module name="org.antlr"/>
<module name="org.apache.commons.collections"/>
<module name="org.dom4j"/>
<module name="org.jboss.as.jpa.spi"/>
<module name="org.jboss.logging"/>
<module name="org.jboss.vfs"/>
</dependencies>
</module>
As a workaround for issueid=414974, set (WildFly) system property "eclipselink.archive.factory" to value "org.jipijapa.eclipselink.JBossArchiveFactoryImpl" via jboss-cli.sh command (WildFly server needs to be running when this command is issued):
jboss-cli.sh --connect '/system-property=eclipselink.archive.factory:add(value=org.jipijapa.eclipselink.JBossArchiveFactoryImpl)'
. The following shows what the standalone.xml (or your WildFly configuration you are using) file might look like after updating the system properties:
<system-properties>
...
<property name="eclipselink.archive.factory" value="org.jipijapa.eclipselink.JBossArchiveFactoryImpl"/>
</system-properties>
You should then be able to deploy applications with persistence.xml that include;
<provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>
Also refer to page how to use EclipseLink with WildFly guide here.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment