Sunday, June 29, 2014

Spring Web service with NTLM Authentication

Spring Web service with NTLM Authentication

NTLM is a proprietary authentication scheme developed by Microsoft and optimized for Windows operating system.

This post will explain how to invoke the NTLM authentication enabled web services from spring integration.

Spring Web Service uses the Apache HTTPClient to communicate to the NTLM authentication enabled services.

We named our spring bean as WebServiceNTLMAuhCommunicationClientImpl, it will extend the class org.springframework.ws.client.core.support.WebServiceGatewaySupport

We have overridden the method initGateway to set the org.apache.commons.httpclient.NTCredentials object to CommonsHttpMessageSender.

The userName, password and the domain name should be provided to createthe NTCredential object.

The afterPropertiesSet method on CommonsHttpMessageSender class should be invoked after setting the credential - afterPropertiesSet method will set the credentials to HttPClient.

WebServiceNTLMAuhCommunicationClientImpl.java

import org.apache.commons.httpclient.Credentials;
import org.apache.commons.httpclient.NTCredentials;
import org.springframework.ws.client.core.support.WebServiceGatewaySupport;
import org.springframework.ws.transport.http.CommonsHttpMessageSender;

public class WebServiceNTLMAuhCommunicationClientImpl extends WebServiceGatewaySupport {
 private String basicAuthUsername;
 private String basicAuthPassword;
 private String domain;
 private String hostname;


 public String getHostname() {
  return hostname;
 }

  public void setHostname(String hostname) {
  this.hostname = hostname;
 }

  public Object send(String url, Object request)
 {
  return this.getWebServiceTemplate().marshalSendAndReceive(
    url, request, null);
 }

 public void setBasicAuthPassword(String basicAuthPassword)
    {
     this.basicAuthPassword = basicAuthPassword;
    }

  public void setBasicAuthUsername(String basicAuthUsername)
    {
     this.basicAuthUsername = basicAuthUsername;
    }

 public String getDomain() {
  return domain;
 }

  public void setDomain(String domain) {
  this.domain = domain;
 }

  @Override
    protected void initGateway() throws Exception
    {
  if(this.basicAuthUsername != null || this.basicAuthPassword != null)
  {
    ((CommonsHttpMessageSender)this.getMessageSenders()[0]).setCredentials(getCredentials());
    ((CommonsHttpMessageSender)this.getMessageSenders()[0]).afterPropertiesSet();
  }
  super.initGateway();
    }

 private Credentials getCredentials() {
   return new NTCredentials(this.basicAuthUsername, this.basicAuthPassword, getHostname(), getDomain());
 }

}

Wednesday, June 25, 2014

javax.management.MBeanException: The configuration file, deployed-composites.xml, does not contain the composite-revision element

javax.management.MBeanException: The configuration file, deployed-composites.xml, does not contain the composite-revision element

We were receiving the following exception while deploying the composite to the SOA server in Solaris.

The exception was thrown while activating the component.

compositeMgrTask:
     [java] Connecting to: service:jmx:t3://localhost:8004/jndi/weblogic.management.mbeanservers.runtime
     [java] connection initiated
     [java] javax.management.MBeanException: The configuration file, deployed-composites.xml, does not contain the CRMASYNC/zz!5.3.19 composite-revision element.
     [java]     at oracle.as.jmx.framework.standardmbeans.spi.OracleStandardEmitterMBean.doInvoke(OracleStandardEmitterMBean.java:986)

The actual exception is the component was not deployed successfully due to some exception and it is trying to activate the same .

The exception while deploying the component is

[deployComposite] setting user/password..., user=weblogic
[deployComposite] Processing sar=/shared/11g/soa_deploy/code/config/scripts/../../LoadBalancerProbe/zz/deploy/sca_zz_rev5.3.19.jar
[deployComposite] Adding sar file -/shared/11g/soa_deploy/code/config/scripts/../../LoadBalancerProbe/zz/deploy/sca_zz_rev5.3.19.jar
[deployComposite] INFO: Creating HTTP connection to host:localhost, port:8004
[deployComposite] INFO: Received HTTP response from the server, response code=500
[deployComposite] ---->response code=500, error:There was an error deploying/undeploying composite on SOA1: Error in reading data from deployer client.: /var/tmp/sar_base_dir_07be0448-8481-4ade-a2e9-253e5a8ba33c/sca_zz_rev5.3.19.jar (No such file or directory).

Based on the error, the deployer could not able to retrieve the jar file from the tmp location.
After analysis, the /var/tmp space is full and the script could not able to write the jar file.
We can use df -kh command to find the space utilization


How to Fix

To resolve the issue login as root user and clear the /var/tmp folder.

Thursday, June 12, 2014

Generating JAXB artifacts from XSD/WSDL through Maven

Generating JAXB artifacts from XSD/WSDL through Maven

The maven-jaxb2-plugin can be used to generate the java classes from both XSD/WSDL.

Plugin configuration in Pom.xml

The below plug in configuration can be used in the pom.xml file to generate the sources.
<plugin>
  <groupId>org.jvnet.jaxb2.maven2</groupId>
  <artifactId>maven-jaxb2-plugin</artifactId>
  <version>0.7.3</version>
  <executions>
    <execution>
      <id>app1-stub-generation</id>
      <goals>
        <goal>generate</goal>
      </goals>
      <configuration>
        <schemaDirectory>src/main/resources</schemaDirectory>
        <schemaIncludes>
          <include>*.xsd</include>
        </schemaIncludes>
        <generatePackage>com.thomson.ecom.service.bean.demo</generatePackage>
        <clearOutputDir>false</clearOutputDir>
        <generateDirectory>src/main/java</generateDirectory>
        <strict>true</strict>
      </configuration>
    </execution>
 
 
  </executions>
</plugin>

Change the include accordingly to generate for wsdl -   <include>*.wsdl</include>

Generate the sources

To generate the sources, Right click on pom.xml-->Run As-->Maven generate-sources


This will generate all the java classes to src/main/java

Wednesday, June 11, 2014

Configuring JAXB2-Maven-Plugin not to clear the outputdirectory

Configuring JAXB2-Maven-Plugin not to clear the outputdirectory

