Saturday, 27 December 2014

Create 12c SOA Application and SOA Project by using Maven


Create SOA Application and SOA Project by using Maven

Prerequisite: Maven setup in Jdeveloper 12c

To use maven to create SOA application and SOA project we should setup maven in developer machine.

Step1: In cmd prompt, setup below env variables
                set JAVA_HOME=C:\Program Files\Java\jdk1.7.0_25
                set PATH=%JAVA_HOME%\bin;%PATH%
                set ORACLE_HOME=D:\Fusion12C\Oracle\Middleware\Oracle_Home
                set M2_HOME=<ORACLE_HOME>\oracle_common\modules\org.apache.maven_3.0.5
                set PATH=%M2_HOME%\bin;%PATH%

Step2: Run below mvn cmd to create soa application and soa project.
mvn archetype:generate -DarchetypeGroupId=com.oracle.soa.archetype -DarchetypeArtifactId=oracle-soa-application -DarchetypeVersion=12.1.3-0-0 -DarchetypeRepository=local

Fill below details in CMD prompt:
[INFO] Generating project in Interactive mode
[INFO] Archetype defined by properties
Define value for property 'groupId': : com.test
Define value for property 'artifactId': : SOA12cApplicationWithMVN
Define value for property 'version':  1.0-SNAPSHOT: :
Define value for property 'version':  1.0-SNAPSHOT: :
Define value for property 'package':  com.test: :
[INFO] Using property: adf = .adf
[INFO] Using property: data = .data
Define value for property 'projectName': : SOA12cProjectWithMVN
Confirm properties configuration:
groupId: com.test
artifactId: SOA12cApplicationWithMVN
version: 1.0-SNAPSHOT
package: com.test
adf: .adf
data: .data
projectName: SOA12cProjectWithMVN
Y: :Y

NOTE: If first time you are running "generate" maven goal then you may get error says that "maven goal or respective POM file is not available in maven repositery". If you see this kind of error then execute below maven goal. Below mvn cmd will download all required mvn jar files and pom files.
--> mvn archetype:generate

Step3: If we observe physical folders where we created SOA application and SOA Project , we dont have .jws and .jpr files.
Step4: Now open SOA application in JDeveloper 12c by following below steps.





Now we can see SOA application and SOA project in Jdeveloper12c.
We can see .jws and .jpr files in physical file system.


Step5: Now we can implement required business logic in composite.

Step6: Once we create required business logic we can deploy soa project in to SOA server.
For deployment we can use traditional deployment process by using jdeveloper.
In this post i want to show you steps to deploy soa project with maven goal.

--> mvn pre-integration-test

NOTE: If you are using this mvn cmd first time then it will download all required prerequisite jars and pom files.

If you get this kind of error, then you have to modify project level pom file with required server properties as shown below.

Modify the server details in your project level pom file, in which server you want to deploy the program. I am using integrated SOA server in JDeveloper so i provided local host details, you should provide as per your server environment.

NOTE:
Project level pom file available in "<mywork>\<application name>\<project name>\pom.xml"

Now run the mvn cmd to deploy SOA project.
--> mvn pre-integration-test

Step7: We can see deployed soa project in enterprise manager.




Maven Set up in JDeveloper 12C

Maven Set up in JDeveloper 12C

Prerequisites : First we should install JDK 1.7 and JDeveloper 12.1.3.0.0

Step1: open cmd prompt

Step2: set environment variables in cmd prompt
        set JAVA_HOME=C:\Program Files\Java\jdk1.7.0_25
        set PATH=%JAVA_HOME%\bin;%PATH%
        set ORACLE_HOME=D:\Fusion12C\Oracle\Middleware\Oracle_Home
        set M2_HOME=<ORACLE_HOME>\oracle_common\modules\org.apache.maven_3.0.5
        set PATH=%M2_HOME%\bin;%PATH%
NOTE: set the variables as per your machine.

Step3: Now we need a way to get the necessary artifacts into developers machines local Maven repository. Oracle provides the Maven Synchronization plug-in for this. So now we need install the plugin to local maven repository by using below MVN cmd.

mvn install:install-file -DpomFile=oracle-maven-sync.12.1.3.pom -Dfile=oracle-maven-sync.12.1.3.jar

NOTE:
"oracle-maven-sync-12.1.3.jar" and "oracle-maven-sync-12.1.3.pom" are available in below location.
These two files comes with JDev12c installation at below location.
%ORACLE_HOME%/oracle_common/plugins/maven/com/oracle/maven/oracle-maven-sync/12.1.3/



