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 });
newPackage = (PackageDefImpl)mth.invoke(MetaObjectManager.getSingleton(), new Object[] { true });
} catch (Exception ex) {
         throw new JboException(ex);
MetaObjectManager.insertSessionMetaObject(newPackage.getFullName(), newPackage);
ViewDefImpl reportParamsViewDef = new ViewDefImpl(packagePath + "." + viewName);
reportParamsViewDef.setFullName(packagePath + "." + viewName);
try {
    setParentMth.invoke(reportParamsViewDef, new Object[] { newPackage });
   } catch (Exception ex) {
   throw new JboException(ex);
  return reportParamsViewDef;

Many thanks to  who started the whole topic with oracle support

No comments:

Post a Comment