JAXB2-Maven-Plugin will help us to generate the java classes from the xsd.
By default the plugin clears the existing contents in the ouputdirectory and generate the new java classes into the outputdirectory.

Some cases we may need to generate the java classes from multiple source xsd's so we have to configure the plugin not to clear the outputdirectory.

Yo have to add <clearOutputDir>false</clearOutputDir> in the plugin configuration.

<plugin>
            <groupId>org.codehaus.mojo</groupId>
            <artifactId>jaxb2-maven-plugin</artifactId>
            <executions>
                <execution>
                    <goals>
                        <goal>xjc</goal>
                    </goals>
                </execution>
            </executions>
            <configuration>
                <!-- The schema directory or xsd files. -->
                <schemaDirectory>${basedir}/src/main/resources</schemaDirectory>
                <!-- The package in which the source files will be generated. -->
                <packageName>com.service.bean.demo</packageName>
                 <clearOutputDir>false</clearOutputDir>
                <!-- The working directory to create the generated java source files. -->
                <outputDirectory>${basedir}/src/main/java</outputDirectory>
            </configuration>
        </plugin>

Tuesday, June 10, 2014

Changing the default Maven repository location in eclipse

Changing the default Maven repository location in eclipse

Sometimes we may required to modify the default maven repository location to custom location for the eclipse project.
Eclipse project will have the variable M2_REPO defined as read only.


The following steps will help as to change the default Mavan repository location.

Modify the settings.xml file in the <<USER_HOME>>/.m2 and add the localRepository value accordingly.



If the .m2 folder ia not available in the USER_HOME create the same(md .m2) and also create a settings.xml file and update the file with the following contents(change the value of localrepository and the repository url accordingly)

Saturday, June 7, 2014

Load Balancing Rules for Oracle SOA Suite Infrastructure

Load Balancing Rules for Oracle SOA Suite Infrastructure

This blog explain the details about the load balancer rule setup for Oracle SOA Suite infrastructure.



Download Load_Balancing_Rules_For_SOA.pdf

Sunday, June 1, 2014

Approach to Resolve the Load balancer routing the Oracle SOA Suite Request to Unavailable SOA-INFRA

Approach to Resolve the Load balancer routing the Oracle SOA Suite Request to Unavailable SOA-INFRA 

The below document explain the approach to resolve the Load balancer routing the Oracle SOA Suite request to unavailable SOA-INFRA.



Download Load_Balancer_Probe_SOA-INFRA.pdf

Friday, May 30, 2014

Oracle BPEL Vs. Oracle BPM

Oracle BPEL Vs. Oracle BPM

For the recent project i was comparing the Oracle BPEL and Oracle BPM and thought of sharing the same.
This document is based on my understanding and views not of oracle views.




Download Oracle_BPEL_Vs._Oracle_BPM.pdf

Friday, May 23, 2014

Component Metrics are Unavailable for the SOA Composite in EM console - Oracle SOA Suite 11g

Component Metrics are Unavailable for the SOA Composite in EM console - Oracle SOA Suite 11g

I was facing a strange issue with Oracle SOA Suite EM console. Whenever opening the SOA Composite the component metrics are not getting displayed and it is shown as Unavailable.


The issue is only happening in Development environment but it is working fine in all the other environments.
I could not able to find any exception related to this issue in any of the log files.

Unfortunately the Component metrics are getting displayed after refreshing the SOA Composite(from right corner of EM page as shown in the above diagram) from EM console


Deployment plan file to replace the Binding Adapter Properties/Attributes – Oracle SOA Suite

Deployment plan file to replace the Binding Adapter Properties/Attributes – Oracle SOA Suite

The deployment plan file will help us to dynamically replace the Oracle SOA Suite Composite properties.

This post explain the steps to replace the Properties/Attributes of the Direct Binding Adapter in Composite.xml. The same steps can be used to replace the Properties/Attributes of all the Binding Adapters.

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.


Change the generated plan file contents accordingly to replace the properties and attributes of the composites. 

Add the required attributes to the corresponding Binding and change the values accordingly(by default the attributes will not be added to the corresponding binding in the plan file) and also change the value of required properties accordingly.

Thursday, May 22, 2014

The selected WSDL contain a direct binding but seems to be of the wrong type - Oracle SOA Suite

The selected WSDL contain a direct binding but seems to be of the wrong type - Oracle SOA Suite

You will be receiving the message "The selected WSDL contain a direct binding but seems to be of the wrong type. Looking for Oracle Service Bus type.Please check your WSDL selection" while trying to create the direct binding to invoke the OSB service.


This message says the OSB proxy service is not configured with SB transport.
Configure the OSB Proxy service with the SB transport to invoke the same from SOA composite through Direct Binding.

When looking up the OSB service from JDeveloper SOA Resource Browser, the Proxy will be shown as direct for SB transport services.

Wednesday, May 21, 2014

Re-Deploying the DBAdapter application - Oracle SOA Suite

Re-Deploying the DBAdapter application - Oracle SOA Suite

Accidentally we have deleted the DBAdapter application from the weblogic server console in Oracle SOA Suite and all the database connection factories created was failing.

This post will explain how to Re-Deploy the Resource Adapter - DBAdapter application and recover the connection factories.

The same steps can be followed to recover any Resource Adapter applications

Steps to redeploy Resource Adapter

  • Login to weblogic console
  • Go to deployments
  • Click on Install 
  • Select $Oracle_HOME/soa/connectors as the path and select Dbadapter.rar
reinstall_resource_adapter

  • Click on Next
  • Click on Next and select the target server
reinstall_resource_adapter
          

Wednesday, May 14, 2014

Configuring the Oracle Enterprise Repository plugins for Jdeveloper

Configuring the Oracle Enterprise Repository plugins for Jdeveloper

This post explain the steps to configure the Oracle Enterprise Repository Plugins in JDeveloper(JDeveloper version used is 11.1.1.5.0)

In JDeveloper click on Help-->Check For Updates

Select the Oracle Enterprise Repository plugins  as shown below.
The Oracle Enterprise Repository Adapter plugin will help us to access the assets and artifacts available in the Oracle Enterprise Repository .
The Oracle Enterprise Repository Harvester will help us to  harvest a Oracle SOA Suite project to the Oracle Enterprise Repository.


