Tuesday, October 30, 2012

The server does not support version 3.0 of the J2EE Web module specification - Eclipse

The server does not support version 3.0 of the J2EE Web module specification -  Eclipse

Sometimes we used to receive the following exception when running the web application in latest eclipse version.

The server does not support version 3.0 of the J2EE Web module specification.

The issue is when creating the web project in latest eclipse by default the web version  will be selected as 3.0 but the server what we are having is not supporting the web 3.0.

There is two options to fix this issue.

1. Upgrade your server to latest version
2.Open org.eclipse.wst.common.project.facet.core.xml file from /workspace/<Your project name>/.settings and change jst.web version to 2.5 instead 3.0

<installed facet="jst.web" version="2.5"/>





Monday, October 29, 2012

Oracle SOA Suite Composite Deployment - Global Type declaration/definition of name *are duplicated - Part1


Oracle SOA Suite Composite Deployment - Global Type declaration/definition of name *are duplicated - Part1

Sometimes we used to get the below error message while deploying the composites to theOracle SOA Suite  server.

oracle.fabric.common.wsdl.XSDException: Global element declaration/definition of name '{http://xmlns.oracle.com/GlobalDeclaration/employee}Employee' are duplicated at the following locations:

http://localhost:8000/soa-infra/services/default/EmployeeServer/employeeserver_client_ep?XSD=xsd/EmployeeServer.xsd [line#: 4]
http://localhost:8000/soa-infra/services/default/EmployeeServer/xsd/EmployeeServer.xsd [line#: 3]
file:/reuters/shared/11g/software/soa_deploy/code/Utilities/EmployeeClient/xsd/EmployeeClient.xsd [line#: 6]
There are at least two of them looking different:
http://localhost:8000/soa-infra/services/default/EmployeeServer/employeeserver_client_ep?XSD=xsd/EmployeeServer.xsd [difference starting at line#:7]
file:/reuters/shared/11g/software/soa_deploy/code/Utilities/EmployeeClient/xsd/EmployeeClient.xsd [difference starting at line#:9]

The exception states the definition of the element Employee with the names spaces “http://xmlns.oracle.com/GlobalDeclaration/employee” differs in the following location.


file:/code/Utilities/EmployeeClient/xsd/EmployeeClient.xsd

I am having two composites EmployeeClient and EmployeeServer, EmployeeClient invokes EmployeeServer via parnerlink, EmployeeClient and EmployeeServer composites are defined with the following xsd’s

EmployeeClient/EmployeeClient.xsd:

<?xml version="1.0" encoding="UTF-8"?>
<schema attributeFormDefault="unqualified"
                elementFormDefault="qualified"
                targetNamespace="http://xmlns.oracle.com/GlobalDeclaration/employee"
                xmlns="http://www.w3.org/2001/XMLSchema">
                <element name="Employee">
                                 <complexType>
                                                 <sequence>
                                                                 <element name="empid" type="string"/>
                                                 </sequence>
                                 </complexType>
                </element>               
</schema>

EmployeeServer/EmployeeServer.xsd:

<?xml version="1.0" encoding="UTF-8"?>
<schema attributeFormDefault="unqualified"
                elementFormDefault="qualified"
                targetNamespace="http://xmlns.oracle.com/GlobalDeclaration/employee"
                xmlns="http://www.w3.org/2001/XMLSchema">
                <element name="Employee">
                                 <complexType>
                                                 <sequence>
                                                                 <element name="empid" type="string"/>
                                <element name="empname" type="string"/>
                                <element name="contactno" type="string"/>
                                <element name="state" type="string"/>
                                                 </sequence>
                                 </complexType>
                </element>
               
</schema>



Thursday, October 25, 2012

Auto Submitting the HTML page on load

Auto Submitting the HTML page on load - Auto Submitting the HTML page on load:


<html>
<head>
<script>
window.onload = function()
{
 document.login.submit();
}
</script>
</head>
<body>
<FORM name="login" action="http://localhost:7001/analytics/saw.dll?bieehome" method="post">
    <INPUT type="hidden" name="nQUser" value="weblogic">
    <INPUT type="hidden" name="nQPassword" value="weblogic123">
   </FORM>
 </FRAMESET>
 </body>
</html>


Wednesday, October 24, 2012

ResourceLimitException : No resources currently available in pool to allocate to applications – Oracle SOA 11g

ResourceLimitException : No resources currently available in pool to allocate to applications – Oracle SOA 11g

You could have observed the below exception frequently in the weblogic server log file, weblogic server throws the below exception when there is not enough database connections in the pool to serve the incoming requests reporting increasing the connection pool count. This will affect the overall system  performance

java.sql.SQLException: Internal error: Cannot obtain XAConnection weblogic.common.resourcepool.ResourceLimitException: No resources currently available in pool SOADataSource to allocate to applications, please increase the size of the pool and retry..
at weblogic.common.resourcepool.ResourcePoolImpl.reserveResourceInternal(ResourcePoolImpl.java:577)
at weblogic.common.resourcepool.ResourcePoolImpl.reserveResource(ResourcePoolImpl.java:342)
at weblogic.common.resourcepool.ResourcePoolImpl.reserveResource(ResourcePoolImpl.java:329)
at weblogic.jdbc.common.internal.ConnectionPool.reserve(ConnectionPool.java:417)
at weblogic.jdbc.common.internal.ConnectionPool.reserve(ConnectionPool.java:324)


The above exception is due to there is not enough connections available in the pool to service the requests.

To identify which datasource / connection pool requires more connection do the following.

  • Go to Weblogic Admin console
  • Go to Environment -> Servers
  • Select the server on which the connection pool needs to be monitored
  • Go to Monitoring -> JDBC
  • Customize the table to add the below two properties
This page will list all the datasources/ connection pools targeted to that particular server and how many connections are waiting to get the connection. If more number of connections are waiting, that is not a good which will cause performance impact and also cause stuck threads on the server if the wait time is going to be beyond the thread stuck time (By default it's 10 mins).

(This screen shot taken by reducing the max capacity to 5 for blogging purpose, unfortunately I did not captured the actual screen shot)


Monday, October 15, 2012

Getting the SOAP Envelope of the request/response messages in Oracle SOA Suite


Getting the SOAP Envelope of the request/response messages in Oracle SOA Suite

This post will explain how to Get the SOAP Envelope of the request/response messages in Oracle SOA Suite 11g or Oracle SOA Suite 12c(screen will be little different in Oracle SOA Suite 12c )

The bpelx:inputHeaderVariable and bpelx:outputHeaderVariable attributes in invoke/receive activity will help us to add or retrieve the custom SOAP headers to SOAP message in oracle SOA.

If you want to see the whole SOAP message (header & body) it’s not possible out-of-the-box on the EM Console or in the logs.

 Steps to capture complete SOAP conversations for a SOA composite service

  • Open the Composite.xml
  • Attach the management policy named oracle/log_policy to the webservice reference to which the SOAP headers needs to be monitored. 



Monday, October 8, 2012

DB Adapter Message Throttling in Oracle SOA Suite 11g

DB Adapter Message Throttling in Oracle SOA Suite 11g:


DB throttling is the mechanism to control the number of database records processed by the SOA engine in a particular interval through DB Adapter. 

Throttling also can be used to control the number of records send to the end systems. If the throttling is not defined, the end systems may flood with number of messages that will affect the functioning of the end systems. Throttling parameters should be configured based on the end systems capacity to process the incoming messages.

Until Oracle SOA Suite 11.1.1.6.0 the message throttling will not work as we expect, all the messages matching the where condition of the polling sql are processed in the same polling interval.

As of Oracle Adapters release 11.1.1.6.0 we can set the inbound DBAdapter property RowsPerPollingInterval to control the throttling. It acts as a limit on the number of records which can be processed in one polling interval. The default value is unlimited.

The Patch 12881289 should be applied to enable this for SOA 11.1.1.5.0 and earlier versions.

The maximum rows processed per second

The maximum rows processed per second are:
Number of active nodes in SOA cluster x NumberOfThreads x RowsPerPollingInterval / PollingInterval

MaxTransactionSize can be thought of as RowsPerDatabaseTransaction or DatabaseFetchSize that is how many records will be fetched to DB Adapter engine from the database for each transaction. It does not affect how many rows can be processed in one polling interval period.

The one exception is the following configuration:
-distributed polling checked, usesSkipLocking="false"




Saturday, October 6, 2012

Deployment plan file to replace the JCA Adapters properties – Oracle SOA Suite

Deployment plan file to replace the JCA Adapters properties – Oracle SOA Suite 11g

This post will explain how to use deployment plan file to replace the JCA Adapters properties in Oracle SOA Suite 11g and Oracle SOA Suite 12c.


We can create and edit a configuration plan file in which we can replace the following attributes and properties:
  •  Any composite, service component, reference, service, and binding properties in the SOA composite application file (composite.xml)
  • Attribute values for bindings (for example, the location for binding.ws)
  • schemaLocation attribute of an import in a WSDL file
  • location attribute of an include in a WSDL file
  • schemaLocation attribute of an include, import, and redefine in an XSD file
  • Any properties in JCA adapter files
The configuration plan does not alter XSLT artifacts in the SOA composite application. If you want to modify any XSL, do so in the XSLT Mapper. Using a configuration plan is not useful. For example, you cannot change references in XSL using the configuration plan file. Instead, they must be changed manually in the XSLT Mapper in Oracle JDeveloper when moving to and from test, development, and production environments.

The same steps will work in Oracle SOA Suite 12c but the screens will be little different.

Generate the Plan file:

The plan file can be generated through JDeveloper or through ANT script.

Generating Plan file through JDeveloper:

Right Click on Composite.xml and click on generate config Plan.





Unable to connect to tomcat home page when starting the server from eclipse

Unable to connect to tomcat home page when starting the server from eclipse:


When are we starting the tomcat server from eclipse, the server is getting started successfully as shown below but could not able to access the home – http://localhost:8080from the browser.



Double click the Tomcat server entry in the Servers tab; you'll get the server configuration. At the left column, under Server Locations, select Use Tomcat installation (Make sure no modules are published to do the changes for the existing server configuration)




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"));
       
    }
}