Sunday, November 28, 2010

Validating incoming String of Date format using Regular Expression

I was recently trying to restrict the format of the incoming variable so as to adhere it to the date format like 27-Nov-2010 04:17:37 PM. Well, this had to be pretty simple by using the xp20:matches function that can be used to match a string pattern against a regular expression. I used my function as

xp20:matches(bpws:getVariableData('inputVariable','payload','/ns3:PropertyDetails/ns3:PropertyValueToUpdate'), '^(0[1-9]|[12][0-9]|3[01])[- /.](Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)[- /.](19|20)\d\d (0[1-9]|1[012])[:](0[1-9]|[12345][0-9])[:](0[1-9]|[12345][0-9]) (AM|PM)$')

Ooops. This was not working and but telling me Internal Xpath Error. Well the reason was that getVariableData() function gets the data from the XML schema element in Object format rather than in String. Finally, all I did was that I used the string() function to convert the object from variable data and it worked without any issue.

xp20:matches(string(bpws:getVariableData('inputVariable','payload','/ns3:PropertyDetails/ns3:PropertyValueToUpdate')), '^(0[1-9]|[12][0-9]|3[01])[- /.](Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)[- /.](19|20)\d\d (0[1-9]|1[012])[:](0[1-9]|[12345][0-9])[:](0[1-9]|[12345][0-9]) (AM|PM)$')

Just a small learning…

Saturday, November 27, 2010

Provider ABCS not able to read the data while transform, Default Part Name not correct

I started working on AIA 3.0 with SOA and developed a simple Worker interface that fetches the data from a table and transfers it to Provider ABCS.

But while running it, I faced the 2 errors.
The first error that I faced was at the time of compilation. Well, that was seemingly a bug which was worked around.

Later, when I was testing the process, it behaved strange in a way that the all records travelled till Provider ABCS Receive activity properly but did not get Transformed. The Transform activity payload looked empty as shown below. 

      <part  name="XxbbIntgWorkersCollection">
           <XxbbIntgWorkersCollection />
I tried various things for this. But later found that the problem was with Provider ABCS. While constructing the PABCS using service constructor, it created the SyncWorkerProvABCSImpl.WSDL (<ProjectName.WSDL>) message part as
  <message name="SyncWorkerReqMsg">
        <part name="SyncWorkerEBM"   

However, looking at the transformation I noticed that actual data is coming into the part with name SyncWorkerListEBM instead of SyncWorkerEBM. Hence as my transform by default was trying to access the data from the SyncWorkerEBM part, it was not getting any data resulting in empty transformation output variable. I changed the above code as following and it worked like a charm.

  <message name="SyncWorkerReqMsg">
     <part name="SyncWorkerListEBM" 

The same has been raised to Oracle but till they come up with something, we need not stop. Let’s be going…

Tuesday, August 10, 2010

Oracle Fusion Middleware Console not showing up properly : Screen Reader Setting

Yesterday I was looking at my friend’s FMW and it was not displaying the details properly. It showed something like below with radio buttons and partially visible table content.
Well, this is not any problem but just an accessibility option. The solution is pretty simple. To correct this, go to Oracle FMW Console > Setup >  My Preferences Menu Item > Accessibility Menu Item > Uncheck I use a screen reader. This will solve the problem. 

Wednesday, July 28, 2010

How to install AIA 3.0 from scratch? AIA 3.0 Installation : Important Tips and Tricks...

Undoubtedly, it was a little challenge while trying to install AIA 3.0. Firstly the long Installation guide and very generic error descriptions  leave you nothing but perplexed, secondly, my OS being MS Vista adds fuel to the fire. But, despite all the odds, what matters most is that AIA 3.0 runs successfully on my Laptop (Neeraj-PC). However, just to save the time of world's greatest developers, I'm writing this post to give some of the tips and tricks that I found while installing. Hope they find it useful.

Note: For OS other than Windows the commands will change accordingly.
Processor : Intel Core 2 Duo 2.00 GHz
RAM : 3 GB
OS : Microsoft Windows Vista Home Premium (32 bits)

