Saturday, October 6, 2012

Changing the weblogic server admin console timeouts.

Changing the weblogic server admin console timeouts.

This post will explain how to change the weblogic server admin console timeouts.

The console application can be find at the below location
$WEBLOGIC_HOME\server\lib\consoleapp

Change the directory location to $WEBLOGIC_HOME/server/lib/consoleapp/webapp/WEB-INF and open the weblogic.xml in a text editor.

Look for a session param tag with the name as "invalidation-interval-secs" and "timeout-secs"

Default Values

<session-descriptor>
    <timeout-secs>3600</timeout-secs>
    <invalidation-interval-secs>60</invalidation-interval-secs>

    <cookie-name>ADMINCONSOLESESSION</cookie-name>
    <cookie-max-age-secs>-1</cookie-max-age-secs>
    <url-rewriting-enabled>false</url-rewriting-enabled>
 </session-descriptor>

Change the value for "invalidation-interval-secs" and "timeout-secs" as per your requirement and restart the Weblogic Admin Server.

Login to weblogic admin console and verify the same.


If the EM console is deployed to weblogic server(EM console will be part of domain if any of the middleware component is installed) then the session timeout can be increased as follows.

Login to EM console and open the MBean Browser(Right click soa-infra-->Administartion-->System MBean Browser)

Enter the following value into the Mbean Browser filter and click on ok.


Change the session timeout value accordingly and click on Apply.




Friday, October 5, 2012

File/FTP Adapter Threading Model – Oracle SOA Suite

File/FTP Adapter Threading Model – Oracle SOA Suite

The Oracle File and FTP Adapters use the following threading models:
  • Default Threading Model
  • Modified Threading Model

Default Threading Model:

In the default threading model, a poller is created for each inbound Oracle File or FTP Adapter endpoint. The poller enqueues file metadata into an in-memory queue, which is processed by a global pool of processor threads. We can set the thread count of global processor through the oracle.tip.adapter.file.numProcessorThreads property at the pc.properties file. Create pc.properties file with this property and copy it to server and then reference it in the WLS classpath in setDomainEnv.sh.




The following steps highlight the functioning of the default threading model:
  • The poller periodically looks for files in the input directory. The interval at which the poller looks for files is specified using the PollingFrequency parameter in the inbound JCA file.
  • For each new file that the poller detects in the configured inbound directory, the poller enqueues information such as file name, file directory, modified time, and file size into an internal in-memory queue.
  • A global pool of processor worker threads waits to process from the in-memory queue.
  • Processor worker threads pick up files from the internal queue, and perform the following actions:
  • Stream the file content to an appropriate translator (for example, a translator for reading text, binary, XML, or opaque data.)
  • Publishes the XML result from the translator to the SCA infrastructure.
  • Performs the required post processing, such as deletion or archival after the file is processed.

Modified Threading Model:

We can modify the default threading behavior of Oracle File and FTP Adapters. Modifying the threading model results in a modified throttling behavior of Oracle File and FTP Adapters. The following sections describe the modified threading behavior of the Oracle File and FTP Adapters:
  • Single Threaded Model
  • Partitioned Threaded Model

Single Threaded Model:

The single threaded model is a modified threaded model that enables the poller to assume the role of a processor. The poller thread processes the files in the same thread. The global pool of processor threads is not used in this model. You can define the property for a single threaded model in the inbound JCA file as follows:
<activation-spec className="oracle.tip.adapter.file.inbound.FileActivationSpec">
   <property../>
   <property name="SingleThreadModel" value="true"/>
   <property../>
</activation-spec>

Partitioned Threaded Model:

The partitioned threaded model is a modified threaded model in which the in-memory queue is partitioned and each composite application receives its own in-memory queue. The Oracle File and FTP Adapters are enabled to create their own processor threads rather than depend on the global pool of processor worker threads for processing the enqueued files. You can define the property for a partitioned model in the inbound JCA file as follows:
<activation-spec className="oracle.tip.adapter.file.inbound.FileActivationSpec">
  <property../>
  <property name="ThreadCount" value="4"/>
  <property../>