Click on Next and click on Finish


Restart the JDeveloper while prompted
After successful installation of the plugins you can able to to see the "Oracle Enterprise Repository Connection" as new connection type  and also right clicking the SOA project we can see "Submit Project To Enterprise Repository" and right clicking the files(XSD, WSDL) we can see "Submit File To Enterprise Repository"

Tuesday, May 13, 2014

WLST script to Enable/Disable the debug flags in Weblogic Server

WLST script to Enable/Disable the debug flags in Weblogic Server


This tutorial explains the approach to enable/disable the debug flags in Weblogic Server.

The Debugging flags will help us to enable/disable the debugging for different modules in weblogic.

The flags can be enabled/disabled in different ways

Admin Console


Access admin console — http://localhost:7001/console
Navigate to Environment →Servers → <<Server>> → Debug



Select the required flags and click on Enable/Disable.



WLST Script


The below WLST script enable the Debug Flag ‘DebugSSL’ for configured servers

EnableORDisableDFlags.properties

serverflagconfigs=AdminServer=DebugSSL:false,MS1=DebugSSL:true


EnableORDisableDFlags.py
import re
from java.io import FileInputStreamdef EnableORDisableDFlags(): edit()
 startEdit()
 propInputStream = FileInputStream('EnableORDisableDFlags.properties')
 configProps = Properties()
 configProps.load(propInputStream)  
 
 serverflagconfigs = re.split(",",configProps.get("serverflagconfigs"))
 print serverflagconfigs
 
 for serverConfig in serverflagconfigs: 
 
   serverName=re.split("=",serverConfig)[0]
   config=re.split("=",serverConfig)[1]
   print config
   cd('/Servers/'+serverName+'/ServerDebug/'+serverName)
   flagName=re.split(":",config)[0]
   flagValue=re.split(":",config)[1]
   set(flagName,flagValue)
   print 'Modified the DFlag for '+serverName+' '+ flagName+':'+flagValue
 save()
 activate()  
   
  
def main():
    adminURL='t3://localhost:7001'
    adminUserName='weblogic'
    adminPassword='weblogic1'
    connect(adminUserName, adminPassword, adminURL)
    EnableORDisableDFlags();
    print 'Successfully Modified the DFlags'
    disconnect()
main()


Script -
https://github.com/techforum-repo/youttubedata/tree/master/scripts/wlst/EnableORDisableDFlags

Before executing the script, change the configurations as required.

Execute the script — <<Oracle_Home>>\oracle_common\common\bin\wlst.cmd EnableORDisableDFlags.py




Now the DebugFlag is Enabled/Disabled based on the configurations



JVM start arguments


The debug flags can be enabled/disabled through server start up arguments

Add the flags with -D to the server start up arguments through console Environment →Servers →<<Server>> →Server Start

-Dweblogic.debug.DebugSSL=false



Other option is add the debug flags to the start up file startWebLogic.cmd/startWebLogic.sh or startManagedWebLogic.cmd/startManagedWebLogic.sh based on which file is used to start the server.

e.g.

JAVA_OPTIONS=”${JAVA_OPTIONS} -Dweblogic.debug.DebugSSL=true

The changes will take effect after restarting the server

Debug flags for the Reference


DebugAbbreviation
DebugAppContainer
DebugAsyncQueue
DebugBootstrapServlet
DebugClassRedef
DebugClassSize
DebugCluster
DebugClusterAnnouncements
DebugClusterFragments
DebugClusterHeartbeats
DebugConfigurationEdit
DebugConfigurationRuntime
DebugConnection
DebugConsensusLeasing
DebugDGCEnrollment
DebugDRSCalls
DebugDRSHeartbeats
DebugDRSMessages
DebugDRSQueues
DebugDRSStateTransitions
DebugDRSUpdateStatus
DebugDeploy
DebugDeployment
DebugDeploymentService
DebugDeploymentServiceInternal
DebugDeploymentServiceStatusUpdates
DebugDeploymentServiceTransport
DebugDeploymentServiceTransportHttp
DebugDescriptor
DebugDiagnosticAccessor
DebugDiagnosticArchive
DebugDiagnosticArchiveRetirement
DebugDiagnosticCollections
DebugDiagnosticContext
DebugDiagnosticDataGathering
DebugDiagnosticFileArchive
DebugDiagnosticImage
DebugDiagnosticInstrumentation
DebugDiagnosticInstrumentationActions
DebugDiagnosticInstrumentationConfig
DebugDiagnosticInstrumentationEvents
DebugDiagnosticInstrumentationWeaving
DebugDiagnosticInstrumentationWeavingMatches
DebugDiagnosticJdbcArchive
DebugDiagnosticLifecycleHandlers
DebugDiagnosticQuery
DebugDiagnosticWatch
DebugDiagnosticWlstoreArchive
DebugDiagnosticsHarvester
DebugDiagnosticsHarvesterData
DebugDiagnosticsHarvesterMBeanPlugin
DebugDiagnosticsHarvesterTreeBeanPlugin
DebugDiagnosticsModule
DebugDomainLogHandler
DebugEjbCaching

DebugEjbCmpDeployment
DebugEjbCmpRuntime
DebugEjbCompilation
DebugEjbDeployment
DebugEjbInvoke
DebugEjbLocking
DebugEjbMdbConnection
DebugEjbPooling
DebugEjbSecurity
DebugEjbSwapping
DebugEjbTimers
DebugEmbeddedLDAP
DebugEmbeddedLDAPLogToConsole
DebugEmbeddedLDAPWriteOverrideProps
DebugEventManager
DebugFailOver
DebugFileDistributionServlet
DebugHttp
DebugHttpLogging
DebugHttpSessions
DebugIIOP
DebugIIOPConnection
DebugIIOPMarshal
DebugIIOPNaming
DebugIIOPOTS
DebugIIOPReplacer
DebugIIOPSecurity
DebugIIOPStartup
DebugIIOPTransport
DebugIIOPTunneling
DebugJ2EEManagement
DebugJAXPIncludeClass
DebugJAXPIncludeLocation
DebugJAXPIncludeName
DebugJAXPIncludeTime
DebugJAXPUseShortClass
DebugJDBCConn
DebugJDBCDriverLogging
DebugJDBCInternal
DebugJDBCONS
DebugJDBCRAC
DebugJDBCRMI
DebugJDBCSQL
DebugJMSAME
DebugJMSBackEnd
DebugJMSBoot
DebugJMSCDS
DebugJMSCommon
DebugJMSConfig
DebugJMSDispatcher
DebugJMSDistTopic
DebugJMSDurableSubscribers
DebugJMSFrontEnd
DebugJMSJDBCScavengeOnFlush
DebugJMSLocking
DebugJMSMessagePath
DebugJMSModule
DebugJMSPauseResume
DebugJMSSAF
DebugJMSStore
DebugJMST3Server
DebugJMSWrappers

