Sometimes we may need to abort
RUNNING instances of a SOA composite or abort single long running instance.
It’s pretty easy in em console but sometimes it won’t work so I came up with below java
program which will help you to abort instances. You can change program
according to your need.
import java.util.Hashtable;
import java.util.List;
import javax.naming.Context;
import oracle.soa.management.facade.Component;
import oracle.soa.management.facade.ComponentInstance;
import oracle.soa.management.facade.Composite;
import oracle.soa.management.facade.Locator;
import oracle.soa.management.facade.LocatorFactory;
import oracle.soa.management.util.ComponentInstanceFilter;
import oracle.soa.management.util.CompositeInstanceFilter;
import oracle.soa.management.facade.CompositeInstance;
import oracle.soa.management.CompositeDN;
public class abortComposite {
public abortComposite() {
super();
}
public void abortRunningComposite() {
try {
Locator locator = null;
Hashtable jndiProps =
new Hashtable();
//Connection Details to
Connect to Server
jndiProps.put(Context.PROVIDER_URL,
"t3://soahost:soaport");
jndiProps.put(Context.INITIAL_CONTEXT_FACTORY,
"weblogic.jndi.WLInitialContextFactory");
jndiProps.put(Context.SECURITY_PRINCIPAL, "weblogic");
jndiProps.put(Context.SECURITY_CREDENTIALS, "XXXXX");
jndiProps.put("dedicated.connection", "true");
//Connect to SOA Server
locator =
LocatorFactory.createLocator(jndiProps);
System.out.println("Connected to SOA Server.");
CompositeInstanceFilter
filter = new CompositeInstanceFilter();
String
compositeName="YourCompositeName";
//filter.setId("1238098"); Use this incase if you want to delete
specific instance id
filter.setState(CompositeInstance.STATE_RUNNING);
filter.setCompositeName(compositeName);
List<CompositeInstance> compositeInstances =
locator.getCompositeInstances(filter);
for(int
i=0;i<compositeInstances.size();i++)
((CompositeInstance)compositeInstances.get(i)).abort();
}catch(Exception e)
{
e.printStackTrace();
}
}
public static void main(String[] args) {
abortComposite abortcomposite = new
abortComposite();
abortcomposite.abortRunningComposite();
}
}
Steps:-
Set Classpath
export CLASSPATH=$CLASSPATH:$ORACLE_FMW_HOME/oracle_common/soa/modules/oracle.soa.mgmt_11.1.1/soa-infra-mgmt.jar:$ORACLE_FMW_HOME/oracle_common/modules/oracle.fabriccommon_11.1.1/fabric-common.jar:$ORACLE_FMW_HOME/wlserver_10.3/server/lib/weblogic.jar:$ORACLE_FMW_HOME/oracle_common/modules/oracle.jrf_11.1.1/jrf-api.jar
Set Classpath
export CLASSPATH=$CLASSPATH:$ORACLE_FMW_HOME/oracle_common/soa/modules/oracle.soa.mgmt_11.1.1/soa-infra-mgmt.jar:$ORACLE_FMW_HOME/oracle_common/modules/oracle.fabriccommon_11.1.1/fabric-common.jar:$ORACLE_FMW_HOME/wlserver_10.3/server/lib/weblogic.jar:$ORACLE_FMW_HOME/oracle_common/modules/oracle.jrf_11.1.1/jrf-api.jar