</activation-spec>
In the preceding example for defining the property for a partitioned model:
  • If the ThreadCount property is set to 0, then the threading behavior is like that of the single threaded model.
  • If the ThreadCount property is set to -1, then the global thread pool is used, as in the default threading model.
  • The maximum value for the ThreadCount property is 40.


Disabling/Enabling the Oracle Service Bus Services from Java

Disabling/Enabling the Oracle Service Bus Services from Java


The status of the OSB services can be changed in different ways like through OSB console, through WLST script and through Java.

This post shows how to use the Java API to enable/disable the OSB Proxy/Business services.

Java Code:

package osbservicestatusupdate;
import com.bea.wli.config.Ref;
import com.bea.wli.sb.management.configuration.*;
import java.io.IOException;
import java.net.MalformedURLException;
import java.util.Hashtable;
import javax.management.*;
import javax.management.remote.*;

import javax.naming.Context;
import weblogic.management.jmx.MBeanServerInvocationHandler;
import weblogic.management.mbeanservers.domainruntime.DomainRuntimeServiceMBean;

public class OSBServiceStatusUpdate {
    private static JMXConnector initConnection(String hostname, int port,String username, String password) throws IOException,MalformedURLException
    {
        JMXServiceURL serviceURL = new JMXServiceURL("t3", hostname, port,"/jndi/" + DomainRuntimeServiceMBean.MBEANSERVER_JNDI_NAME);
        Hashtable<String, String> h = new Hashtable<String, String>();
        h.put(Context.SECURITY_PRINCIPAL, username);
        h.put(Context.SECURITY_CREDENTIALS, password);
        h.put(JMXConnectorFactory.PROTOCOL_PROVIDER_PACKAGES, "weblogic.management.remote");
        return JMXConnectorFactory.connect(serviceURL, h);
    }

    private static Ref constructRef(String refType,String serviceuri){
        Ref ref = null;
        String[] uriData = serviceuri.split("/");
        ref = new Ref(refType,uriData);       
        return ref;
    }

    public static String changeProxyServiceStatus(String servicetype,boolean status,String serviceURI,String host,int port,String username,String password){
        JMXConnector conn = null;
        SessionManagementMBean sm = null;
        String sessionName = "mysession";
        String statusmsg="";
        try{
            conn = initConnection(host, port, username,password);
            MBeanServerConnection mbconn = conn.getMBeanServerConnection();
            DomainRuntimeServiceMBean domainService = (DomainRuntimeServiceMBean) MBeanServerInvocationHandler.
                newProxyInstance(mbconn, new ObjectName(DomainRuntimeServiceMBean.OBJECT_NAME));
            sm = (SessionManagementMBean) domainService.findService(SessionManagementMBean.NAME,SessionManagementMBean.TYPE, null);
            sm.createSession(sessionName);            
            ALSBConfigurationMBean alsbSession = (ALSBConfigurationMBean) domainService.
                 findService(ALSBConfigurationMBean.NAME + "." + "mysession",ALSBConfigurationMBean.TYPE, null);      
          
            if(servicetype.equals("ProxyService")) {
                Ref ref = constructRef("ProxyService",serviceURI);
                ProxyServiceConfigurationMBean proxyConfigMBean = (ProxyServiceConfigurationMBean) domainService.
                 findService(ProxyServiceConfigurationMBean.NAME + "." + sessionName,ProxyServiceConfigurationMBean.TYPE, null);
                if(status){
                   proxyConfigMBean.enableService(ref);
                   statusmsg="Enabled the Service : " + serviceURI;
                }
                else {            
                    proxyConfigMBean.disableService(ref);   
                    statusmsg="Disabled the Service : " + serviceURI;
                }  
            }else if(servicetype.equals("BusinessService")) {
                Ref ref = constructRef("BusinessService",serviceURI);               
                BusinessServiceConfigurationMBean businessConfigMBean = (BusinessServiceConfigurationMBean) domainService.
                 findService(BusinessServiceConfigurationMBean.NAME + "." + sessionName,BusinessServiceConfigurationMBean.TYPE, null);
                if(status){
                   businessConfigMBean.enableService(ref);
                   statusmsg="Enabled the Service : " + serviceURI;
                }
                else {            
                    businessConfigMBean.disableService(ref);   
                    statusmsg="Disabled the Service : " + serviceURI;
                }  
            }
           sm.activateSession(sessionName, statusmsg);           
           conn.close();
        }catch(Exception ex){
            if(null != sm) {
                try{
                    sm.discardSession(sessionName);
                }catch(Exception e) {
                    System.out.println("able to discard the session");
                  
                }
            }
            statusmsg="Not able to perform the operation";           
            ex.printStackTrace();          
        }finally{
            if(null != conn)
                try{
                    conn.close();
                }catch(Exception e) {
                    e.printStackTrace();
                }
        }
       
        return statusmsg;
    }
      