DebugJMSXA
DebugJMX
DebugJMXCompatibility
DebugJMXCore
DebugJMXDomain
DebugJMXEdit
DebugJMXRuntime
DebugJNDI
DebugJNDIFactories
DebugJNDIResolution
DebugJTA2PC
DebugJTA2PCStackTrace
DebugJTAAPI
DebugJTAGateway
DebugJTAGatewayStackTrace
DebugJTAHealth
DebugJTAJDBC
DebugJTALLR
DebugJTALifecycle
DebugJTAMigration
DebugJTANaming
DebugJTANamingStackTrace
DebugJTANonXA
DebugJTAPropagate
DebugJTARMI
DebugJTARecovery
DebugJTARecoveryStackTrace
DebugJTAResourceHealth
DebugJTATLOG
DebugJTAXA
DebugJTAXAStackTrace
DebugJpaDataCache
DebugJpaEnhance
DebugJpaJdbcJdbc
DebugJpaJdbcSchema
DebugJpaJdbcSql
DebugJpaManage
DebugJpaMetaData
DebugJpaProfile
DebugJpaQuery
DebugJpaRuntime
DebugJpaTool
DebugLeaderElection
DebugLibraries
DebugLoadBalancing
DebugLoggingConfiguration
DebugMessaging
DebugMessagingBridgeRuntime
DebugMessagingBridgeRuntimeVerbose
DebugMessagingBridgeStartup
DebugMessagingKernel
DebugMessagingKernelBoot
DebugMuxer
DebugMuxerConnection
DebugMuxerDetail
DebugMuxerException
DebugMuxerTimeout
DebugPathSvc
DebugPathSvcVerbose
DebugRA
DebugRAClassloader
DebugRAConnEvents

DebugRAConnections
DebugRADeployment
DebugRALifecycle
DebugRALocalOut
DebugRAParsing
DebugRAPoolVerbose
DebugRAPooling
DebugRASecurityCtx
DebugRAWork
DebugRAWorkEvents
DebugRAXAin
DebugRAXAout
DebugRAXAwork
DebugRC4
DebugRSA
DebugReplication
DebugReplicationDetails
DebugRouting
DebugSAFAdmin
DebugSAFLifeCycle
DebugSAFManager
DebugSAFMessagePath
DebugSAFReceivingAgent
DebugSAFSendingAgent
DebugSAFStore
DebugSAFTransport
DebugSAFVerbose
DebugSNMPAgent
DebugSNMPExtensionProvider
DebugSNMPProtocolTCP
DebugSNMPToolkit
DebugSSL
DebugScaContainer
DebugSecurityAdjudicator
DebugSecurityAtn
DebugSecurityAtz
DebugSecurityAuditor
DebugSecurityCertPath
DebugSecurityCredMap
DebugSecurityEEngine
DebugSecurityEncryptionService
DebugSecurityJACC
DebugSecurityJACCNonPolicy
DebugSecurityJACCPolicy
DebugSecurityKeyStore
DebugSecurityPasswordPolicy
DebugSecurityPredicate
DebugSecurityRealm
DebugSecurityRoleMap
DebugSecuritySAML2Atn
DebugSecuritySAML2CredMap
DebugSecuritySAML2Lib
DebugSecuritySAML2Service
DebugSecuritySAMLAtn
DebugSecuritySAMLCredMap
DebugSecuritySAMLLib
DebugSecuritySAMLService
DebugSecuritySSL
DebugSecuritySSLEaten
DebugSecurityService
DebugSecurityUserLockout
DebugSelfTuning
DebugServerLifeCycle
DebugServerMigration
DebugServerStartStatistics
DebugStoreAdmin
DebugStoreIOLogical
DebugStoreIOLogicalBoot
DebugStoreIOPhysical
DebugStoreIOPhysicalVerbose
DebugStoreXA
DebugStoreXAVerbose
DebugTunnelingConnection
DebugTunnelingConnectionTimeout
DebugURLResolution
DebugWANReplicationDetails
DebugWTCConfig
DebugWTCCorbaEx
DebugWTCGwtEx
DebugWTCJatmiEx
DebugWTCTDomPdu
DebugWTCUData
DebugWTCtBridgeEx
DebugWebAppIdentityAssertion
DebugWebAppModule
DebugWebAppSecurity
DebugWorkContext
DebugXMLEntityCacheIncludeClass
DebugXMLEntityCacheIncludeLocation
DebugXMLEntityCacheIncludeName
DebugXMLEntityCacheIncludeTime
DebugXMLEntityCacheUseShortClass
DebugXMLRegistryIncludeClass
DebugXMLRegistryIncludeLocation
DebugXMLRegistryIncludeName
DebugXMLRegistryIncludeTime
DebugXMLRegistryUseShortClass

Sunday, May 4, 2014

SOA-INFRA Application is in unknown Type - Oracle SOA Suite 11g

SOA-INFRA Application is in unknown Type - Oracle SOA Suite 11g:

I was facing a strange issue,the Type of the soa-infra application was unknown but the state and the health of the application is looking fine(Active and OK) in admin console.
Because of this the SOA node is not displayed in the em console.




Tried restarting the server without any luck and also updated(redeployed) the soa-infra application but still the type of the application is unknown.

I could not able to find any exception related to this issue in the log files and also there is no issue related to the database schema's.

Steps to resolve the issue

