Saturday, April 26, 2014

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.