    public static void main(String[] args) {       
        //changeProxyServiceStatus(servicetype, status, serviceURI, host, port, username, password)       
        System.out.println(changeProxyServiceStatus("BusinessService", false, "OSBServiceAPI/OSBServiceAPIBusiness", "localhost", 8000, "weblogic", "welcome1"));
       
    }
}



Thursday, October 4, 2012

Socket Adapter issue with the JCA property EncByteOrderCheckBox – Oracle SOA Suite 11g


Socket Adapter issue with the JCA property EncByteOrderCheckBox – Oracle SOA Suite 11g:

While testing the Socket Adapter project in runtime the following exception has thrown in em console.

<summary>Exception occured when binding was invoked. Exception occured during invocation of JCA binding: "JCA Binding execute of Reference operation 'OutboundRequestReply' failed due to: Exception occured when binding was invoked. Exception occured during invocation of JCA binding: "Could not instantiate InteractionSpec oracle.tip.adapter.socket.SocketInteractionSpec due to: Cannot set JCA WSDL Property. Error while setting JCA WSDL Property. Property setEncByteOrderCheckBox is not defined for oracle.tip.adapter.socket.SocketInteractionSpec Please verify the spelling of the property. ". The invoked JCA adapter raised a resource exception. Please examine the above error message carefully to determine a resolution. ". The invoked JCA adapter raised a resource exception. Please examine the above error message carefully to determine a resolution. </summary>

The root cause of this issue is when you design a Socket adapter project (both Inbound and Outbound) or edit and save the existing project, the EncByteOrderCheckBox property is added to the JCA file irrespective of whether we have selected the same in the designer.

 

Workaround to resolve this issue


Remove the property EncByteOrderCheckBox from the .jca file and redeploy the composite.

 The SOA Suite version, we have observed this issue is 11.1.1.5.0


Wednesday, October 3, 2012

Webservice invocation failed, Unable to access the following endpoint(s) – Oracle SOA Suite 11g


Webservice invocation failed, Unable to access the following endpoint(s) – Oracle SOA Suite 11g:

Some of the time we used to receive the following exception while invoking the webservice endpoints in Oracle SOA 11g. There could be a multiple reason behind this exception.

This blog explains the different ways to narrow down the issue and to fix the issue.

An exception occured while invoking the webservice operation. Please see logs for more details.
oracle.sysman.emSDK.webservices.wsdlapi.SoapTestException: Unable to access the following endpoint(s): http://hostname:50000/XISOAPAdapter/MessageServlet?channel=:SalesForce:CC_Out_Soap_SFDC_order

Steps:

Ping the host name: 

    • If the host is alive then the connectivity looks fine

    •  If we received Unknown host error then verify whether the host entry is available in the server host  file for the host.