Wednesday May 15, 2013

Accessing VNC Console for ODA WLS Virtual Machines 2.5

When working on the ODA patch 2.5 there maybe occasions where you need to VNC into the virtual machine to try and diagnose issues because the standard oakcli doesn't provide enough information. I believe in 2.6 a new function has been a introduced to make this easier (oakcli show vmconsole) but in 2.5 it doesn't exist.

In this example I have deployed WLS on the ODA but one of the managed server machines is not coming up correctly although the command oakcli show vm is saying all is OK.

To get a VNC console to the managed server VM I performed the following.

  1. You need to go the the VM repository. This is on either of the ODA_BASE machines. To find where this is, on the node 0 db vm run the following command:

    oakcli show vm

    NAME                                  MEMORY       VCPU            STATE           REPOSITORY

    OTD_ofm_domain_AdminNode_1              4096          2            ONLINE          odarepo2
    OTD_ofm_domain_AdminNode_2              4096          2            ONLINE          odarepo1
    OTD_ofm_domain_AdminServer              1024          2            ONLINE          odarepo2
    WLS_ofm_domain_AdminServer              2048          2            ONLINE          odarepo1
    WLS_ofm_domain_ManagedServer_1          6144          2            ONLINE          odarepo2
    WLS_ofm_domain_ManagedServer_2          6144          2            ONLINE          odarepo1

    The server I'm interested in is WLS_ofm_domain_ManagedServer_1, which is found on  odarepo2. This tells me I need to go to the repository on ODA_BASE Node 1 (I'm counting from 0). In my case this is called nlab-oda-pub2.

  2. Login as root to the ODA_BASE server that has the required repository. change directory to the following

    cd  /OVS/Repositories/odarepo2/VirtualMachines/WLS_ofm_domain_ManagedServer_1

    Please note that yours may differ, I'm connecting to the odarepo2 and vm WLS_ofm_domain_ManagedServer_1

  3. In this directory there should be a file vm.cfg. Open this up and add the following line at the top

    vfb = ['type=vnc,vncunused=1,vnclisten=']

  4. Bounce the VM with the oakcli commands:

    oakcli stop vm WLS_ofm_domain_ManagedServer_1


    oakcli start vm WLS_ofm_domain_ManagedServer_1

  5. Start a VNC session and point to the correct node. In my case I need to connect to the head machine on the second node (machine you install the ODA_BASE into). The port you need to connect to is 5901 as 5900 is taken by the ODA_BASE machine.

    This should op up the console. In this instance I can see that may network was already taken, that is why it didn't start correctly.


Monday Jun 21, 2010

Integrating Google Maps with ADF

This is a simple example how to integrate Google Maps to your ADF application.

1.  In order to run this application you must subscribe to the Google Map API. This can be done from the following web site.

This will provide you with a key to access the API at run time.

2. Before we can start our ADF application we need to create a data source. In this example I create a HOUSES table, this table provide the longitude and latitude coordinates required for Google Maps.

Use the following file to create the HOUSES table:

Use the following file for the data:

Use the following for the SQL Loader control file:

3. Execute the create_houses.sql is a SQLPlus session to a schema of your choice. I have used the HR schema.

4. Copy the HOUSES.csv and load_houses.ctl into the same directory somewhere on you OS, e.g. c:\temp.

5. From that location execute the following command, all on one line.

sqlldr userid=hr/hr control=load_houses.ctl log=load_houses.log bad=load_houses.bad data=HOUSES.csv discard=load_houses.discard

6. Check that the HOUSES table has been loaded

SQL> select count(*) from houses;


7. You are now ready to create your ADF Application. Create a new Fusion Web Application (ADF) called GoogleMap and click Next



8. Accept the defaults and click Finish


9. Right-click the model project and select New. From the gallery select Business Tier -> ADF Business Components -> Business Components from Tables


10. Create a new database connection based on the schema where you loaded the HOUSES table.


11. Query the schema and select the HOUSES table and click Next.









12. Move the HOUSES table to be selected and click Finish


13. Now the data source has been created we can implement the user interface, Right-click the ViewController project and select New


14. Select JSF Page, found in the Gallery under Web Tier -> JSF


15. Call the JSF page HouseLocation.jspx, ensure that the Blank Page radio button has been selected. Click OK


16. From the Component Pallet, drag Panel Splitter into the middle of the JSF page.


17. From the Data Control drag the HousesView1 into the First Panel. Choose Table -> ADF Read-Only Table


18. Check the Row Selection, Filtering, and Sorting checkboxes, and click OK


19. To integrate Google Maps to ADF we must customise the source to add the Google Maps APIs. Click the source tab of your jspx page.