Delete the soa-infra application from the admin console deployments.
Install the soa-infra application(soa-infra-wls.ear) from the location SOA_HOME\soa\applications as Enterprise Application.

Saturday, May 3, 2014

WLST script to enable Backup/Archive configurations in weblogic server

WLST script to enable Backup/Archive configurations in weblogic server


By enabling the backup/archiving in Weblogic, the administration Server can automatically backups the domain configuration (the entire domain-name/config directory) during the server boot to DOMAIN_HOME\config-original.jar and config-booted.jar.

Also multiple versions of the domain config will be archived by the Administration Server, each time the domain configuration is modified into the DOMAIN_CONFIG\configArchive folder.

The configuration archives can be used for system restoration in cases where accidental configuration changes need to be reversed.

This tutorial explains how to use WLST script to enable backup/archive configurations.


WLST Script


The below WLST script will help us to enable the backup/archive configurations

EnableArchiving.py

adminURL='t3://localhost:7001'
adminUserName='weblogic'
adminPassword='weblogic1'
connect(adminUserName, adminPassword, adminURL)
domainRuntime()
edit()
startEdit()
cmo.setConfigBackupEnabled(true)
cmo.setArchiveConfigurationCount(5)
save()
activate()



Script
https://github.com/techforum-repo/youttubedata/blob/master/scripts/wlst/EnableArchiving.py

Execute the script

<<Oracle_Home>>\oracle_common\common\bin\wlst.cmd EnableArchiving.py



Verify the configuration


To verify the configuration- Login to admin console →Click on Domain in the left panel →Expand the Advanced in General Configuration section



When the Admin Server starts up it automatically makes a backup of DOMAIN_HOME/config directory and stores it in DOMAIN_HOME/config-original.jar(original configuration file while restarting the server) and once the start up completed(booted) successfully it makes a backup of DOMAIN_HOME/config directory and stores it in DOMAIN_HOME/config-booted.jar(the config file on which the server is booted successfully) .

Most of the cases both of the file contents will be same. If the server fails to boot successfully the config-booted.jar will not be generated and the old config-booted.jar file will be left as it is.



Also whenever the domain configuration is modified, the admin server archive the previous configurations to the DOMAN_HOME\configArchive folder.The files use the naming convention as config-number.jar, where number is the sequential number of the archive.After it reaches the maximum number of archive files specified in the configuration(ArchiveConfigurationCount — 5), older archive files will be discarded



Recover the configurations


Follow the below steps to recover the configurations from archive

Stop the servers

Rename the current <<DOMAIN-HOME>>/config folder to config-bkp

Create a folder with name config under <<DOMAIN-HOME>>

cd to <<DOMAIN-HOME>>/configArchive in a command prompt

Execute the below command(change the archive file name as required)

tar -xf config-1.jar -C <<DOMAIN-HOME>>\config



Start the server — now the configurations are restored from the archive.

Friday, May 2, 2014

Transforming the REST XML message to SOAP message - OSB

Transforming the REST XML message to SOAP message - OSB

This post will explain how to Transform the REST XML message to SOAP message in OSB

While receiving the response from REST interface  with the content type as application\xml, the input XML will be plain without the target namespace specified.
But if you are invoking the BPEL with this message the BPEL cant perform any xpath operations on this message without target namespace.The target namespace should be added to the message.

The XSLT can be used to add the name space to the XML message but before performing this operation the SOAP envelope of the body variable should be removed
After removing the namespace the XML should be assigned to the body variable to send to target system.

Follow the below steps to achieve the same:

Remove SOAP Envelope:

The below XSLT will help as to remove the namespace from the XML.

Create a XSLT resource from SB console.
Add a Assign activity with the XSLT resource
Assign the output to a temp variable - var1.

<?xml version="1.0" encoding="UTF-8" ?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
  <xsl:template match="@* | node()">
        <xsl:copy>
          <xsl:apply-templates select="@* | node()" />
        </xsl:copy>
      </xsl:template>

      <xsl:template match="soapenv:*">
        <xsl:apply-templates select="@* | node()" />
  </xsl:template>
</xsl:stylesheet>


Transforming the SOAP message to REST XML message- OSB

Transforming the SOAP message to REST XML message- OSB

While invoking the REST interface from OSB with the content type defined as application\xml, the target system will expect the simple XML message without the target namespace specified.

The XSLT can be used to remove the name space from SOAP message but before performing this operation the SOAP envelope of the body variable should be removed
After removing the namespace the XML should be assigned to the body variable to send to target system.

Follow the below steps to achieve the same:

Remove SOAP Envelope:

The below XSLT will help as to remove the namespace from the XML.

Create a XSLT resource from SB console.
Add a Assign activity with the XSLT resource
Assign the output to a temp variable - var1.

<?xml version="1.0" encoding="UTF-8" ?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
  <xsl:template match="@* | node()">
        <xsl:copy>
          <xsl:apply-templates select="@* | node()" />
        </xsl:copy>
      </xsl:template>

      <xsl:template match="soapenv:*">
        <xsl:apply-templates select="@* | node()" />
  </xsl:template>
</xsl:stylesheet>

Removing Namespace:

The below XSLT will help as to add the target namespace to the XML.

Create a XSLT resource from SB console.
Add a Assign activity with the XSLT resouce  to remove the namespace from the variable var1
Assign the ouput to a temp variable - var2

<?xml version="1.0" encoding="UTF-8" ?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
  <xsl:template match="*">
        <xsl:element name="{local-name()}">
            <xsl:apply-templates select="@* | node()" />
        </xsl:element>
    </xsl:template>
    <xsl:template match="@*">
        <xsl:attribute name="{local-name()}">
            <xsl:value-of select="." />
        </xsl:attribute>
    </xsl:template>
    <xsl:template match="text() | comment() | processing-instruction()">
        <xsl:copy />
    </xsl:template>
</xsl:stylesheet>

Assign the content of var2 to body:

Add replace activity to replace the node contents of body with var2


Unable to post the message to MQ through MQ adapter - Oracle SOA Suite

Unable to post the message to MQ through MQ adapter - Oracle SOA Suite

Sometimes we will be getting the below exception while posting the message to MQ  through MQ adapter in Oracle SOA Suite.

