Oracle Apps Java Concurrent Program With External Jars

Share Button

Hi,

In Oracle EBS, majority of concurrent programs that we defined are pl/sql programs or reports. However, in order to meet some complex requirements, we need other types of concurrent programs such as java concurrent program or shell concurrent program.

These kind of requirements may be;

  • Implementation of SFTP.
  • Web Service Clients with JAX-WS.
  • Generating XLSX outputs.
  • Generating PDF outputs.
  • Complex business logic

In this article, I will cover the following topics;

  • Defining Java Concurrent Program With External jars.
  • JAX-WS Web Service Client in Oracle APPS.

Before moving on tutorial, implementing a java concurrent program requires much more effort and focus than pl/sql concurrent programs.

P.S: In this tutorial, I will be using Netbeans because of the JAX-WS support. As far as i know, JAX-WS Web Service clients cannot be generated by JDeveloper which comes with E-Business Suite patches. Using Netbeans for implementing java concurrent program requires just one more additional step comparing to JDeveloper.

1. During tutorial, in order to keep all of the externals organized, create a directory named “libs” in the operating system.

2. Connect to the E-Business Suite application server with a FTP Client and get “common”, “cp”, “util” folders which are located in $JAVA_TOP/oracle/apps/fnd to the “libs” folder that we created in first step. Pay attention to the exact same folder paths between “libs” and $JAVA_TOP.

 

jc_31

3. Connect to the E-Business Suite application server with a SSH client and find out which JAVA version is used with the following commands.

4. Download JDK and install it to your development environment.

5. Open Netbeans 7.4 and create a New Java Application Project.

jc_1

6. Un-check Main Class and give a proper project name which should start with “XX”.

jc_2

7. Create a new JAVA file and give proper name and package which should also start with “XX”.

jc_3

8. Left click on your project and open Project Properties. Move to the Libraries on left menu.Click to the “Add Jar/Folder” button.

jc_4

9. Choose libs folder which we created in step 1.

jc_5

10. Open the JAVA file which is created in seventh step. Implement JavaConcurrentProgram interface for your java class.

jc_8

11. Overwrite interface methods.

jc_9

 

12. Delete throw statements.

The CpContext parameter provides many context information about Concurrent Program. You can gen DB connection with following command.

In addition, apps context (user_id, resp_id, resp_appl_id) may be get from CpContext object.

13. In order to generate Web Service Client in Netbeans, related plugins need to be installed. Do the followings for installing plugin unless you have already installed.

jc_11

jc_12

jc_13

 

14. Create a new “Java Class Libary” project on netbeans. This will be the web service client jar that we will be using in our concurrent program.

jc_14

 

15. Give proper name to your project.

jc_15

 

16. Change the Java Platform of your projects to the JDK which you have already installed on fourth step. This step is very important in order to prevent “Unsupported major minor version” error on E-Business Suite application server.

jc_16

 

17. Create a new web service client on new project.

jc_17

 

18. At this point, we need an example web service. Following calculator WSDL is used in this tutorial. In order to download WSDL, click to following link:

http://soatest.parasoft.com/calculator.wsdl

19. Choose the WSDL file from your local environment. Give proper name to your package and click Finish. Netbeans will parse WSDL and generate stubs and methods that you will use in order to consume web service.

jc_18

 

20. Create a new JAVA Class.

jc_19

 

21. Change necessary information for you class.

jc_20

 

21. Move “add”, “divide”, “multiply”, “subtract” web service function to your class from Web Service References -> calculator -> Calculator -> ICalculator.

jc_21

 

22. Generate public getters and setters for your methods.

23. Clean and Build your project. This will generate jar file under dist folder in Netbeans.

24. Copy jar file to the “libs” folder that we created in first step.

25. Open the java concurrent program project properties.

jc_22

26. Move to the Libraries and Click Add Jar Folder button.

jc_23

 

27. Choose the jar file which is created at 25 step under “libs” folder.

jc_24

 

28. Change your java concurrent program class. Pay attention to the line 68 where we call web service client jar. Clean and Build project.

 

29. Upload your concurrent program java file to the application server $JAVA_TOP. Create a new custom folder in $JAVA_TOP. Upload your web service client jar to custom folder. Use the following command in order to compile your concurrent program java file. Please pay attention to -cp option in order to prevent NoClassDef error. -d option will create your .class file with the package that you specify in java file.

 

30. Create concurrent program executable as following. Pay attention to Executable File Name and Package which must be same as your java file and package.

jc_25

31. Creating Concurrent program is the most important step because all external jar files must be specified with JAVA_TOP, appsborg in OPTIONS field.

Pay attention to followings.

  1. JAVA_TOP path -> /u01/data_appl/apps/apps_st/comn/java/classes
  2. appsborg.zip location -> /u01/data_appl/apps/apps_st/comn/java/lib/appsborg.zip
  3. Your external jar files -> /u01/data_appl/apps/apps_st/comn/java/classes/xxntc/externallibs/*

Combine above steps in one -classpath statement and write it to the OPTIONS field in concurrent program.

-classpath /u01/data_appl/apps/apps_st/comn/java/classes:/u01/data_appl/apps/apps_st/comn/java/lib/appsborg.zip:/u01/data_appl/apps/apps_st/comn/java/classes/xxntc/externallibs/*

 

jc_26

 

32. Define your program parameters.

jc_27

 

33. Add program to request group.

jc_28

 

34. Switch to the request group responsibility and run the program with test parameters.

jc_29

 

Test the results:

jc_30

 

Regards 🙂