Sunday, March 31, 2019

PaaS - OTD marks one of the origin servers as offline/unreachable

OTD marks one of the origin servers as offline/unreachable when origin servers are using a different set of Certificates.

It can work only with a single origin server at a time.
Add the following inside  element in server.xml for origin server pool:
Path: 
/u01/data/otd-instance/otd_domain/config/fmwconfig/components/OTD/instances/otd_opc-config_xxxxxx/config

<context-pool-size>0</context-pool-size>

Tuesday, March 28, 2017

Connecting to KSS keystore to get Public/Private Key

1- Add permission to Jazn-data file indicating the strip and keystore name info 

oracle.security.jps.service.keystore.
KeyStoreAccessPermission

stripeName=system,keystoreName=*,alias=*
read,write,update,delete

2-  Use the following code to connect to key store to get certificate information a KeyPair object can be used to wrap public/private keys. You need to run this from weblogic application

public void run()
    throws JpsException {
    System.out.println(".... Reading KSS ...!");
    JpsStartup startup=new JpsStartup();
    startup.start();
    JpsContext ctx =  
     JpsContextFactory.getContextFactory().getContext();
    KeyStoreService kss = ctx.getServiceInstance(KeyStoreService.class);
    java.security.KeyStore.ProtectionParameter pwd =
    new java.security.KeyStore.PasswordProtection("password".toCharArray());
    java.security.KeyStore keyStore =
         kss.getKeyStore("system""demoidentity", pwd);
    try {
        Enumeration aliases = keyStore.aliases();
        while(aliases.hasMoreElements()){
        System.out.println(aliases.nextElement());
        }
        Key key=
        keyStore.getKey("DemoIdentity""password".toCharArray());
        System.out.println(key.getFormat());
        System.out.println(key.toString());
        RSAPrivateCrtKeyImpl key1=(RSAPrivateCrtKeyImpl)key;
        System.out.println(key1.toString());
        BASE64Encoder base64 = new BASE64Encoder();
        String privateKey=base64.encodeBuffer(key1.getEncoded());
        System.out.println("PRIVATE KEY:");
        System.out.println(privateKey);
        System.out.println("__________________________");
        X509Certificate certificate = 
           (X509Certificate)keyStore.getCertificate("DemoIdentity");
        System.out.println(certificate.getPublicKey());
    catch (Exception e) {
        e.printStackTrace();
    }
    System.out.println(".... exit ....!");
}

Wednesday, January 27, 2016

millseconds to CT date time zone

select to_char(from_tz(CAST (to_date('1970-01-01 00:00:00000','yyyy-mm-dd HH24:MI:SSSSS') +(wl_access_time)/(1000*24*60*60) AS TIMESTAMP),'GMT')at  TIME ZONE 'US/Central','YYYY-MM-DD HH:MI:SS') from wl_servlet_sessions;

Thursday, June 25, 2015

javax.xml.ws.WebServiceException: javax.net.ssl.SSLKeyException: FATAL Alert:BAD_CERTIFICATE - A corrupt or unuseable certificate was received.

Webservice call fails with BAD certificate error SSL certificate cipher signed by SH256WITHRSA. 

This cipher is not supported in weblogic server by default.

Certicom is currently the default SSL implementation in Weblogic Server. However, JSSE may be enabled as an alternative SSL implementation.The Certicom SSL implementation is currently deprecated and will be replaced by the JSSE-based implementation in a future release.


Error Text

javax.xml.ws.WebServiceException: javax.net.ssl.SSLKeyException: FATAL Alert:BAD_CERTIFICATE - A corrupt or unuseable certificate was received.



Resolution 

Use JSSE SSL Based Implementation by enabling JSSE under server_name--> SSL --> advanced



PKCS error

In case could not parse key values exception was thrown after enabling JSSE

weblogic.security.SSL.jsseadapter: SSLENGINE: Exception occurred during SSLEngine.unwrap(ByteBuffer,ByteBuffer[]).

java.lang.RuntimeException: Could not parse key values


add -Dsun.security.pkcs11.enable-solaris=false to server start Reference


http://docs.oracle.com/cd/E23943_01/web.1111/e13707/ssl.htm#SECMG494

Oracle bug document number (2001812.1)

Friday, November 21, 2014

ADF DynamicTable is not picking up iterator changes from model layer after rollback is invoked

DynamicTable isRefreshRequired method caches the ViewDefName, then it compares the cached value with actual viewDefName, if they are the same it skips child creation.

This fix was needed to force the dynamic table to refresh in case of rollback to recreate its children
                    ((DynamicTable)child).getFacesBean().setProperty(PropertyKey.createPropertyKey("ViewDefNameForTable"), null);

Tuesday, October 14, 2014

Changing ViewCriteria Operators on fly - Used to filter TreeTable elements

In this scenario I developed a search form that would filter treeTable elements based on parent child view access link.

I have Parent viewCriteria used in the page as AF:Query along with TreeTable, There is also a child viewCriteria applied to the child view, the parent view has the same query in the exists clause to filter parent items.

Parent View:
Child View:


Then use this code to filter and change view Criteria operators by passing the change of the operators from the parent view criteria to the detail one:





Monday, October 6, 2014

Make DynamicForm survive passivation/Activation - Error javax.el.PropertyNotFoundException: Target Unreachable, 'DynamicForm_dynamic_VO_form1' returned null


This was very wired error when creating viewObjects and ViewDef Objects on the fly and using dynamicForm tag.

I just used the code mentioned in Thirumalaisamy blog and created a method used as a common method when creating Def Objects.

public ViewDefImpl createDynamicViewDef(String packagePath, String viewName) {
PackageDefImpl newPackage;
java.lang.reflect.Method setParentMth;
try {
java.lang.reflect.Method mth =
MetaObjectManager.class.getDeclaredMethod("createContainerDefObject", new Class[] { boolean.class });
setParentMth = oracle.jbo.server.DefObject.class.getDeclaredMethod("setParent", new Class[] { oracle.jbo.common.NamedObjectImpl.class });
mth.setAccessible(true);
setParentMth.setAccessible(true);
newPackage = (PackageDefImpl)mth.invoke(MetaObjectManager.getSingleton(), new Object[] { true });
} catch (Exception ex) {
         throw new JboException(ex);
        }
newPackage.setDefScope(PackageDefImpl.DEF_SCOPE_SESSION);
newPackage.setName(packagePath);
newPackage.setFullName(packagePath);
MetaObjectManager.insertSessionMetaObject(newPackage.getFullName(), newPackage);
ViewDefImpl reportParamsViewDef = new ViewDefImpl(packagePath + "." + viewName);
reportParamsViewDef.setFullName(packagePath + "." + viewName);
reportParamsViewDef.setComponentClass(ViewObjectImpl.class);
try {
    setParentMth.invoke(reportParamsViewDef, new Object[] { newPackage });
   } catch (Exception ex) {
   ex.printStackTrace();
   throw new JboException(ex);
}
  return reportParamsViewDef;
}


Many thanks to  who started the whole topic with oracle support
http://thirumalaisamyt.blogspot.com/2013/04/life-of-dynamic-vo-eo-across.html

Tuesday, September 30, 2014

Dynamic Form Iterator

Great resources to create dynamic form iterator
http://andrejusb.blogspot.com/2013/03/adf-generator-for-dynamic-adf-bc-and.html

Refresh issue need to pay attention to when creating dynamic form specially when rebuilding the form on the same page, execute this before invoking the method that will recreate you dynamic VO.

https://blogs.oracle.com/groundside/entry/refresh_problems_using_adaptive_bindings

Thursday, September 18, 2014

Oracle BI set User Identifier before running report

You can set a pre process property to execute a function at database level before running some set of queries. This is can be accomplished at report DataModel layer or before BI server connects to database in JNDI pre process property and post process property.


set_pre_process_username(:xdo_user_name,'AM START','BI')

set_post_process_username(:xdo_user_name,'AM FINISH','BI')

in the example above I am passing the logged in user in BI to the database to accomplish some kind of database row filtering.

A java usage (BI publicReportService):

You can impersonate the logged\-in user in your Java application by using the impersonate and runReportInSession methods.

String sid =reportService.impersonate(biUserName, biPass, loggedInUser);
repRes = reportService.runReportInSession(repReq, sid);

Monday, September 15, 2014

Clear TreeTable or Table selectedRowKeys from MDS

table.getSelectedRowKeys().clear();
RowKeySetAttributeChange rks =
    new RowKeySetAttributeChange(table.getClientId(FacesContext.getCurrentInstance()), "selectedRowKeys",new RowKeySetTreeImpl());
            RequestContext.getCurrentInstance().getChangeManager().addComponentChange(FacesContext.getCurrentInstance(), table, rks);