Showing posts with label XMLImporter. Show all posts
Showing posts with label XMLImporter. Show all posts

Sunday, 31 May 2015

OAF: Import/Export Page/Personalization/Substitution using XMLImporter/JPXImporter in Oracle Application Framework

In this post, I will give the syntax for importing/exporting page/personalization/substitution in OA Framework from unix/windows machines.

Import Page/Personalization.
We will use the class XMLIMporter for importing the page or personalization into the database.

From Unix:
 java oracle.jrad.tools.xml.importer.XMLImporter <dir_path>/<file_name>.xml 
 -username <user_name> -password <password> 
 -dbconnection "(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=<host_name>)(PORT= <port_number>)) (CONNECT_DATA=(SID=<database_sid>)))" 
 -rootdir <dir_path> -rootPackage <package>  
Example:
 java oracle.jrad.tools.xml.importer.XMLImporter $PWD/TestPG.xml 
 -username apps -password apps 
 -dbconnection "(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.160.129) (PORT=1522))(CONNECT_DATA=(SID=VIS121)))" 
 -rootdir $PWD -rootPackage /ajtest/oracle/apps/fnd/test/webui/  
 java oracle.jrad.tools.xml.importer.XMLImporter $PWD/TestPG.xml 
 -username apps -password apps 
 -dbconnection "(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.160.129) (PORT=1522))(CONNECT_DATA=(SID=VIS121)))" 
 -rootdir $PWD -rootPackage /ajtest/oracle/apps/fnd/test/webui/customizations/site/0/  
From Windows:
The import.bat file will be available under the Jdev installation under jdevbin/oaext/bin
 import <dir_path>/<file_name>.xml 
 -username <user_name> -password <password> 
 -dbconnection "(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=<host_name>)(PORT=<port_number>))(CONNECT_DATA=(SID=<database_sid>)))" 
 -rootDir <dir_path> -rootPackage <package>  
Example:
 C:\oracle\JdevR12.1.3\jdevbin\oaext\bin\import C:\oracle/JdevR12.1.3/jdevbin/jdev/myprojects/ajtest/oracle/apps/fnd/test/webui/TestPG.xml 
 -username apps -password apps 
 -dbconnection "(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.160.129)(PORT=1522))(CONNECT_DATA=(SID=VIS121)))" -rootDir C:\oracle/JdevR12.1.3/jdevbin/jdev/myprojects/ 
 -rootPackage /ajtest/oracle/apps/fnd/test/webui/  
Import EO/VO/AM Substitution.
We will use the class JPXIMporter for importing the substitution into the database.
 java oracle.jrad.tools.xml.importer.JPXImporter <dir_path>/<file_name>.jpx 
 -username <user_name> -password <password> 
 -dbconnection "(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=<host_name>)(PORT= <port_number>)) (CONNECT_DATA=(SID=<database_sid>)))"  
Example:
 java oracle.jrad.tools.xml.importer.JPXImporter $PWD/AJProject.jpx 
 -username apps -password apps 
 -dbconnection "(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.160.129) (PORT=1522))(CONNECT_DATA=(SID=VIS121)))"  
Export Page/Personalization.
We will use the class XMLExporter for exporting the page or personalization from the database. When you execute these commands don't give the extension for the file name. 

From Unix:
 java oracle.jrad.tools.xml.exporter.XMLExporter <dir_path>/<file_name> -rootdir <dir_path> 
 -username <user_name> -password <password> 
 -dbconnection "(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=<host_name>)(PORT=<port_number>))(CONNECT_DATA=(SID=<database_sid>)))"  
Example:
 java oracle.jrad.tools.xml.exporter.XMLExporter /ajtest/oracle/apps/fnd/test/webui/TestPG 
 -rootdir $PWD 
 -username apps -password apps 
 -dbconnection "(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.160.129)(PORT=1522))(CONNECT_DATA=(SID=VIS121)))"  
From Windows:
The export.bat file will be available under the Jdev installation under jdevbin/oaext/bin
 export <dir_path>/<file_name> 
 -rootdir <dir_path> 
 -username <user_name> -password <password> 
 -dbconnection "(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=<host_name>)(PORT=<port_number>))(CONNECT_DATA=(SID=<database_sid>)))"  
Example:
 C:\oracle\JdevR12.1.3\jdevbin\oaext\bin\export /ajtest/oracle/apps/fnd/test/webui/TestPG 
 -rootdir C:\test\ 
 -username apps -password apps 
 -dbconnection "(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.160.129)(PORT=1522))(CONNECT_DATA=(SID=VIS121)))"  

You can also export the files from database using jdr_utils package, which is explained in my other blog JDR_UTILS.

Related Links: OAF: Exception in thread "main" java.lang.UnsupportedClassVersionError: Bad version number in .class file

Feel free to point out if anything is missing/wrong in this blog.

Wednesday, 20 May 2015

OAF: Exception in thread "main" java.lang.UnsupportedClassVersionError: Bad version number in .class file

Recently when I was trying to import a page XML into a R12.1.3 instance in a VM using XMLImporter, I got the below error:
 Exception in thread "main" java.lang.UnsupportedClassVersionError: Bad version number in .class file  
     at java.lang.ClassLoader.defineClass2(Native Method)  
     at java.lang.ClassLoader.defineClass(ClassLoader.java:719)  
     at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:160)  
     at java.net.URLClassLoader.defineClass(URLClassLoader.java:254)  
     at java.net.URLClassLoader.access$100(URLClassLoader.java:56)  
     at java.net.URLClassLoader$1.run(URLClassLoader.java:195)  
     at java.security.AccessController.doPrivileged(Native Method)  
     at java.net.URLClassLoader.findClass(URLClassLoader.java:188)  
     at java.lang.ClassLoader.loadClass(ClassLoader.java:306)  
     at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:268)  
     at java.lang.ClassLoader.loadClass(ClassLoader.java:251)  
     at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)  
     at java.lang.Class.forName0(Native Method)  
     at java.lang.Class.forName(Class.java:164)  
     at oracle.adf.mds.tools.util.ConnectUtils.getDBConnection(ConnectUtils.java:165)  
     at oracle.jrad.tools.xml.importer.XMLImporter.importDocuments(XMLImporter.java:228)  
     at oracle.jrad.tools.xml.importer.XMLImporter.main(XMLImporter.java:84)  
Reason:
Wrong java version was referenced, because the I didn't run the environment file.

I was getting the below details when I run "java -version"
 java version "1.5.0_08"  
 Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_08-b03)  
 Java HotSpot(TM) Client VM (build 1.5.0_08-b03, mixed mode, sharing)  
Solution:
Source the environment using the .env file, before trying to run the import command. Once the environment file is run, it will set the environment variables. You need to run this before running any utilities.

In some cases, it will be configured to run automatically.

The command I used :
 . /oracle/r12/VIS121/apps/apps_st/appl/APPSVIS121_ebs121-vm.env  
I got the below details when I run "java -version" after sourcing the environment.
 java version "1.6.0"  
 OpenJDK Runtime Environment (build 1.6.0-b09)  
 OpenJDK Client VM (build 1.6.0-b09, mixed mode)  

Hope this helps someone.

Feel free to point out if anything is missing/wrong in this blog.