"Exception occured when binding was invoked. Exception occured during invocation of JCA binding: "JCA Binding execute of Reference operation 'Enqueue' failed due to: A webSphere MQ Error occurrred[while putting the message]. A webSphere MQ Error occurrred[while putting the message]. A webSphere MQ Error occurrred while putting the message in Queue: "EAI_ORD_RPLY_Q ". Please make sure that the Queue is Put enabled, not full, message do not exceeds maximum message length and QueueManger is up and running. ". The invoked JCA adapter raised a resource exception. Please examine the above error message carefully to determine a resolution."


Mainly this exception can occur if there is any issue with the MQ Adapter configuration or issue with the MQ server components.

The following steps can be followed to identify the issue.

MQ Adapter perspective:

Verify the MQSeriesAdapter health and state is fine


Verify the connection factory used in the Adapter is configured in weblogic server

Tuesday, April 29, 2014

Unable to get schema information for source - JDeveloper

Unable to get schema information for source - JDeveloper

I was getting the error "Unable to get schema information for source" while generating the XSL mapper file in the BPEL Transform activity through JDeveloper. The same error was coming while editing the existing mapper file in a transform activity with the same source variable.


But the component is getting deployed successfully and also the flows are working fine without any issue.

After the analysis i found that there is two schema's imported with the same name space into the wsdl and one of the them is used to create the message type for the source variable in the transformation.


Approaches to fix the issue

  •  Make sure the schema's are imported with different name space or create a consolidated schema and import the same 
  • Include the schema's that has the same names instead of importing them into the wsdl.

WLST script to set the XA Transaction timeout values for a data source in weblogic server

WLST script to set the XA Transaction timeout values for a data source in weblogic server


This tutorial explains the approach to set some of the important timeout properties for XA data sources in weblogic server through WLST script.

Set XA Transaction Timeout


Enables WebLogic Server to set a transaction branch timeout based on the value for XaTransactionTimeout.

When enabled, the WebLogic Server Transaction Manager calls XAResource.setTransactionTimeout() before calling XAResource.start, and passes either the XA Transaction Timeout value or the global transaction timeout.

XA Transaction Timeout


The number of seconds to set as the transaction branch timeout.
If set, this value is passed as the transaction timeout value in the XAResource.setTransactionTimeout() call on the XA resource manager, typically the JDBC driver.

When this value is set to 0, the WebLogic Server Transaction Manager passes the global WebLogic Server transaction timeout in seconds in the method.

If set, this value should be greater than or equal to the global WebLogic Server transaction timeout.


XA Retry Duration


Determines the duration in seconds for which the transaction manager will perform recover operations on the resource. A value of zero indicates that no retries will be performed.
XA Retry Interval

The number of seconds between XA retry operations if XARetryDurationSeconds is set to a positive value.

Please note the above configurations are only available to the data sources created with XA supported driver


WLST Script


The below wlst script set the required XA timeout properties

SetXATimeoutProperties.py
def setXATimeoutProperties():
   dsName='JDBC Data Source-0'
   edit()
   startEdit()
       
   server='AdminServer'
   cd("Servers/"+server)
   target=cmo
 
   print '========================================='
   print 'Setting the timeout properties for DataSource....'
   print '========================================='  
           
   cd('/JDBCSystemResources/'+dsName+'/JDBCResource/'+dsName+'/JDBCXAParams/'+dsName)
   cmo.setXaSetTransactionTimeout(true)cd('/JDBCSystemResources/'+dsName+'/JDBCResource/'+dsName+'/JDBCXAParams/'+dsName)
   cmo.setXaTransactionTimeout(3000)cd('/JDBCSystemResources/'+dsName+'/JDBCResource/'+dsName+'/JDBCXAParams/'+dsName)
   cmo.setXaRetryDurationSeconds(300)cd('/JDBCSystemResources/'+dsName+'/JDBCResource/'+dsName+'/JDBCXAParams/'+dsName)
   cmo.setXaRetryIntervalSeconds(60)save()
   activate()print 'Timeout settings for the datasource '+dsName+' has been completed'
 
 
def main():
     
    adminURL='t3://localhost:7001'
    adminUserName='weblogic'
    adminPassword='weblogic1'
    connect(adminUserName, adminPassword, adminURL)
    setXATimeoutProperties()
    disconnect()main()

Script

https://github.com/techforum-repo/youttubedata/blob/master/scripts/wlst/SetXATimeoutProperties.py

Before executing the script change the configuration values as required

Execute the script — <<Oracle_Home>>\oracle_common\common\bin\wlst.cmd SetXATimeoutProperties.py



Restart the server after successful execution. Now the XA configurations are enabled as required.

Monday, April 28, 2014

WLST script to set the JDBC Connection timeout properties in weblogic server

WLST script to set the JDBC Connection timeout properties in weblogic server


There are different timeout properties in JDBC connection, this tutorial explains the approach to set some of the important JDBC Connection timeout properties in weblogic server through WLST script.

Inactive Connection Timeout


The number of inactive seconds on a reserved connection before WebLogic Server reclaims the connection and releases it back into the connection pool.
You can use the Inactive Connection Timeout feature to reclaim leaked connections — connections that were not explicitly closed by the application.


Connection Reserve Timeout


The number of seconds after which a call to reserve a connection from the connection pool will timeout.
When set to 0, a call will never timeout.
When set to -1, a call will timeout immediately.


Statement Timeout


The time after which a statement currently being executed will time out.
A value of -1 disables this feature.
A value of 0 means that statements will not time out.


oracle.jdbc.ReadTimeout


The property oracle.jdbc.ReadTimeout helps to set read timeout while reading from the socket.

oracle.net.READ_TIMEOUT for jdbc versions < 10.1.0.5 oracle.jdbc.ReadTimeout for jdbc versions >=10.1.0.5


oracle.net.CONNECT_TIMEOUT


The property oracle.net.CONNECT_TIMEOUT helps to set the login time out in Oracle.
WLST Script

The below WLST script will help us to set the JDBC connection timeout properties

