Thursday, March 17, 2011

How to install and configure Webutil on Oracle Application Server 10g/Developer 10g both on Windows/Linux

Setup WebUtil for Developer Suite 10g or Oracle AS 10g


WebUtil is a powerful component in Oracle Form 9i,10g, but setting up WebUtil is a nightmare for most of the developer. I hope the guideline below is useful for people who wish to setup WebUtil at Windows environment.

Steps to setup WebUtil in Developer Suite / Oracle Application Server
***********************************************************

1.  Download Webutil_106.zip & Jacob Library from following paths:



2.  Extract the zip files into Copy the files to the specified folders
  • frmwebutil.jar, forms_base_ie.js and forms_ie.js
    • From Folder: webutil_106\webutil_106\java  To: $ORACLE_HOME/forms/java
  • d2kwut60.dll, JNIsharedstubs.dll and sign_webutil.bat
    • From folder: webutil_106\webutil_106\webutil To: $ORACLE_HOME/forms/webutil
  • jacob.jar 
    • From folder: jacob_18  To: $ORACLE_HOME/forms/java
  • jacob.dll
    • From folder: jacob_18 To: $ORACLE_HOME/forms/webutil
  • webutil.olb, webutil.pll and create_webutil_db.sql
    • From folder: webutil_106\webutil_106 To: $ORACLE_HOME/forms
  • webutilbase.htm, webutiljini.htm, webutiljpi.htm and webutil.cfg
    • From folder: webutil_106\webutil_106\server To: $ORACLE_HOME/forms/server
     
3.  Modify the default.env file
You can find this file at C:\DevSuiteHome_1\forms\server\default.env
  • Append webutil file's path in FORMS_PATH entry
    • ;C:\DevSuiteHome_1\forms\webutil
  • Append frmwebutil.jar, jacob.jar file's path into CLASSPATH entry
    • ;c:\DevSuiteHome_1\forms\java\frmwebutil.jar;c:\DevSuiteHome_1\forms\java\jacob.jar;C:\oracle\DevSuiteHome_1\jdk\jre\lib\rt.jar
  • Make sure WEBUTIL_CONFIG entry as
    • C:\DevSuiteHome_1\forms\server\webutil.cfg

4.  Add frmwebutil.jar and Jacob.jar path entries into Windows Registry 

  • Start > Run > type regedit and press enter
  • HKEY_LOCAL_MACHINE > Software > Oracle > KEY_DevSuiteHome1 > FORMS_BUILDER_CLASSPATH and add following entry at the end 
    • c:\DevSuiteHome_1\forms\java\frmwebutil.jar;c:\DevSuiteHome_1\forms\java\frmall.jar;c:\DevSuiteHome_1\forms\java\jacob.jar;

Note: if you are using Linux then instead of this setup the environment variable.


5.  Modify the formsweb.cfg file,
You can find this file at C:\DevSuiteHome_1\forms\server\formsweb.cfg


Append following entries
# Forms applet archive setting for JInitiator
archive_jini=frmall_jinit.jar,frmwebutil.jar,jacob.jar
# Forms applet archive setting for other clients (Sun Java Plugin, Appletviewer, etc)
archive=frmall.jar,jfrmall_jinit.jar,frmwebutil.jar,jacob.jar

At webutil section (at the bottom), you also have to confirm the entries as

[webutil]
WebUtilArchive=frmwebutil.jar,jacob.jar
WebUtilLogging=off
WebUtilLoggingDetail=normal
WebUtilErrorMode=Alert
WebUtilDispatchMonitorInterval=5
WebUtilTrustInternal=true
WebUtilMaxTransferSize=16384
baseHTMLjinitiator=webutiljini.htm
baseHTMLjpi=webutiljpi.htm
archive_jini=frmall_jinit.jar
archive=frmall.jar
lookAndFeel=oracle


6.  Modify the webutil.cfg file (Optional)
You can find this file at  C:\DevSuiteHome_1\forms\server\webutil.cfg

#transfer.database.enabled=FALSE (default value)
transfer.database.enabled=TRUE
#transfer.appsrv.enabled=FALSE (default value)
transfer.appsrv.enabled=TRUE


7.  Signing frmwebutil.jar and Jacob.jar. (make sure form builder is closed)
On Dos Prompt Sign frmwebutil.jar and jacob.jar with following commands

C:\DevSuiteHome_1\forms\webutil>sign_webutil.bat c:\DevSuiteHome_1\forms\java\frmwebutil.jar

Output
Generating a self signing certificate for key=webutil2...
...successfully done.

Backing up C:\oracle\DevSuiteHome_1\forms\java\frmwebutil.jar as C:\oracle\DevSuiteHome_1\forms\java\frmwebutil.jar.old...
1 file(s) copied.
Signing C:\oracle\DevSuiteHome_1\forms\java\frmwebutil.jar using key=webutil2...
...successfully done.

C:\DevSuiteHome_1\forms\webutil>sign_webutil.bat c:\DevSuiteHome_1\forms\java\jacob.jar

Output
Generating a self signing certificate for key=webutil2...
keytool error: java.lang.Exception: Key pair not generated, alias already exists
.
There were warnings or errors while generating a self signing certificate. Please review them.
.
Backing up C:\oracle\DevSuiteHome_1\forms\java\jacob.jar as C:\oracle\DevSuiteHome_1\forms\java\jacob.jar.old...
1 file(s) copied.
Signing C:\oracle\DevSuiteHome_1\forms\java\jacob.jar using key=webutil2...
...successfully done.


8.  Configuration of webutil in database.

  • Open sqlplus and connect with sys as sysdba credentials.
  • Run / execute create_webutil_db.sql. This script will create webutil package in the database user.
  • You need to make this package available to all users. For this execute following command with sys user.
    • create public synonym webutil_db for webutil.webutil_db; 
    • grant execute on webutil_db to public;
    • Commit;

9.  How to use Webutil on Form Development Environment?
  • Open Form builder & connect with any user 
  • Open Webutil.pll file in oracle forms builder located at C:\DevSuiteHome_1\forms\ and press (Shift+Ctrl+K), and generate plx.
  • Open WebUtil.olb object group in oracle form builder and copy / subclass it into your oracle form as
    • Add webutilconfig into parameter node.
    • Add webutil into object group node.
  • Attached the Webutil.pll library to your form with remove path option YES.
  • Compile the PLL file
  • Start OC4J Instance
  • Add following code on when_new_form_instance or any other place where you wan
    • declare 
    • fake_timer TIMER;
    • begin
    • fake_timer:= CREATE_TIMER('webutil',100,NO_REPEAT);
    • end;
  • Add when_timer_expired trigger and add following code
    • :global.user_home := webutil_clientinfo.get_system_property('user.home');
  • Now create 1 text item and 1 push button  in block and show on canvas also
  • Behind push button write the code
    • :text_field:=webutil_clientinfo.get_system_property('user.home');
  • Now compile & run your form.
  • When form loaded then browser will ask to certify these libraries first time, choose always certify.
  • Check java console icon on the taskbar to verify the frmwebutil.jar and jacob.jar loaded successfully. 
On Linux you may compile the library with below command: 
a.frmcmp module=ORACLE_HOME\forms\webutil.pll userid= module_type=library compile_all=yes

In case, you like above material, please remember me in your prayers.