Migrating app from Glassfish to JBoss

I have trying to port app written for Glassfish to JBoss Wildfly, since i met numerous issues with Glassfish. The default JPA impl for Glassfish is EclipseLink, while for Wildfly it is hibernate. I wanted to keep using EclipseLink in Wildfly.

1. Download eclipselink. http://www.eclipse.org/eclipselink/downloads/

2. Unzip it, copy the eclipselink.jar to modules/system/layers/base/org/eclipse/persistence/main

3. Update module.xml in the directory to reflect the change:
























Make sure to match the exact name of the jar file in module.xml. If the jar file includes version numbers, for example, this should be reflected in module.xml file.

3. Execute the following while Wildfly is running:

jboss-cli.sh --connect '/system-property=eclipselink.archive.factory:add(value=org.jipijapa.eclipselink.JBossArchiveFactoryImpl)'

Or alternatively, modify standalone.xml to add the following:


4. Add the following dependence to pom.xml. Make sure the version matches the version of eclipselink jar you copied in Wildfly directory in step 2.








5. Define the provider for eclipselink in persistence.xml












Note that if the provider tag in persistence.xml is removed, then the app server will fallback to the default JPA implementation, which is hibernate for Wildfly and eclipselink for Glassfish.


Changing default JDK in Mac OS X Mavericks

So i have two installations of JDK on my Mac OS X. 1.7 and 1.8. The following is to list all JDK in Mac.


/usr/libexec/java_home -V

The above command resulted in the following:

Matching Java Virtual Machines (2):
    1.8.0_05, x86_64: "Java SE 8" /Library/Java/JavaVirtualMachines/jdk1.8.0_05.jdk/Contents/Home
    1.7.0_25, x86_64: "Java SE 7" /Library/Java/JavaVirtualMachines/jdk1.7.0_25.jdk/Contents/Home

/Library/Java/JavaVirtualMachines/jdk1.8.0_05.jdk/Contents/Home

Because of some problem with Spring when using Java 8, i need to change the default back to Java 7. This is what i do to the .profile file in my home directory.

export JAVA_HOME=`/usr/libexec/java_home -v 1.7`
#export JAVA_HOME=`/usr/libexec/java_home -v 1.8`

Sorted!

Data Import IMPDP Failed

So basically i was trying to import a dump file for schema rcemca into schema rcecms. (on a side note: you create schema by creating user. So each user has its own schema). I created the IMPDP_DIR by the following:

create directory IMPDP_DIR as '/home/firman/Downloads'
grant read, write on IMPDP_DIR to rcecms
commit


I then queried the database to makes sure the newly created directory is there
select * from all_directories


It was there.

OWNER       DIRECTORY_NAME
------------------------------ ------------------------------
DIRECTORY_PATH
--------------------------------------------------------------------------------
SYS       EXPDP_DIR
/home/firman/Downloads

SYS       XMLDIR
/u01/app/oracle/product/11.2.0/xe/rdbms/xml

SYS       DATA_PUMP_DIR

/u01/app/oracle/admin/XE/dpdump/

And then I did:
impdp system/password DIRECTORY=IMPDP_DIR DUMPFILE=file.dmp schemas=rcemca remap_schema=rcemca:rcecms


But i got the following error:

ORA-39002: invalid operation
ORA-39070: Unable to open the log file.
ORA-29283: invalid file operation
ORA-06512: at "SYS.UTL_FILE", line 536
ORA-29283: invalid file operation

After some searches i figured out it was because the user oracle, which ultimately runs the necessary steps to import the data, which is different from the user with which i ran the impdp command, has no access to the /home/firman/Downloads directory. A permission problem. This was fixed by changing the permission of /home/firman/Downloads or better still, moving the dump file to the Oracle provided data pump directory, which is DATA_PUMP_DIR (query above).