SetJDBCTimeoutProperties.py
def setJDBCTimeoutProperties():
   dsName='CRM6EAIReference'
   edit()
   startEdit()
       
   server='AdminServer'
   cd("Servers/"+server)
   target=cmo
 
   print '========================================='
   print 'Setting the timeout properties for DataSource....'
   print '========================================='  
           
   cd('/JDBCSystemResources/'+dsName+'/JDBCResource/'+dsName+'/JDBCDriverParams/'+dsName+'/Properties/'+dsName)
   #cmo.destroyProperty(getMBean('/JDBCSystemResources/'+dsName+'/JDBCResource/'+dsName+'/JDBCDriverParams/'+dsName+'/Properties/'+dsName+'/Properties/oracle.net.CONNECT_TIMEOUT'))
   cmo.createProperty('oracle.net.CONNECT_TIMEOUT')


Script

https://github.com/techforum-repo/youttubedata/blob/master/scripts/wlst/SetJDBCTimeoutProperties.py

Before executing the script, change the configurations as required.

Execute the script — <<Oracle_Home>>\oracle_common\common\bin\wlst.cmd SetJDBCTimeoutProperties.py



Restart the server after successful execution. Now the JDBC connection timeout properties are set to the datasource.



Under advanced section

Sunday, April 27, 2014

Purging the Oracle Service Bus(OSB) Alerts

Purging the Oracle Service Bus(OSB) Alerts

The History of  Alerts in OSB can be purged through OSB console.

Make sure you are purging the alerts regularly otherwise you may face some of the  the issues like
  • The server will take more time to start
  • The alert dashboard will become very slow.
Login to sbconsole and click on Operations-->Monitoring-->Dashboard
Click on Extended Alert History


Click on "Purge SLA Alerts History"


Saturday, April 26, 2014

A timeout occurred while interacting with sever. Limited information is available - Weblogic

A timeout occurred while interacting with sever. Limited information is available  - Weblogic 

We were getting the error "A timeout occurred while interacting with Server. Limited information is available" while accessing the Server Page from the admin console in clustered weblogic environment and the health of the server is shown as empty but the state is shown as running.
Login to the admin console and accessing the Server page also was taking more time
But the individual servers and the node managers are running fine in all the nodes.


The issue seems to be because of the delay in the communication between the node manager and the managed servers.

Steps to resolve the issue:

  • Stop all the managed servers from all the nodes.
  • Kill the node managers from all the nodes.
  • Stop the Admin server.
  • Start the node manager in all the nodes.
  • Start the Admin server.
  • Start all the managed server.

Purging Application Not Available - Oracle OSB

Purging Application Not Available - Oracle OSB

While we are trying to purge the reports from OSB sbconsole we may get the following message in the console.

"Purging Application Not Available.Message Reporting Purger is not deployed, or it is not active"





The issue is due to the the application "Message Reporting Purger" might not be deployed or not in active state.

Verify the application is active from the admin console. If the application is not deployed then deploy the application 
from the following location oracle/product/soa/11g/fmw/Oracle_OSB/lib/common/msgpurger. ear with the application name 
"Message Reporting Purger"



Configuring Proxy Sever for Oracle Service Bus(OSB)

Configuring Proxy Sever for Oracle Service Bus(OSB)

Sometimes we may required to use the Proxy server in OSB for outbound communication.

The Proxy Server can be configured to the Business Service as below.

Configure the Proxy Server:

The first step is we have to configure the Proxy server in the OSB global resources.

Login to OSB an click on System Administration and Proxy Servers in the Global resources section.
Click on Add button

Enter the Proxy server details and click on Add button in the Host-Port Parameters section.
If the the authentication is required then provide the username/password.
Save the configurations.

Wednesday, April 23, 2014

Error while creating datasource using WLST - java.lang.ClassCastException

Error while creating datasource using WLST - java.lang.ClassCastException

When we are creating the datasource through WLST script in weblogic server may may receive the following exception in create method.

Creating DataSource:  EAISOAMetadataSource  ....
Problem invoking WLST - Traceback (innermost last):
  File "/reuters/oracle/as01/wlst/GridLinkDatasourceCreation.py", line 115, in ?
  File "/reuters/oracle/as01/wlst/GridLinkDatasourceCreation.py", line 108, in main
  File "/reuters/oracle/as01/wlst/GridLinkDatasourceCreation.py", line 39, in createGridLinkJDBCResources
  File "<iostream>", line 528, in create
        at weblogic.management.scripting.EditHandler.create(EditHandler.java:531)
        at weblogic.management.scripting.WLScriptContext.create(WLScriptContext.java:332)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)

java.lang.ClassCastException: java.lang.ClassCastException: java.lang.reflect.InvocationTargetException cannot be cast to weblogic.management.scripting.ScriptException

I colud not able to find the exact root cause but able to resolve the issue "Undo All Changes" from weblogic console and re-exectiong the script.

Steps to resolve the issue

Login to weblogic admin console
Verify whether any changes are pending to be activated.
Perform Activate Changes or Undo All Changes


Re-execute the script, this time script will create the datasource successfully.

Different approaches for connecting Weblogic Server to RAC database

Different approaches for connecting Weblogic Server to RAC database

Oracle Real Application Clusters (RAC) is a software component you can add to a high-availability solution that enables users on multiple machines to access a single database with increased performance. RAC comprises two or more Oracle database instances running on two or more clustered machines and accessing a shared storage device via cluster technology.


If your application requires load balancing across RAC nodes, WebLogic Server supports this capability through use of Using Connect-Time Load Balancing/Failover with Oracle RAC(JDBC URL based Load Balancing/Failover), JDBC Multi Data sources with Oracle RAC nodes and Gridlink Data Source.

Multi Data Source:

Refer the below URL's for details on Multi Data Source.

http://www.albinsblog.com/2012/02/jdbc-multi-data-sources-in-weblogic.html#.U1YNuvmukdQ
http://www.albinsblog.com/2012/02/creating-jdbc-multi-data-source-through.html

Connect-Time Load Balancing/Failover with Oracle RAC(JDBC URL based Load Balancing/Failover):

The JDBC connection string can be configure with single data source to support the load balancing and failover with RAC data source nodes.
Create a Generic Data source in weblogic server and provide the JDBC URL as below.Enable and disable the load balancing and failover accordingly.

