0 Replies Latest reply: Jul 23, 2014 10:23 AM by user11928564 RSS

    Recover Mediator Instance from Java Class

    user11928564

      Hi All!

      Who explain me how to recover faulted instances of Oracle Mediator in error with Java Class? I noticed that the class MediatorServiceEngine does not allow to perform the method getFaults () because it is not implemented.

      My class is:

      package com.ao;


      import java.util.Hashtable;
      import java.util.List;
      import javax.naming.Context;
      import oracle.soa.management.facade.Fault;
      import oracle.soa.management.facade.mediator.*;
      import oracle.soa.management.facade.FaultRecoveryActionTypeConstants;
      import oracle.soa.management.facade.FaultRecoveryResult;
      import oracle.soa.management.facade.FaultRecoveryServiceEngine;
      import oracle.soa.management.facade.Locator;
      import oracle.soa.management.facade.LocatorFactory;
      import oracle.soa.management.facade.mediator.MediatorServiceEngine;
      import oracle.soa.management.util.FaultFilter;


      public class FaultManagementFramework {

      private Locator locator = null;
      private MediatorServiceEngineImpl mMediatorServiceEngine;

      private FaultRecoveryServiceEngine FaultEngine;

      private FaultRecoveryResult FaultListResult;


      public FaultManagementFramework() {

        locator
      = this.getLocator();

       
      try {

        mMediatorServiceEngine
      = (MediatorServiceEngineImpl)locator.getServiceEngine(Locator.SE_MEDIATOR);

       
      } catch (Exception e) {

        e
      .printStackTrace();
       
      }
      }

      public Hashtable getJndiProps() {

       
      Hashtable jndiProps = new Hashtable();

        jndiProps
      .put(Context.PROVIDER_URL,"***********");
        jndiProps
      .put(Context.INITIAL_CONTEXT_FACTORY, "weblogic.jndi.WLInitialContextFactory");
        jndiProps
      .put(Context.SECURITY_PRINCIPAL, "weblogic");
        jndiProps
      .put(Context.SECURITY_CREDENTIALS, "***********");
        jndiProps
      .put("dedicated.connection", "true");

       
      return jndiProps;

      }

      public Locator getLocator() {

       
      try {

        
      System.out.println("Try to Connect on LNXSOAC01");
        
      return LocatorFactory.createLocator(getJndiProps());
        
      //System.out.println("Connection OK");

       
      } catch (Exception e) {

        e
      .printStackTrace();

       
      }

       
      return null;

      }

      public void recoverFaults() {

       
      try {

        
      System.out.println("=============================================================================================================");
        
      System.out.println("Oracle Fusion Middleware 11g Premium");
        
      System.out.println("Get Recoverable Faults");

        
      /*
        * SEARCH FOR FAULTS
        */


        
      //Set filter according desired criteria

        
      FaultFilter filter = new FaultFilter();

        
      //filter.setCompositeDN("crm/CL_MDW_SCA!201406.0.3");
        filter
      .setComponentName("CL_MDW_NotifySiebelMediator");
       
      // filter.setComponentInstanceId("mediator:2C7C8FB0118911E4BF28532711BC37C1");

        
      //filter.setCompositeInstanceId("40001");
        
      //filter.setId("default/FaultClient!1.0*soa_911ae0fd-c5ca-44ae-922c-6641a4e7d51f/FaultClientProcess/40001-BpInv0-BpSeq0.3-3");
        
      //filter.setFaultName("{http://xmlns.oracle.com/FaultRecovery_jws/FaultGenerator/FaultGeneratorProcess}BusinessFault");

        
      //filter.setLike("%<code>0001%");

        filter
      .setRecoverable(true);

        
      //Get faults using defined filter

        
      List<Fault> faultList = mMediatorServiceEngine.getFault(filter);


        
      if (faultList.isEmpty())
        
      {
        
      System.out.println("Nothing to Recover for:");
        
      System.out.println("CompositeDN : " + filter.getCompositeDN());
        
      System.out.println("ComponentName : " + filter.getComponentName());
        
      System.out.println("ComponentInstanceId : " + filter.getComponentInstanceId());
        
      System.out.println("Exit...");
        
      }

        
      for (Fault fault : faultList) {

        
      System.out.println("=============================================================================================================");
        
      System.out.println(" Composite DN: " + fault.getCompositeDN().getStringDN());
        
      System.out.println("Composite Instance ID: " + fault.getCompositeInstanceId());
        
      System.out.println(" Component Name: " + fault.getComponentName());
        
      System.out.println("Component Instance ID: " + fault.getComponentInstanceId());
        
      System.out.println(" Activity Name: " + fault.getLabel());
        
      System.out.println(" Fault ID: " + fault.getId());
        
      System.out.println(" Fault Name: " + fault.getName());
        
      System.out.println(" Recoverable flag: " + fault.isRecoverable());
        
      System.out.println(" Fault Message: " + fault.getMessage());


        mMediatorServiceEngine
      .recoverFault(fault,FaultRecoveryActionTypeConstants.ACTION_RETRY,  null);
        
      }

        
      //Instead of recover each fault individually, you can recover all faults in a single API call
        
      //mBPELServiceEngine.recoverFaults(faultList.toArray(new Fault[faultList.size()]), FaultRecoveryActionTypeConstants.ACTION_RETRY);

      } catch (Exception e) {

        e
      .printStackTrace();

       
      }  
      }


      public static void main(String[] args) {

       
      FaultManagementFramework faultRecovery = new FaultManagementFramework();
        faultRecovery
      .recoverFaults();

      }

      }



      The Exception reported is:

      java.lang.reflect.InvocationTargetException
      at sun
      .reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at un
      .reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
      at un
      .reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      at java
      .lang.reflect.Method.invoke(Method.java:601)
      at oracle
      .soa.management.internal.facade.BaseFacade$LocatorExecutionContextProxy.invoke(BaseFacade.java:82)at $Proxy4.executeServiceEngineMethod(Unknown Source)
      at oracle
      .soa.management.internal.facade.mediator.MediatorServiceEngineImpl.getFaults(MediatorServiceEngineImpl.java:37)
        at com
      .ao.FaultManagementFramework.recoverFaults(FaultManagementFramework.java:109)
        at com
      .ao.FaultManagementFramework.main(FaultManagementFramework.java:180)
        at sun
      .reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun
      .reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
        at sun
      .reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java
      .lang.reflect.Method.invoke(Method.java:601)
        at org
      .eclipse.jdt.internal.jarinjarloader.JarRsrcLoader.main(JarRsrcLoader.java:58)
        
      Caused by: java.lang.RuntimeException: Not Implemented getFaults
        at oracle
      .soa.management.internal.ejb.impl.FacadeFinderBeanImpl.executeServiceEngineMethod(FacadeFinderBeanImpl.java:1255)
        at sun
      .reflect.GeneratedMethodAccessor2121.invoke(Unknown Source)
        at sun
      .reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java
      .lang.reflect.Method.invoke(Method.java:597)
        at com
      .bea.core.repackaged.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:149)
        at com
      .oracle.pitchfork.intercept.MethodInvocationInvocationContext.proceed(MethodInvocationInvocationContext.java:103)
        at oracle
      .security.jps.ee.ejb.JpsAbsInterceptor$1.run(JpsAbsInterceptor.java:113)
        at oracle
      .security.jps.util.JpsSubject.doAsPrivileged(JpsSubject.java:324)
        at oracle
      .security.jps.ee.util.JpsPlatformUtil.runJaasMode(JpsPlatf