Step4: Next step is to execute the plugin in order to import the Oracle Maven artifacts, including the Parent POM necessary for deploying our SOA composite.

mvn com.oracle.maven:oracle-maven-sync:push -Doracle-maven-sync.oracleHome=D:/Fusion12C/Oracle/Middleware/Oracle_Home



NOTE: After completing execution of above command now we can see Parent POM in below location.
C:\Users\Fusion\.m2\repository\com\oracle\soa\orabpel\12.1.3-0-0
Parent POM file Name : orabpel-12.1.3-0-0.pom
we can use this file as parent for all pom.xml files which created along with SOA 12c projects.
In this file we can store global parameters like deployment server, user and password. Of-course we can discuss this in my next post.



Thats it, now maven is ready in your machine to execute MVN cmd's.

Maven Life cycle:
--> mvn validate
Ensure that the project is correct and all necessary information is available.
--> mvn compile
Compile the source of the project
--> mvn test
Test the compiled source code using a suitable unit testing framework; tests should not require the code to be packaged or deployed.
--> mvn package
Take the compiled code and package it in its distributable format, such as a JAR, WAR, EAR, SAR, or GAR files.
--> mvn integration-test
Process and deploy the package, if necessary, into an environment where integration tests can be run.
--> mvn verify
Run checks to verify whether the package is valid and meets quality criteria.
--> mvn install
Install the package into the local repository for use as a dependency in other projects locally.
--> mvn deploy
For the final release, copy the final package to a remote repository for sharing with other developers and projects.

By using mvn we can execute maven archetypes like below.
--> mvn archetype:generate
To create a SOA application and SOA Project with required SOA package structures and ID's.
--> mvn pre-integration-test
To deploy all soa projects in SOA application.

Few more maven goals and archetypes are available, we can discuss them in my next post.







Sunday, 14 December 2014

Rightnow adapter setup in oracle soa 12c Jdeveloper

Rightnow adapter setup in oracle soa 12c Jdeveloper
 S
As we know about new release of SOA 12c suite, i want to introduce few concepts of integration between SOA 12c and oracle rightnow system.
One of the important feature in soa 12c suite is cloud adapters. Oracle is providing salI x z s bneforce adapter and rightnow adapter as part of cloud integration.
When we install Jdeveloper12.1.3 version by default we can see salesforce adapter but we dont have rightnow adapter along with default jdeveloper setup.
To get rightnow adapter in Jdeveloper we have to install a path with Opath utility.

In this post i want to provide steps to setup rightnow adapter in jdevloper.

Step1:  download RightNowAdapter_121300_Patch.zip from Oracle Technology Network.

url :  http://www.oracle.com/technetwork/middleware/adapters/downloads/index.html

Step2:  unzip RightNowAdapter_121300_Patch.zip.
After unzip we can see below folders and files.


Setp3: In "Prereq_patches" folder we have 5 more zip files. These files are prerequisite patch files for p19479397_121300_Generic.zip


Step4: unzip below zip files in "PATCH_TOP" folder. (PATCH_TOP folder is a user defined folder)

Prerequisite patch files :
a. p18706071_121300_Generic.zip (after unzip folder name is 18706071)
b. p18858892_121300_Generic.zip (after unzip folder name is 18858892)
c. p19248641_121300_Generic.zip (after unzip folder name is 19248641)
d. p19423468_121300_Generic.zip (after unzip folder name is 19423468)
e. p19769394_121300_Generic.zip (after unzip folder name is 19769394)

Actual patch file :

a. p19479397_121300_Generic.zip (after unzip folder name is 19479397)



Step5: open cmd prompt with run as administrator.

Step6: we can find Opatch util in "<ORACLE_HOME>\OPatch" location.
ex: C:\JDeveloper12.1.1.3\Oracle\Middleware\Oracle_Home\OPatch

Step7: In cmd prompt enter into OPatch folder and run below cmd.
opatch version
this cmd will show us the proper version of OPatch in our machine.

Step8: Validate the OUI inventory with the following commands:
        opatch lsinventory -jre C:\Progra~1\Java\jdk1.7.0_60\jre

Step9: In cmd prompt enter into patch folder location.
ex : cd C:\PATCH_TOP\Prereq_patches\18706071

Step10: now run below cmd in cmd prompt.
<path to reach opatch file>\opatch apply

Step11: repeat step9 and 10 for all patch files as provided in above order.

Step12: restart Jdeveloper with clean parameter.
Jdeveloper.exe -clean

Step13: now we can see rightnow adapter in Jdeveloper.

In my next post i will show you how to use rightnow adapter to integrate SOA12c with rightnow system.