“MDS_INTERNAL_SHREDDED” has errors … while starting Oracle WebCenter Portal

I got below error while starting Oracle WebCenter Portal server with on Oracle XE 10g database.

MDS-01370: MetadataStore configuration for metadata-store-usage “OWSM_TargetRepos” is invalid.
ORA-04063: package body “DEV_MDS.MDS_INTERNAL_SHREDDED” has errors
ORA-06508: PL/SQL: could not find program unit being called: “DEV_MDS.MDS_INTERNAL_SHREDDED”

When this error happen WebCenter Portal Managed Server is not started.
Please follow below steps to resolve the issue.

  • Stop server
  • Drop the all related database schemas using RCU.
  • Connect to XE database using sqlplus command through command prompt.
  • Connect sys as SYSDBA and provide a password for SYS user

    alter system set sga_target=350M scope=spfile;
    alter system set sga_max_size=350M scope=spfile;
    shutdown immediate
    startup

  • set RCU_JDBC_TRIM_BLOCKS=TRUE environment variable and run RCU to create schemas again.
  • Verify if RCU_JDBC_TRIM_BLOCKS set properly.

    set RCU_JDBC_TRIM_BLOCKS=TRUE Echo % RCU_JDBC_TRIM_BLOCKS % — this has to return TRUE

    Now run rcu.bat in same command prompt window and create required schemas.
    Note : This issue will happen only on XE 10g database.

Insert Rows in ADF View Object Programatically

Suppose that I have EmpVO view object which have below attributes
EmpId, FirstName, LastName

We can do inserting rows by two ways in data model layer (Application Model or View Object classes)
I will write my code in ApplicationModuleImpl class

try
{
    ViewObject vo=this.getEmpVO();
    Row r=vo.createRow();
    r.setAttribute("EmpId","id#1");
    r.setAttribute("FirstName","fn#1");
    r.setAttribute("LastName","ln#1");
    vo.insertRow(r);
    this.getDBTransaction().commit();
}catch(Exception e){
    e.printStackTrace();
}

How to pass Service Name or SID in JDBC URL

Below is the way to send either Service Name or SID in JDBC URL to connect to Oracle SQL

For Service Name

@//host_name:port_number/service_name
For example:
jdbc:oracle:thin:scott/tiger@//myhost:1521/myservicename

For SID

@//host_name:port_number:service_name
For example:
jdbc:oracle:thin:scott/tiger@//myhost:1521:myservicename

Oracle DOC

When and how much to mix technologies for a project?

The main idea behind using a technology is to harness the power of code re-usability and libraries that have already been worked on and trusted to be working and functional with minimal or no issues.

The term “Technology” does not just refer to Java or C++ or JavaScript. It also refers to the frameworks that can be used to suffice some or the other requirements with minimum cost and minimal effort investment. One example can be any Application Development Framework Like Oracle ADF, Pega or Drupal, etc. The framework itself provides functionalities that are most common and also takes cares of the issues that people face while developing an application.

Any application which has to be developed from scratch needs a lot of work just to be useful enough to be used in Production environment. Basic Non-functional requirements such as MVC Architecture, Security safeguards, Application Performance, etc. are the basic and most common features of the application. In addition, Secure Login, User Registration and authentication, role mapping and similar features are also mandatory features of the application.

Most frameworks provide features such as configurable work flows, built in UI Elements, security aspects and many other features. Features such as SQL Escaping, HTML Tag Escaping and MVC Pattern architecture are generally already inbuilt to the framework. The developers can simply configure the workflows, create screens and corner out application logic and then the application is good to go.

But is that enough that we may need??

This the main question that we need to ask when trying to select technologies and try to mix them to achieve the application requirement. The Case study can be a sample B-2-B Application say Business-2-Go (B2G).

Advantage of Techs to be selected:

The B2G can be based on 3 major technology products namely an Identity Management System, an Application Development Framework, and a Content Management Service. The technologies in combination provide the architecture to harness the features out of the box.

The IDM would provide Session Maintenance, Role Mappings, Access Authentications and invalid access handling.

CMS on the other hand takes care of the static content of the application. This technology handles the application content which needs to be configurable but would be changed in very rare scenarios. The main usefulness lies in the fact that the CMS portal can be exposed to the customer admin team as well and be comfortable as the code base will not be touched by the Non Development User.

