Sunday, February 8, 2015

Retrieve audit trail from Dehydration Store 11g Oracle SOA Suite composite

Purpose:
How to retrieve the audit trail from 11g dehydration store


Environment:
Oracle 11g SOA suite
Windows environment
Access to the dehydration store DB

How to
I will try to retrieve the audit trail without using the java API. As per documentation the AUDIT_TRAIL table contains the audit trail for the message.

I have assumed we already have the instance id for the message. Execute the below query to retrieve the details.

select CIKEY from CUBE_INSTANCE 
 where CMPST_ID = [INSTANCE_ID] order by CREATION_DATE desc;

select * from AUDIT_TRAIL AT1
    
WHERE AT1.CIKEY = [CIKEY]
    ORDER 
BY AT1.COUNT_ID;



Save all the LOG columns into a file in order. Say instance_id.0, instance_id.1, instance_id.2 etc. The number of columns depend upon the size of the audit trail.

Open command prompt in windows and execute the below command. Edit the command to add all the LOG columns in order as saved in previous step.


copy /b instance_id.0 + instance_id.1 + instance_id.2 instance_id.zip



The output file instance_id.zip can be unzipped to retrieve the text file that contains the audit trail.

Tuesday, November 25, 2014

WebLogic deployment time compilation


The WebLogic server can be configured to precompile your JSPs when a Web Application is deployed or re-deployed or when WebLogic Server starts.

1.     Configuring deployment time compilation

In weblogic.xml add the marked in yellow.

<weblogic-web-app xmlns="http://xmlns.oracle.com/weblogic/weblogic-web-app">
                <context-root>applicationctx</context-root>
                <jsp-descriptor>
                                <precompile>true</precompile>
                                <precompile-continue>true</precompile-continue>
                </jsp-descriptor>
</weblogic-web-app>

The above will ensure deployment time compilation of the JSPs.

The verbose errors are displayed in the console log when precompile is set to true, regardless of the precompile-continue value.

Note
This feature needs to be tested with the applications. Some of the check performed may cause issues. Some errors may need to be fixed for deployment time compilation to be successful.

2.     Updating deployment time compilation using plan.xml

The below deployment plan updates the values of precompile and precompile-continue to false during deployment.

<deployment-plan xmlns="http://xmlns.oracle.com/weblogic/deployment-plan" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://xmlns.oracle.com/weblogic/deployment-plan http://xmlns.oracle.com/weblogic/deployment-plan/1.0/deployment-plan.xsd">
  <application-name>applicationctx</application-name>
  <variable-definition>
                                <variable>
                                                <name>Precompile_jsp</name>
                                                <value>false</value>
                                </variable>
                                <variable>
                                                <name>Precompile_continue_jsp</name>
                                                <value>false</value>
                                </variable>
                </variable-definition>
                <module-override>
                                <module-name>application-web-3.0.0.0.war</module-name>
                                <module-type>war</module-type>
                                <module-descriptor external="false">
                                                <root-element>weblogic-web-app</root-element>
                                                <uri>WEB-INF/weblogic.xml</uri>
                                                <variable-assignment>
                                                                <name>Precompile_jsp</name>
                                                                <xpath>/weblogic-web-app/jsp-descriptor/precompile</xpath>
                                                                <origin>planbased</origin>
                                                                <operation>replace</operation>
                                                </variable-assignment>
                                                <variable-assignment>
                                                                <name>Precompile_continue_jsp</name>
                                                                <xpath>/weblogic-web-app/jsp-descriptor/precompile-continue</xpath>
                                                                <origin>planbased</origin>
                                                                <operation>replace</operation>
                                                </variable-assignment>
                                </module-descriptor>
                </module-override>
  <config-root>D:\Users\sashwat.gupta\applicationctx\config</config-root>
</deployment-plan>


3.     Suggested Approach

  • Disable JSP compilation in weblogic.xml
  • Use development transition plan to enable this and test [this will ensure correctness of JSPs]
  • Disable in production deployment plan [To reduce the startup time for the applications]

4.     Identified issues in applications

4.1.                     Tag Imports

In an application the imports were mentioned as

<%@ page import="java.util.*"%>
<%@ page import="java.io.*"%>

These imports were incorrect as per specifications and were giving errors while deployment time compilation. This was corrected by changing to

<%@tag import="java.util.*"%>
<%@tag import="java.io.*"%>

Sample error in weblogic console:

weblogic.servlet.jsp.CompilationException: Captcha.tag:2:5: The page directive is not valid in tag files.
<%@ page import="java.util.*"%>
    ^--^
Captcha.tag:2:5: The page directive is not valid in tag files.
<%@ page import="java.util.*"%>
    ^--^
Captcha.tag:3:5: The page directive is not valid in tag files.
<%@ page import="java.io.*"%>
    ^--^
Captcha.tag:3:5: The page directive is not valid in tag files.
<%@ page import="java.io.*"%>
    ^--^
Captcha.tag:4:5: The page directive is not valid in tag files.
<%@ page import="javax.servlet.*"%>
    ^--^
Captcha.tag:4:5: The page directive is not valid in tag files.
<%@ page import="javax.servlet.*"%>
    ^--^

4.2.                     Tags not closed

<html:hidden property="property" value="${ property}"> was changed to

<html:hidden property="property" value="${ property}"/> to close the html tag.

4.3.                     Page Encoding provided multiple times

Due to JSP includes the page encoding was being imported multiple times.
<%@ page pageEncoding="utf-8" %>

The page encoding was made unique and only put in the header jsp to solve the issue.