One issue I faced at a current client was JNDIs being referenced in BPEL/ESB code. Time and time again, BPEL processes and ESB services written by less experienced SOA developers referenced JNDIs that were not configured on the Application Server. This caused continuous errors in the logs. This also was of particular concern due to their being a single shared Dev environment.
As a result, it was decided to script a procedure that parsed each deployed service, and checked whether it referenced an existing JNDI or not. If it did not, an email would be automatically sent to the development lead notifying him of the details.
Script Output
The output of the BPEL script is as follows:
As a result, it was decided to script a procedure that parsed each deployed service, and checked whether it referenced an existing JNDI or not. If it did not, an email would be automatically sent to the development lead notifying him of the details.
Script Output
The output of the BPEL script is as follows:
oracle@oradev1:/home/oracle/scripts> ./check_jndi_bpel.sh $ORACLE_HOMEJNDI Status JNDI Name BPEL Domain BPEL Process-------------- ----------------- -------------- --------------------Configured eis/Apps/CDHAM ebiz UpdateEBSConfigured eis/AQ/EBSAM ebiz UpdateEBSConfigured eis/AQ/EBSAM ebiz UpdateEBSConfigured eis/AQ/SOA default DataSynchronizationConfigured eis/AQ/CDHAM default DataSynchronizationConfigured eis/AQ/CDHAM default DataSynchronizationConfigured eis/AQ/SOA default DataSynchronizationNot configured eis/AQ/SOAD default CustomerPropogateOutput file created in: /home/oracle/ahmed/check_jndi_bpel.csv
The script also generates a CSV file with more detailed information (includes domain, process name, version, WSDL that was parsed):
The output of the ESB script is as follows:
The script also generates a CSV file with more detailed information (includes project name, WSDL that was parsed, JNDI, ESB service names, ESB GUIDs):oracle@oradev1:/home/oracle/ahmed> ./check_jndi_esb.sh $ORACLE_HOME /tmp/ahmedtmpJNDI Status JNDI Name ESB Service(s) using JNDI-------------- ---------------- -------------------------------------Not configured eis/DB/DEV2 <JNDI not used in any service>Not configured eis/DB/DEV2 A_112_Loc|B_112DBAdapter_RSConfigured eis/DB/EBSAM GetInvoiceCreationDBConfigured eis/DB/EBSAM InvoiceCreationOutput file created in: /home/oracle/ahmed/check_jndi_esb.csv
The Logic Behind the Scripts
For BPEL processes, the logic is simply as follows:
For BPEL processes, the logic is simply as follows:
- BPEL processes are deployed to project subdirectories located in $ORACLE_HOME/bpel/domains/<domain>/tmp.
- Parse the WSDL files in each deployed BPEL process.
- Browse for JNDI locations, which take the format <jca:address location="...>.
- Cross-reference the JNDIs with actual JNDIs configured on the Application Server (the oc4j-ra.xml files for the adapters are located under $ORACLE_HOME/j2ee/oc4j_soa/application-deployments/default/<adapter>).
- If a JNDI used in a BPEL process is not configured on the Application Server, then note the JNDI name, the WSDL file it was located in, and the BPEL process and version it belongs to.
For ESB services, the logic is as follows:
- When ESB projects are registered to the ESB server, they are deployed as zip files under $ORACLE_HOME/integration/esb/oraesb/deploy.
- Extract the zip files in a temporary location, and parse the WSDL files in each deployed ESB project.
- Browse for JNDI locations, which take the format <jca:address location="...>.
- Cross-reference the JNDIs with actual JNDIs configured on the Application Server (the oc4j-ra.xml files for the adapters are located in $ORACLE_HOME/j2ee/oc4j_soa/application-deployments/default/<adapter>).
- If a JNDI used in the ESB project is not configured on the Application Server, then note the JNDI name, the WSDL file it was located in, the ESB service(s) it belongs to, the GUIDs for the ESB service(s) (needed if you want to undeploy it via ant).
To get a copy of the scripts, please contact me.
1 comment:
I published the scripts here:
Check JNDIs in Oracle Application Server against deployed BPEL processes
Check JNDIs in Oracle Application Server against deployed ESB services
Post a Comment