The ADF constitutes to the application flow of the B2G. All user interactions and other business logic is handled by this technology. The flexibility of the framework helps create applications quickly and more efficiently than the older technologies/frameworks such as J2EE Servlets/JSP or struts and so on.

Further technologies like JavaScript, jQuery, CSS have been used to achieve the look and feel that was decided by the client.

Disadvantages of Techs to be selected:

The disadvantages or rather limitations of the tech or the team using the tech is the one that decides whether the tech can be used or not.

The major factors can be:

  • Cost: The technology that has been perfected and supported may be in most cases be licensed. Thus incurring costs to the budget of the project. The alternative may be using Open Source technologies/frameworks. But there the problem exists of the credibility of the source, issue support and whether documentation is enough or not.
  • Resource Availability: Assuming that the cost barrier of the license has been overcome. Now the major concern is whether the resources for the technology are available or not. If not, then can existing resources be trained or can new resources can be acquired. Again the cost factor is affected in this concern.
  • Technology Limitations: Technologies have limitations in themselves also. The limitation may not be a feature that cannot be achieved, but the effort that may be involved in achieving the feature. A simple example may be a particular look and feel of a B2G. Many of the UI Elements may or may not be achievable with the selected core ADF. Or even if they are achievable, it is after a lot of R&D or with lot of hit and trials. Though this is not something that may rule out the technology itself, but may be enough to include other technologies like jQuery into the picture.
  • Interfacing efforts: While mixing technologies, spots/hooks need to be found where 1 tech may latch on to or may be placed in with the other. For example, jQuery is an Independent Tech and in the selected ADF, generally has an internal client side scripts are functioning on its own end. There may be provisions which execute scripts that achieve the UI functionalities. Similarly the CMS may not have stable out of the box connectors to code layer of the application. Thus interfaces are written to implement make this possible. This effort may also turn out to be a concern for using a tech.

An example of tech selection may be PHP. The technology PHP can also be used for creating a complete application and 99% of the same application can be achieved using PHP frameworks. In fact the cost of the tech is 0 (Open Source) and resource costing would be way lower than those of licensed application framework. But the efforts and timescale needed to achieve all the functionalities required will be humongous. Thus ruling out the tech.

Another concern that can be raised is how much the technologies can be mixed. Surely each of the frameworks will be providing some or the other comfort or a feature. Even if they are published in open source or you may have license available. Does that mean that all technologies should be mixed..??

Interfacing technologies uses effort. It also invokes limitations. An example may be the various attempts to integrate popular front-end framework like AngularJS with Oracle ADF. Oracle ADF is a mainly a Server Side Technology, maintaining all functionalities server side and providing a wide palette of features for an application. AngularJS on the other hand is a completely UI framework. It is completely Client Side Intensive Tech. Both frameworks are completely in the opposite directions. Both are unaware of the other. There are blogs showing way how to integrate both the technologies. But all can point out the issues in the integration. This is a small example, but scaling this, similar issues may be faced and thus may be counted as factors in Tech Selection.

In Conclusion, the trade-offs govern the selections of the technologies to be used in a project. Proper selections must be made in order to plan out the architecture. Improper selection may lead to issues, crashes, late deliveries or redundant costs.

References:

Image: https://www.systrends.com/sites/default/files/banner/appdev_banner2.jpg

How to add DVT Graph Programmatically

This tutorial is to show how to inject a DVT graph programmatically in Oracle ADF

Step 1: Define a List Data Model:

Java Code for Data

        List<Object[]> listObject = null;
        if (listObject == null) {
            listObject = new ArrayList<Object[]>();
            Object[] obj1 = { "Example_Bar_1", "Series_1", 10 };
            Object[] obj2 = { "Example_Bar_1", "Series_2", 15 };
            Object[] obj3 = { "Example_Bar_1", "Series_3", 75 };
            listObject.add(obj1);
            listObject.add(obj2);
            listObject.add(obj3);
        }

JSFF Code where the code will be injected:

<?xml version='1.0' encoding='windows-1252'?>
<jsp:root xmlns:jsp="http://java.sun.com/JSP/Page" version="2.1"
 xmlns:f="http://java.sun.com/jsf/core"
 xmlns:h="http://java.sun.com/jsf/html"
 xmlns:af="http://xmlns.oracle.com/adf/faces/rich"
 xmlns:dvt="http://xmlns.oracle.com/dss/adf/faces">
 <jsp:directive.page contentType="text/html;charset=windows-1252"/>
 <f:view>
 <af:document title="demo" id="d1">
 <af:form id="f1">
 <af:panelGroupLayout id="pgl1" styleClass="container" binding="#{backingBeanScope.graphBean.container}"/>
 </af:form>
 </af:document>
 </f:view>
</jsp:root>

Java Code to inject Graph @ Runtime:

[Note]:container is the binding to the af:panelGroupLayout under which you wish to inject the graph
        List<Object[]> listObject = null;
        if (listObject == null) {
            listObject = new ArrayList<Object[]>();
            Object[] obj1 = { "Example_Bar_1", "Series_1", 10 };
            Object[] obj2 = { "Example_Bar_1", "Series_2", 15 };
            Object[] obj3 = { "Example_Bar_1", "Series_3", 75 };
            listObject.add(obj1);
            listObject.add(obj2);
            listObject.add(obj3);
        }
        UIGraph graph = new UIGraph();
        graph.setGraphType(UIGraph.PIE);
        graph.setTabularData(listObject);
        container.getChildren().add(graph);

Result:

2015-08-14_1742

 

How to add ValueChangeListener Programmatically

Using an EL String, we can add ValueChangeListener in Oracle ADF using the below code:

private static MethodBinding getValueChangeListener(String el) {
        Class[] parms = new Class[] { ValueChangeEvent.class };
        MethodBinding mb =
            FacesContext.getCurrentInstance().getApplication().createMethodBinding(el,
                                                                                   parms);
        return mb;
    }

pass the EL Expression to the util method

ui.setValueChangeListener(getValueChangeListener("#{pageFlowScope.demoBean.valueChangeListener}")); 

 

How to Add an ActionListener programmatically

Using an EL String, we can add ActionListener in Oracle ADF using the below code:

private ActionListener getActionListener(String el) {
        //here Testbean is the name of ManagedBean
        MethodExpression methodExp = getMethodExpressionForAction(el);
        return new MethodExpressionActionListener(methodExp);
    }
private MethodExpression getMethodExpressionForAction(String actionName) {
        Class[] argtypes = new Class[1];
        argtypes[0] = ActionEvent.class;

        FacesContext facesCtx = FacesContext.getCurrentInstance();
        Application app = facesCtx.getApplication();
        ExpressionFactory elFactory = app.getExpressionFactory();
        ELContext elContext = facesCtx.getELContext();
        return elFactory.createMethodExpression(elContext, actionName, null, argtypes);
    }

pass the EL Expression to the util method

ui.addActionListener(getActionListener("#{pageFlowScope.demoBean.actionListener}")); 

 

Enable/Disable Proxy Service in OSB via ANT+Python

Below is the configurable code for developers to maintain an ant script to be able to control(Enable/Disable) Proxy Services via Ant Script.

Files:


WLSTbuild.properties

weblogic.home.dir=<OSB Home>/wlserver_10.3
weblogic.lib.dir=${weblogic.home.dir}/server/lib


build.properties

fmw.home=<OSB Middleware Home>
wls.username =<Weblogic User Id>
wls.password =<Weblogic Password>
wls.server = t3://:<Weblogic Host>:<Weblogic Port>
service.script=osb_enable_service.py
service.project="<Project Name>/<Sub Project Name or 'ProxyServices' >"
service.name =<Proxy Name>
service.action = <disable/enable>


build.xml

<?xml version="1.0" encoding="windows-1252" ?>
<project name="ServiceControl" default="ServiceControl">
   <property file="./build.properties"/>
   <property file="./wlstbuild.properties"/>
   <taskdef classname="weblogic.ant.taskdefs.management.WLSTTask" name="wlst">
      <classpath>
         <pathelement location="${weblogic.lib.dir}/weblogic.jar"></pathelement>
      </classpath>
   </taskdef>
   <target name="ServiceControl">
      <echo>${weblogic.lib.dir}</echo>
      <wlst filename="${service.script}" debug="true" failonerror="false"
            arguments="${wls.username} ${wls.password} ${wls.server} ${service.project} ${service.name} ${service.action}">
         <classpath>
            <pathelement location="${weblogic.lib.dir}/weblogic.jar"></pathelement>
            <pathelement location="${fmw.home}/<OSB Installation Folder>/lib/sb-kernel-api.jar"></pathelement>
            <pathelement location="${fmw.home}/<OSB Installation Folder>/lib/sb-kernel-impl.jar"></pathelement>
            <pathelement location="${fmw.home}/<OSB Installation Folder>/lib/osb-coherence-client.jar"></pathelement>
         </classpath>
      </wlst>
   </target>