Below are the steps that I followed to install AIA

  1. Install Oracle Database 11g (
    • Download the Oracle database installable as zip files and extract them to a single directory. Make sure when you start the installation, there is only one folder having all the contents of both the zips. The easy way is multi-select both the zips and say Extract to some folder.
    • Proceed with the steps. I chose Desktop Class, Enterprise Edition and did not install Loopback Adapter.
    • Proceed with the steps and after successful installation check the Enterprise Manager console using http://<host_name>:<port_number>/em as in my case http://Neeraj-PC:1158/em.
  2. Create schemas using the Repository Creation Utility (rcu)
    • While creating the schemas, I gave all the schemas the same password. However, you can opt to give different passwords as desired.
  3. Install Weblogic server 11g R1 (10.3.2)
    • I installed using Sun JDK without any Loopback Adapter 
  4. Install Oracle SOA Suite (
    • Study the software and hardware requirements before installing and also gather the necessary supporting documents as Installation guide, Administration guides etc.
    • Follow the installation guide and install the WLS. After installation do not wonder if you are not able to see the soa_server1 folder under <Middleware>/user_projects/domains directory. It will come when you start your managed server first time using the startManagedWeblogic soa_server1.
  5. Finally Installing the AIA 3.0
    • Go through the Hardware-Software requirements carefully and download the AIA installable from Oracle e-delivery website. Also download the following supporting documents from Oracle Support
      • Oracle Application Integration Architecture Foundation Pack 11g Release 1 ( Installation Guide - [Doc No :E17949-01]
      • Known Issues and Workarounds for Oracle Application Integration Architecture Foundation Pack 11gR1 [Note ID : 1087180.1] 
    • While following the installation guide and preparing for installation, pay attention to the steps mentioned below.
    • Configuring JVM Parameters - Instead of modifying the file setDomainEnv.cmd, make the change in the setSOADomainEnv.cmd as this file seems to override all the changes in the other domain files. Set the if condition as described. if "%PROCESSOR_ARCHITECTURE%"=="AMD64" (    set USER_MEM_ARGS=%PORT_MEM_ARGS%) else (    set USER_MEM_ARGS=-Xms1024m -Xmx1024m -XX:PermSize=512m XX:MaxPermSize=512m )
    • Enabling remote JDBC Connection - Make this argument as true in both .cmd and .sh files to avoid any confusions. 
    • Setting up Timezone - Firstly verify the current timezone in the database from the sqlprompt(by running sqlplus.exe) using SELECT SESSIONTIMEZONE FROM DUAL;Then you can set it to whatever you want using ALTER SESSION SET TIME_ZONE = ‘EST’;. Don’t close this sql prompt window till AIA installation is complete as it is maintained only for a session. Specify the same time zone in the weblogic managed server start too as given in the guide. Don’t specify any timezones like +5:30 to avoid any errors.
    • Configure your node manager properly and Start your SOA server using the Node Manager before installation. Learn How.
    • Go ahead with your AIA installation using the AIA Installer. While installation, at the time of Deployment Configuration step it will say sometimes as Failed due to Unable to reserve space in Heap. Click Retry. Close all open programs and make sure there is enough memory available as specified in the USER_MEM_ARGS. It should solve the error next time.
    • After the installation is successful, go to the WLS console and set the user permissions as shown below.

    • Verify the installation from the AIA Console http://<localhost:soa_server_port_number>/AIA

Wednesday, June 30, 2010

Starting Admin and Managed Servers using Node Manager and WLST

Node Manager is a WebLogic Server utility, independent of domains, that enables you to start, shut down, and restart Administration Server and Managed Server instances from a remote location. You can further use the Node Manager to control Administration Server and Managed Server from a local location also as I used in my case. Below post explains how you can start your Admin and Managed servers from the Node Manager.

Note : I have used Windows Vista OS and Oracle Database 11.2. All the commands for Linux/Unix will change accordingly.

Please follow the following steps for the same.

1.) Firstly configure the Node Manager
2.) Verify the Node Manager
3.) Once you verify and complete the above steps, I recommend, stop and close everything open till now. Then follow the following steps.
Start your Node Manager using <Middleware_Home>\wlserver_10.3\server\bin\startNodeManager.cmd command from the command prompt.

  • Open a fresh command prompt window and run WLST.cmd from <Middleware_Home>\wlserver_10.3\common\bin\WLST.cmd.
  • Next task is to connect to the Node Manager using nmConnect(). In the WLST console window type nmConnect('weblogic','welcome1','neeraj-pc','5556','soa_domain').
  • Once connected to Node Manager the command prompt will change.
  • Now to start your Admin server type nmStart() e.g. nmStart('AdminServer')
  • To start your managed server type nmStart() e.g. nmStart('soa_server1')
  • If it gives the success notification, you are done. Also, you can verify the same from the Weblogic Console.

    Part 2 : How to start the Node manager and Verify that it is running properly

    After the Node Manager is properly configured, you can start the Node Manager by following the below mentioned steps.

    • Open a new command window and go to <Middleware_Home>\wlserver_10.3\server\bin using cd command. Type startNodeManager and press Enter.
    • It starts your Node Manager and gives the output as shown in below image.

    • To verify if the Node Manager is running successfully, start your Admin Server if it is not Running and go to Weblogic Server Console.
    • Navigate to Environment --> Machines --> LocalMachine --> Monitoring Tab --> Node Manager Status. It should display Reachable. See below image.
    • Hence the Node Manager is running properly.

    Part 1: How to configure the Node Manager to start Admin and Managed Servers

    Before you can use the Node Manager utility, you need to configure/verify the Node Manager. 
    • For this start the Admin Server as usual by running the <Middleware_home>\user_projects\domains\soa_domain\startWebLogic.cmd.
    • Go to Weblogic Console and navigate to Machines-->LocalMachine-->Configuration Tab-->Node Manager Tab. Specify the ListenAddress (where Node Manager will run) and ListenPort as per you installation. By default the port is 5556. Be sure to provide the exact URL/Host name in ListenAddress as localhost will disallow starting the servers from remote location. See below image.

    • Go to <Middleware_home>\wlserver_10.3\common\nodemanager\ Set StartScriptEnabled=true.
    • Start WLST from <Middleware_home>\wlserver_10.3\common\bin\wlst.cmd in a separate command prompt window. You can double click on the wlst.cmd also to start WLST.
    • Once WLST starts, connect to Admin Server from the WLST console. To connect type the connect() command on the WLST console and press Enter. Accept defaults or provide inputs as required. Once it connects successfully, the WLST prompt will change to wls:/mydomain/serverConfig>.
    • Now type nmEnroll(<Middleware_home>\user_projects\domains\soa_domain). This command enrolls the current machine with the Node Manager and creates some properties file (,SerializedSystemIni.dat).
    • If the message displays as "Successfully enrolled this machine with the domain directory at", Enrollment is successful. 
    • Exit from the WLST console using the exit() command and shut down your Admin Server and Close the Browser Console window.
    • Node Manager is configured. Further, to start the Admin and Managed Servers from this Node Manager, refer to this post. 

    Thursday, April 29, 2010

    Client side Error Handling with validateRegExp on Decimal fields

    There are undoubtedly more than one ways of handling the errors gracefully for your ADF inputText component. One of which is at the Model Layer using Validation at the Entity Objects the details of which can be seen here.
    However, in some of the cases where we have an editable table dropped on the page and we need to provide the validation on all its fields, some of which are decimals, the various ways would be to use the various validators and converters as described here. However, this post describes 2 ways to handle the errors on the Decimal fields.

    Note : To demonstrate the use of Decimal fields I've created a column Weight in the Employees table. Further I've created an Employees Entity Object, View Object and Application Module.

    I also created a jspx page to Create/Update an Employee

    Using the Validate Double Range :
    Drag the validateDoubleRange validator from the Component Pallette under the JSF Core Menu and rop it under the inputText component. Remove ConvertNumber if any present. Just specify the range here as shown below.

    At run time whenever an error occurs it shows the result in the following format.

    However, the limitations of using this approach are :

    • You can not customize the message.
    • The Error messages are displayed after Submitting the page which involves a server call.

     Many times customers want client side validation messages in JavaScript alert boxes. The second approach demonstrates the same.

    Using validateRegExp :
    Validate Regular expression is a very efficient means to check for any format of the STRINGS. But unfortunately it can not be used for Numerical or Decimal data types. Even if you try to drop a validateRegExp validator under inputText, it works properly in case of errors but in case of correct value it throws an exception.

    500 Internal Server Error
    java.lang.IllegalArgumentException: 'value' is not of type java.lang.String. at oracle.adf.view.faces.validator.ValidatorUtils.assertIsString( at oracle.adf.view.faces.validator.RegExpValidator.validate( at oracle.adf.view.faces.component.UIXEditableValue.validateValue( at oracle.adf.view.faces.component.UIXEditableValue.validate( at oracle.adf.view.faces.component.UIXEditableValue._executeValidate( at oracle.adf.view.faces.component.UIXEditableValue.processValidators( at oracle.adf.view.faces.component.ChildLoop$Validate.process( at oracle.adf.view.faces.component.ChildLoop.runAlways( at oracle.adf.view.faces.component.ChildLoop.runAlways( at oracle.adf.view.faces.component.UIXColumn.processValidators( at oracle.adf.view.faces.component.UIXCollection.processComponent( at oracle.adf.view.faces.component.TableUtils$3.process( at ...

    To remove this error, just change the data type of your attribute to String in the Entity Object as shown under. Please note the same Entity Object can be used for other View Objects also. Hence make sure that all the View Objects are in tact.

    So everything is set. Just run the page now and see the output.

    Friday, April 2, 2010

    no cache policy header, USE_APPLICATION_VIEW_CACHE not working properly

    Problem : 
    When I try to open a dialog box from my  page, I get the following error.

    Apr 2, 2010 12:24:22 PM oracle.webcache.adf.config.AFCConfigFactory getConfig
    INFO: ADF Config did not find the AFC config 
    Apr 2, 2010 12:24:22 PM oracle.webcache.adf.config.AFCConfigFactory getConfig
    SEVERE: Error in config : Cannot locate config file. Using default values
    Apr 2, 2010 12:24:22 PM oracle.webcache.adf.config.AFCConfigFactory getConfig
    SEVERE: Error in config. Using default values
    Apr 2, 2010 12:24:22 PM oracle.webcache.adf.filter.PageCachingProcessor getResponseFromCache
    INFO: page (__ADFv__) cache miss
    Apr 2, 2010 12:24:22 PM oracle.webcache.adf.filter.PageCachingProcessor isResponseCacheable
    INFO: response not cacheable - no cache policy header
    Apr 2, 2010 12:24:22 PM oracle.webcache.adf.filter.PageCachingProcessor getResponseFromCache
    INFO: page (PPAPListDialog.jspx) cache miss
    Apr 2, 2010 12:24:22 PM aam.tooling.managedbeans.LoggedUserInfo
    INFO: In Logged User Info Bean...
    Apr 2, 2010 12:24:22 PM oracle.webcache.adf.filter.PageCachingProcessor isResponseCacheable
    INFO: response not cacheable - no cache policy header

    Due to this error, the following things happen.

    • I keep on getting the Row Currency Error on navigating time and again to my dialog pages.
    • I have an attachment dialog with command link to save the attachment on user's system. It often refers to the firstly clicked attachment always even when I have clicked on the different link this time.
    • It does not update the dialog view properly. Sometimes newly added rows do not get displayed there.

    Solution :
    After a long study it was clear that it has something to do with the cache. But I just wondered where. Finally it was  USE_APPLICATION_VIEW_CACHE in the web.xml file. I set it to false and all the above mentioned errors went.
    Although more information about USE_APPLICATION_VIEW_CACHE  can be found here but there is no reference that I could make why this be causing problem in my application. But still if you face the same problem (probably when it's a day before the UAT as in my case), you can give a thought to apply this solution.

    Friday, February 26, 2010

    Can not start Jdeveloper : Unable to create instance of Java Virtual Machine

    I had not thought that Jdeveloper 10g may throw some error depending on my disk space even. When I tried to restart my Jdeveloper, it popped up an error message to me as shown below. 

    When Jdeveloper starts it tried to allocate some some heap size from the disk space. If that space is not avilable this error is popped up.

    The same can be easily resolved by changing the AddVMOption parameter value to the desired value.

    Location : JDEV_HOME\jdev\bin\jdev.conf
    Parameter : AddVMOption
    Value : <Any valid disk space value in MB>

    # Set the maximum heap to 512M
    AddVMOption -Xmx1024M

    If you have lot of available disk space it is better to have this heap size around 1024 MB to accelerate the context switching of Jdeveloper.

    Sunday, January 31, 2010

    Setting the current row of a view object with custom key programmatically

    I came across a use-case where I needed to set the key of a View Object manually through the backing bean. Usually setCurrentRowWithKey() or setCurrentRowWithKeyValue() can be used to set the current row of a view object. But What if you don't know the exact key but part of it and you want to create the key yourself and set the current Row programmtically.  Well you can use the following function on click of a command button or customize it happily to put to any specific use...

        public String setNewRowKey() {
            // Get the iterator displayed on the Page
             FacesContext ctx = FacesContext.getCurrentInstance();
             Application app = ctx.getApplication();
             ValueBinding bind = app.createValueBinding("#{bindings}");
             DCIteratorBinding iter = ((DCBindingContainer) bind.getValue(ctx)).findIteratorBinding("DepartmentsEmployeeVOIterator");
             if (iter == null) {
               throw new RuntimeException("Iterator not found");
             // Create the key manually. It requires providing all primary keys for all 
             // the Entity Objects included in the View Object
             Object [] keyValues = new Object[2];
             keyValues[0] = null;  // Any Department
             keyValues[1] = "114"; // Employee ID
             // find all the rows matching the above criteria using the RowSetIterator. 
             // You can also use the same to find rows matching any key criteria.
             Row [] rows = iter.getRowSetIterator().findByKey(new Key(keyValues), -1);
             if (rows.length > 0)  {
                 // get the first row and its key and set current row of iterator with this key string
            return "navigation-rule";

    Tuesday, January 19, 2010

    "AWT-EventQueue-0" java.lang.ArrayIndexOutOfBoundsException: 0

    While trying to run Application Module in Jdeveloper, I got the following error.
    Exception in thread "AWT-EventQueue-0" java.lang.ArrayIndexOutOfBoundsException: 0
    at oracle.sql.NUMBER._fromLnxFmt(
    at oracle.sql.NUMBER.toString(
    at oracle.sql.NUMBER.stringValue(
    at oracle.jbo.domain.Number.toString(
    at javax.swing.table.DefaultTableCellRenderer.setValue(
    at javax.swing.JTable.prepareRenderer(
    at javax.swing.plaf.basic.BasicTableUI.paintCell(
    at javax.swing.plaf.basic.BasicTableUI.paintCells(
    at javax.swing.plaf.basic.BasicTableUI.paint(
    at javax.swing.plaf.ComponentUI.update(
    at javax.swing.JComponent.paintComponent(
    at javax.swing.JComponent.paint(
    at javax.swing.JComponent.paintWithOffscreenBuffer(
    at javax.swing.JComponent.paintDoubleBuffered(
    at javax.swing.JComponent._paintImmediately(
    at javax.swing.JComponent.paintImmediately(
    at javax.swing.RepaintManager.paintDirtyRegions(
    at javax.swing.SystemEventQueueUtilities$
    at java.awt.event.InvocationEvent.dispatch(
    at java.awt.EventQueue.dispatchEvent(
    at java.awt.EventDispatchThread.pumpOneEventForHierarchy(
    at java.awt.EventDispatchThread.pumpEventsForHierarchy(
    at java.awt.EventDispatchThread.pumpEvents(
    at java.awt.EventDispatchThread.pumpEvents(
    BC4J Tester exit code(0)

    As a basic human nature, I searched on the internet to find out that it was a bug as reported here.

    But the same was fixed in Jdeveloper Then why did it bug me now. It was then I realized that I had synchronized my Entity Object with the database. I opened one of my entity object and was wondering to see the Type of one of the attributes as String although it was a Number, something similar to this.

    So I just modified all the Attribute types according to the ones in the database and hurrah it was working fine.

    Saturday, January 9, 2010

    Clear values in Search form fields

    I have designed a Search form to search for specific records based on search criteria. But once I have searched I want to clear the criteria fields to conduct a fresh search. There are 3 ways

    1. Reset the bind parameters of the view objects by calling them in the bean that can be found at the below links.

    2. Use ResetButton to reset the form parameters. But it will reset the form fields’ values to the previous search criteria parameters.

    3. The third way originates from the user experience. According to my experience users are least concerned about the VO bind parameters being refreshed or not, but what they actually want is to clear the form instantly and preferably with no server call that means on the client-side itself. The reason for the same is that all countries/clients/users do not have very fast internet as to virtually diminish the time taken to reset the form. Hence this method came up to clear the search form using Java Script. This way might not be suitable for all the situations and also does not replace the other two mentioned above but still it is very much efficient and helpful to provide the end-users pleasant experience.
    All you have to do is follow the below 3 steps and it is done.
    • Change your search form to <af:form> instead of <h:form>. After this the form looks like this.
    <af:form id="searchForm">
       <af:panelPage title="Clear Search Form Parameters Example">

       <af:inputText id="firstName" value="#{bindings.TheFirstName.inputValue}"    label="#{bindings.TheFirstName.label}" required="#{bindings.TheFirstName.mandatory}"  columns="#{bindings.TheFirstName.displayWidth}">
          <af:validator binding="#{bindings.TheFirstName.validator}"/>
       <af:inputText id="salary" value="#{bindings.TheSalary.inputValue}"  label="#{bindings.TheSalary.label}" required="#{bindings.TheSalary.mandatory}" columns="#{bindings.TheSalary.displayWidth}">
       <af:validator binding="#{bindings.TheSalary.validator}"/>
    • Create a Clear CommandButton as shown below and set the onClick property as clearAllFormFields() function.
       <af:commandButton actionListener="#{bindings.ExecuteWithParams.execute}" text="Search"  disabled="#{!bindings.ExecuteWithParams.enabled}"/>
       <af:commandButton text="Clear" onclick="return clearAllFormFields();"/>

    • Now add the scriptlet function in the jspx page as shown below.
    <script type="text/javascript">
       function clearAllFormFields(){
          //check if the object is not null. The object will be null when it is not rendered on the page  or is disabled. 
          if(document.forms["searchForm"].elements["firstName"] != undefined)

         if(document.forms["searchForm"].elements["salary"] != undefined)
         return false;

    And it is done. Now just test run the page.