20.  The first bit of code we will implement is the Google Map functions. There are 2 functions we create, an initialisation function, and a an implementation function so when the user selects a row it will pass the coordinates to Google Maps.

Copy this code into your jspx source, just after </af:form> and before </af:document> at the bottom of the source.

Also change the key=ABCD to the key you got when you subscribed to the Google API.

      <f:facet name="metaContainer">
        <af:resource type="javascript" source=""/>
        <af:resource type="javascript"> google.load("maps", "2.x");
                    // Call this function when the page has been loaded
                    function initialize() {
                    var map = new google.maps.Map2(document.getElementById("map"));
                    map.setCenter(new google.maps.LatLng(0,0), 1);
                    map.addControl(new GLargeMapControl());
                    map.addControl(new GMapTypeControl());
        <af:resource type="javascript">
                          function doNavigate(evt)
                          { long = evt.getSource().getProperty("long");
                            lat = evt.getSource().getProperty("lat");

                            var latlng = new GLatLng(lat,long);
                            var map = new google.maps.Map2(document.getElementById("map"));             

                            map.addControl(new GLargeMapControl());
                            map.addControl(new GMapTypeControl());

                            map.setCenter(new GLatLng(lat,long), 16);
                            map.addOverlay(new GMarker(latlng));

21. Replace the code <f:facet name="second"/> with the following

             <f:facet name="second">
                  <div id="map" style="width: 800px; height: 800px"></div>








This code draws the map in the second splitter.

22. The final code is implementing the client listeners for user interaction so when the use selects an ID the location will be shown on the map. To do this we must edit the ID field to listen for user interaction and pass the parameters to the functions implemented in step 20.

Find the code:

                <af:outputText value="#{row.Id}" id="ot2">
                  <af:convertNumber groupingUsed="false"

And replace to look like this

                      <af:outputText value="#{row.Id}">
                        <af:convertNumber groupingUsed="false"
                        <af:clientAttribute name="lat" value="#{row.Latitude}"/>
                        <af:clientAttribute name="long" value="#{row.Longitude}"/>
                        <af:clientListener method="doNavigate" type="click"/>

Save you work

23. Now it is time to test, Right-click on the HouseLocation.jspx and select Run

When the application starts in your browser, click on any ID in the ID column. The location should show on the map as shown below.


Thursday Jun 03, 2010

Calling Web Services using ADF 11g

One of the benefits of ADF is that fact that it can use multiple data sources. With SOA playing a big part in today’s IT landscape, applications need to be able to utilise this SOA framework to leverage functionality from multiple systems to provide a composite application.

ADF provides functionality to expose web services via the ADF Business Component so if you know how to use Business Components for a database. Configuring ADF for web services is much the same.

In this example I use an OSB web service that gets a customer.

  1. Create a new Fusion Web Application (ADF) Application and click OK

  2. Provide an Application Name, GetCustomerADF and click Next

  3. From the Project Technologies move Web Services into the Selected box. Accept the defaults and click Finish.

  4. Right-click the Model project and select New

  5. In the Gallery select Web Services –> Web Service Data Control then click OK.

  6. Provide a name GetCustomerDC and give the URL endpoint for the Web Service, then click Next

  7. Select the web service operation you want to use for the ADF application. In my example my web service only has one operation.

  8. Click Finish
  9. Save your work, File –> Save
  10. The data control has now been created, the next steps create the UI components.
  11. In your application created in step 1 find the ViewController project, right-click and choose New

  12. In the Gallery select JSF –> JSF Page

  13. Provide a name for the jsp page, GetCustomer, Also ensure that the ‘Create as XML Document (*.jsp) check box is checked. I have selected the page template, Oracle Three Column Layout but you can create a layout of your choice.

  14. I only want 2 columns so I delete the last column but right-clicking the right had panel and selecting Delete

  15. Drag the fields you require from the web service data control to the left pannel. In my example I only require the Customer ID. When you drag to the panel select Texts –>ADF Input Text w/Label

  16. In this example I want to search on a customer based on the ID. So Once I select the ID I want to execute the request. To do this I need a button.
    Drag the operation object under the fields created in step 15. Select Methods –> ADF Button.

  17. You now need to provide the mappings, Choose the ‘Show EI Expression Builder’

  18. Navigate to the bindings, ADFBindings –> bindings –> parametersIterator –> currentRow

  19. Click OK
  20. Drag and drop the return information

  21. I just want the results shown in a form. I want to show all fields

  22. Now it is time to test, Right-click the jspx page created in steps 11 – 21 and select Run

  23. A browser should start, enter valid values and test


Discussions and Examples using Oracle Fusion Middleware. Some image links are broken when using Firefox, Safari, and Chrome. If you want to see the full image please use IE.


tumblr hit counter vistors, thanks for your support


« April 2014