</project>

osb_enable_service.py

from com.bea.wli.sb.management.configuration import SessionManagementMBean
from com.bea.wli.sb.management.configuration import ALSBConfigurationMBean
from com.bea.wli.config import Ref
from java.lang import String
from com.bea.wli.monitoring import StatisticType
from com.bea.wli.config import Ref
from com.bea.wli.sb.util import Refs
from com.bea.wli.sb.management.configuration import CommonServiceConfigurationMBean
from java.lang import String
from com.bea.wli.monitoring import StatisticType
from com.bea.wli.config import Ref
from com.bea.wli.sb.util import Refs
from com.bea.wli.sb.management.configuration import CommonServiceConfigurationMBean
adminUser = sys.argv[1]
adminPassword = sys.argv[2]
adminUrl = sys.argv[3]
project = sys.argv[4]
service = sys.argv[5]
action = sys.argv[6]
connect(adminUser,adminPassword,adminUrl)
domainRuntime()
print('WLST Connected')

Create a session name

sessionName = String("SessionScript"+Long(System.currentTimeMillis()).toString())
print('... after session. Session is: ', sessionName)

Get the session MBean and create a session

sessionMBean = findService(SessionManagementMBean.NAME,SessionManagementMBean.TYPE)
print('SessionMBean is: ', sessionMBean)
sessionMBean.createSession(sessionName)
print(String('Session was created ... ').concat(sessionName))

Get the ProxyServiceConfigurationMBean specific to our session

mbean = findService(String("ProxyServiceConfiguration.").concat(sessionName),'com.bea.wli.sb.management.configuration.ProxyServiceConfigurationMBean')

Creates a reference to a folder and 'ProxyServices' is a folder in the project and 'ProxyServices' is a folder in the project

projectName = Refs.makeParentRef(project + '/')
proxyRef = Refs.makeProxyRef(projectName, service)
if action == 'disable' :
print "Disabling " + service +" has been completed"
mbean.disableService(proxyRef)
else :
print "Enabling " + service +" has been completed"
mbean.enableService(proxyRef)

Now commit (activate) the changes

sessionMBean.activateSession(sessionName, "disabled PS")
print
disconnect()
exit()

Place all files in a single folder.

From CMD, Navigate to folder and just call ant

Verify from OSB Portal, the service will be in disabled/enabled format in Operational Settings Tab.

How to install Web Center Portal

Installing Oracle Web Center Portal has the following steps:

  • Download and Install:
    1. Weblogic Server 10.3.6 <!! 12c would not work, Only 11g Release 2 !!>
    2. Web Center Portal
      F
      ollow the complete steps or follow the wizard as shown:
      install_welcome
      install_software_updates
      install_prereqs
      install_location
      install_app_server
      *Please Note: Weblogic option will not be available if the Server version mentioned in the previous step is not 10.3.6. 12c will not work
      install_summary
      install_progress
      install_complete
    3. Database XE(Optional. install only if you dont have database already installed)
    4. RCU
      • In CMD, Open file

        <Download_folder>ofm_rcu_win_11.1.1.8.0_64_disk1_1of1rcuHomeBIN

      • Follow the below steps to install RCU:
        2015-05-05_1724 2015-05-05_1725 2015-05-05_1726 2015-05-05_1726_001 2015-05-05_1727 2015-05-05_1729 2015-05-05_1729_001 2015-05-05_1729_002 2015-05-05_1729_003 2015-05-05_1730 2015-05-05_1730_001 2015-05-05_1731 2015-05-05_1731_001 2015-05-05_1809
  • Configure Domain Config:
    2015-05-05_1818

    2015-05-05_1818_001
    2015-05-05_1819
    2015-05-05_1819_001 2015-05-05_1819_002

    2015-05-05_1820
    2015-05-05_1821
    2015-05-05_1822
    2015-05-05_1822_001
    2015-05-05_1822_002 2015-05-05_1822_003