jdbc:oracle:thin:@(DESCRIPTION=(ADDRESS_LIST=(LOAD_BALANCE=on)(FAILOVER=on)(ADDRESS=(PROTOCOL=tcp)(HOST=RAC node1)(PORT=1521))(ADDRESS=(PROTOCOL=tcp)(HOST=RAC node2)(PORT=1521)))(CONNECT_DATA=(SERVICE_NAME=servicename)))

There are some limitation using this approach like the Global XA transactions are not supported.

WLST script to create Gridlink data source in weblogic

WLST script to create Gridlink data source in weblogic

This tutorial explains the approach to create Gridlink data source through WLST script in weblogic

Refer the below URL for details on Gridlink data source

https://www.albinsblog.com/2014/04/different-approaches-for-connecting.html


WLST Script


The below WLST script creates the Gridlink datasource with enabled configurations

GridLinkDataSource.properties

dbURL=jdbc:oracle:thin:@(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=dbhost1)(PORT=1521))(ADDRESS=(PROTOCOL=TCP)(HOST=dbhost2)(PORT=1521)))(CONNECT_DATA=(SERVICE_NAME=SERVICENAME)))
connectionpool.test.query=SQL SELECT * FROM DUAL
connectionpool.driver.class=oracle.jdbc.OracleDriver
connectionpool.username=SOA_EAIOWNER
connectionpool.password=orasoa11g
connectionpool.initCapacity=10
connectionpool.maxCapacity=60
datasource.name=EAISOAMetadataSource
datasource.jndi.name=eai/ds/EAISOAMetadataSource
datasource.target=Servers/AdminServer

domain.AdminIP=localhost
domain.AdminPort=7201

domain.AdminPasswd=Albin123!

GridLinkDatasourceCreation.py

from java.io import FileInputStreamdef createGridLinkJDBCResources(configProps):
   edit()
   startEdit()
        
   server='AdminServer'
   cd("Servers/"+server)
   target=cmo
   cd("../..")
   print '========================================='
   print 'Creating GridLink DataSource....'
   print '========================================='
   dsTestQuery=configProps.get("connectionpool.test.query")
   dsDriverName=configProps.get("connectionpool.driver.class")
  
            
   cd('/')
   dbURL= configProps.get("dbURL")           
   dsUserName = configProps.get("connectionpool.username")
   dsPassword = configProps.get("connectionpool.password")
   initCapacity = configProps.get("connectionpool.initCapacity")
   maxCapacity = configProps.get("connectionpool.maxCapacity")
   dsName = configProps.get("datasource.name")
   jndiname = configProps.get("datasource.jndi.name")
   datasourceTargets = configProps.get("datasource.target").split(",")print 'dsUserName',dsUserName
   print 'dsPassword',dsPassword
   print 'initCapacity',initCapacity
   print 'maxCapacity',maxCapacity
   print 'dsName',dsName
   print 'jndiname',jndiname
   print 'datasourceTargets',datasourceTargetsprint 'Creating DataSource: ',dsName,' ....'
  
   myResourceName = dsName   
   jdbcSystemResource = create(myResourceName,"JDBCSystemResource")     
   myFile = jdbcSystemResource.getDescriptorFileName()     
   jdbcResource = jdbcSystemResource.getJDBCResource()     
   jdbcResource.setName(myResourceName)# Create the DataSource Params     
   dpBean = jdbcResource.getJDBCDataSourceParams()     
   myName=jndiname 
   dpBean.setJNDINames([myName]) 
   dpBean.setGlobalTransactionsProtocol('TwoPhaseCommit')
    
   # Create the Driver Params     
   drBean = jdbcResource.getJDBCDriverParams()     
   drBean.setPassword(dsPassword)     
   drBean.setUrl(dbURL)     
   drBean.setDriverName(dsDriverName)#Create the Oracle params
   orapr=jdbcResource.getJDBCOracleParams()
   orapr.setFanEnabled(true)
   orapr.setOnsNodeList('node1:6200,node2:6200')
   propBean = drBean.getProperties()
   driverProps = Properties()     
   driverProps.setProperty("user",dsUserName)
   e = driverProps.propertyNames()
   while e.hasMoreElements() :             
  propName = e.nextElement()             
  myBean = propBean.createProperty(propName)           
  myBean.setValue(driverProps.getProperty(propName))   
  
  # Create the ConnectionPool Params     
  ppBean = jdbcResource.getJDBCConnectionPoolParams()     
  ppBean.setInitialCapacity(int(initCapacity))     
  ppBean.setMaxCapacity(int(maxCapacity))     
  ppBean.setTestConnectionsOnReserve(true)     
  ppBean.setTestTableName('SQL SELECT 1 FROM DUAL')xaParams = jdbcResource.getJDBCXAParams()     
  xaParams.setKeepXaConnTillTxComplete(1)# Add Target
   for datasourceTarget in datasourceTargets:
  print 'DataSourceTargets',datasourceTargets
  print 'DataSourceTarget',datasourceTarget
  if datasourceTarget=='':
   print ''
  else:
   jdbcSystemResource.addTarget(getMBean(datasourceTarget))     
  
 
   print 'DataSource: ',dsName,', has been created Successfully !!!'
   print '========================================='   
        
  
   save()
   activate()def main():
    propInputStream1 = FileInputStream("GridLinkDataSource.properties")
    configProps = util.Properties()
    configProps.load(propInputStream1)
  
    adminURL='t3://'+configProps.get('domain.AdminIP')+':'+configProps.get('domain.AdminPort')
    adminUserName='weblogic'
    adminPassword=configProps.get("domain.AdminPasswd")
    connect(adminUserName, adminPassword, adminURL)
  
    createGridLinkJDBCResources(configProps); 
  
    print 'Successfully created JDBC resources for SOACoreDomain'disconnect()main()

Script

https://github.com/techforum-repo/youttubedata/tree/master/scripts/wlst/GridLinkDatasourceCreation

Before executing the script, change the configurations as required.Change the ONS node details in the script.

Execute the script — <<Oracle_Home>>\oracle_common\common\bin\wlst.cmd GridLinkDatasourceCreation.py



After the successful execution of the script login to console and verify the Gridlink datasource created.