Friday, December 21, 2012

Log to Weblogic logs files from your code. | Weblogic - Java programming: Tips



This is an attempt to gather some of the things I have struggled with initially so I decided to blog some tips and tricks so I can come back to them and others can benefit too:

  • Easy Log from your component: 
There are various ways to implement logging, but the simplest way is to log using "System.out.println" and "System.err.println". These are not good long term and production ready way to achieve this, but this blog is for getting your feet wet in this area, and this should suffice, allowing one to concentrate on the main task at hand. Please come back and re-factor to fix this later.
So to ensure that your logs are recognized by weblogic and saved in the appropriate files, you will have to turn on this feature. Go to Console (url:port/console, login, (left panel)/Environment/(right panel)Servers > AdminServer > Logging -> General (open advanced)
Home >Summary of Environment >Summary of Servers >AdminServer > Logging … advanced
And check “Redirect stdout logging enabled” & “Redirect stderr logging enabled”.
Bow you can simply write commands like
System.out.println(“Message”);
AND
System.err.println(“error”)
I would suggest that you create a new class called
customMessageHandler, and expose two static functions
logMessage(String msg) and logErr(String err) and call these in these functions. This way when you come back to re-factor, you can make your changes in one location.



Sachin
BuzzClan LLC

Thursday, October 4, 2012

Custom links on header

My current client wants to implement custom help for their users. We implemented this by removing the default help link on the header and replacing it with one of our own.

The steps to remove the default help link is as follows:

Log in as admin (weblogic) and go to the Administration section


Search for the text 'Help Menu'


and change the permission to 'Denied'



Log out and log back in - the header should not have the 'Help' Menu link anymore.


Now setting up the custom help. I am assuming that you have a link setup for that. Let's say Yahoo has decided to host our help on their home page. What we need to do next is to setup a menu which points to yahoo's home page.

Custom menu needs to be configured using the file -

<BIInstance>\bifoundation\OracleBIPresentationServicesComponent\coreapplication_obips1\customlinks.xml

http://docs.oracle.com/cd/E25178_01/bi.1111/e10541/answersconfigset.htm#BABHAEIF

The documentation related to this feature mentions that this location is the default location for the file, and if we make changes to this the file at this location, the menus will start working. But we found out that this is not the case, and we have to make changes to the configuration file to ensure that the system knows to bring this file in play.

A bug was opened with Oracle Support to figure this out - (14669527 - CUSTOM LINKS NOT WORKING AND CRASHING THE SERVER)

Support came back with this correction:

There appears to be 2 issues with the doc:
.
1) The "default location" is not picked up unless the tags are added to
instanceconfig.xml:
<ServerInstance>
<CustomLinks>
<filePath>c:/mydir/mysubdir/customlinks.xml</filePath>
</CustomLinks>
</ServerInstance>
This is the reason the changes make no effect.

2) The example XML in the doc is actually invalid. There are 3 lines which
need correcting
(i)
<link id="l1" name="OTN" description="OTN open in new window"
src="http://www.oracle.com" target="blank" >
<locations>
<location name="header"> /
</locations>
</link>
.
should be
.
<link id="l1" name="OTN" description="OTN open in new window"
src="http://www.oracle.com" target="blank" >
<locations>
<location name="header"/>
</locations>
</link>
.
.
(ii)
<link id="l3" name="Yahoo" description="Yahoo" src="http://www.yahoo.com"
target="yahoo" iconLarge="common/helptopics_lg_qualifier.png">
<locations>
<location name="getstarted"> /
</locations>
</link>
.
should be
.
<link id="l3" name="Yahoo" description="Yahoo" src="http://www.yahoo.com"
target="yahoo" iconLarge="common/helptopics_lg_qualifier.png">
<locations>
<location name="getstarted"/>
</locations>
</link>
.
.
(iii)
<link id="l5" name="Gmail" description="gmail" src="http://www.gmail.com"
target="blank" iconLarge="common/gmail.png" >
<locations>
<location name="getstarted"> /
<location name="header" insertBefore="catalog" />
</locations>
</link>
.
should be
.
<link id="l5" name="Gmail" description="gmail" src="http://www.gmail.com"
target="blank" iconLarge="common/gmail.png" >
<locations>
<location name="getstarted"/>
<location name="header" insertBefore="catalog" />
</locations>
</link>
.
.
(essentially the terminating slash of the "location" tag has been placed
outside the tag when it should be the last character before the ">".)
.
when I made these changes it worked fine for me.
.
ACTION PLAN FOR SUPPORT
-----------------------
Please ask your customer to correct this on their system and retest.


Once we fixed this the menus started working - see the screen shot above, we added the OTN link

Epilogue: If we change the menu link for Help, we loose the 'context sensitiveness' of the help. In a later article I will describe how we restored that feature in our custom help solution.

Sachin
JainSys

Tuesday, July 31, 2012

OBIEE - Being used in a product - Vertafore



Quote:

"Recognizing the growing importance of empowering the insurance industry to turn ever-increasing amounts of data into real insight that can help drive business growth, Vertafore (http://www.vertafore.com, @Vertafore) announced that it plans to integrate the Oracle Business Intelligence suite, providing enhanced reporting across the Vertafore product portfolio."

Vertafore Helps Customers Tackle Big Data with Oracle Business Intelligence

Sachin
JainSys

Wednesday, March 7, 2012

Patching OBIEE 11g

Working with a company like Verizon gives us the opportunity to interact with Oracle Development and support team very closely. Recently as I was doing a proof of concept implementation using the  "Scorecard" functionality, I came across a couple of bugs.

Oracle Support provided me with a couple of patches for the bugs and I will take this opportunity to describe the process of getting the patch built and then installing them on the target machines.

Once the SR(Service Request) is acknowledged as a bug, the support representative will get the current status of your machine on which the patches needs to be installed. In my case this was my development machine a Windows 7 64bit machine. They want to ensure that the current version/built installed on the machine and if any other patches are installed on it or not. This enables them to build and ship a specific patch for the installation.

The installation comes with a utility called - OPatch which takes care of the various functions around patching. A detailed documentation of this is available at Oracle:Patching Oracle Software with OPatch.
I will describe the usage and my experience for OBIEE 11g.

Here are a few things to know before we start the discussion (Specific to OBIEE 11g): I am using the Windows directory convention. Please see my earlier blog ERP Things: OBIEE 11g - Demystifying the directory structure.
OBIEE home directory : This is the directory where the OBIEE Instances are installed. In my case this happens to be c:\Oracle\BI1g\Oracle_BI1 This should be set as the ORACLE_HOME
  • OPatch Directory : The opatch directory under the ORACLE_HOME
  • Java Directory relative to ORACLE_HOME %ORACLE_HOME%\jdk\jre\bin
For patching, make sure that these system variables are set properly:
  • ORACLE_HOME
  • PATH - this should include the ORACLE_HOME and the OPatch directory
Command to set these are (Windows version):

c:>Set ORACLE_HOME=C:\Oracle\BI11g\Oracle_BI1
c:>Set path=%PATH%;ORACLE_HOME;%ORACLE_HOME%\OPATCH

During your conversation with the support staff, they will ask you to send the current status of your installation. the SR will have an entry like this:
Have any patches been applied?
Set the ORACLE_HOME environment variable to point to the BI Home.
---------------------------------------------------------------------------------
a). Please logon to the middle tier where BI installed and make sure
your ORACLE_HOME and PATH variables are set.
PATH Variable should include the directory path for perl and opatch.
ORACLE_HOME environment variable should point to the BI Home
b). Then cd to $ORACLE_HOME/Opatch and run the command:
$opatch lsinventory
c). Upload the output file.
---------------------------------------------------------------------------------

This is the standard blurb they use irrespective of the OS you are on. So for Windows the translation is as follows:

a. Set the Path and Oracle path variables to point to the Oracle Home (see commands above)
b. cd to %ORACLE_HOME%\opatch and run the command "opatch lsinventory"
c. upload the output file

This will create a file in the ORACLE_HOME\cfgtoollogs\opatch\ directory (opatch_history.txt) copy the content of this file and update your SR, also make sure you upload this file to the SR. This will also backup any previous log files in the directory.

After some time, the support will provide you with a patch. Download the patch and expand it to a local directory. Repeat the steps to ensure that the path and oracle_home variables are set properly

The readme file with the patch will have the following instructions:
Pre Install Instructions:
---------------------------------------------------------------------------
- Set the ORACLE_HOME environment variable,
  for example "[MW_HOME]/Oracle_BI1" directory.


Install Instructions:
---------------------

1. Unzip the patch zip file into the PATCH_TOP.
   unzip -d PATCH_TOP pxxxxxxx_xxxxxx_MSWIN-x86-64.zip
2. Set your current directory to the directory where the patch is located.
   cd PATCH_TOP/xxxxxxxx
3. Run OPatch to apply the patch.
   Run following command:
   - opatch apply -jre $ORACLE_HOME/jdk/jre

---------------------------------------------------------------------------

Here is my set of instructions:
1. Shut down the BI Server - Use the
C:\Oracle\BI11g\instances\instance1bifoundation\OracleBIApplication\coreapplication\StartStopServices.cmd stop_all
2. Set your current directory to the directory where the patch is located.
   cd PATCH_TOP/xxxxxxxx
2. Replace the command in the 3rd step to this and run this:
opatch apply -jre %ORACLE_HOME%\jdk\jre
3. Restart the services

If everything goes well, you system will be patched! Run the
opatch lsinventory
command once more to capture the latest patch information!

 Though I have not tried this, in case something goes wrong use this rollback the patch.
 opatch rollback -id xxxx  -jre $ORACLE_HOME\jdk\jre


Sachin
JainSys

What is Zero Trust Architecture?