Monday, May 7, 2012

Java code to Decrypt the weblogic server passwords

The below Java code will help us to decrypt the weblogic server password

import weblogic.security.internal.SerializedSystemIni;
    import weblogic.security.internal.encryption.ClearOrEncryptedService;
    import weblogic.security.internal.encryption.EncryptionService;
   
    public class Decrypt {
        public static void main(String[] args) {
            String string = args[0];
            EncryptionService encryptionService = SerializedSystemIni.getEncryptionService();
            ClearOrEncryptedService clearOrEncryptedService = new ClearOrEncryptedService(encryptionService);
            System.out.println("Clear text password: " + clearOrEncryptedService.decrypt(string));
        }
    }


weblogic.transaction.internal.TimedOutException:Transaction timed out after 301 seconds – Oracle SOA Suite


weblogic.transaction.internal.TimedOutException:Transaction timed out after 301 seconds – Oracle SOA Suite:

Frequently the Oracle  BPEL instances are getting rolled back with the following exception.
 The root cause of the issue is, JTA transaction getting timeout before completing the execution of the BPEL instance; the JTA transaction should be active to complete the execution successfully.

[2012-04-26T05:15:45.139+00:00] [SOA1] [ERROR] [] [oracle.soa.bpel.engine] [tid: orabpel.invoke.pool-4.thread-23] [userId: <anonymous>] [ecid: 0000JRh3heOAxGoqwSuXMG1F_qb^000aP5,0:1:100080683] [APP: soa-infra] [composite_name: AM_Invoker] [component_name: AM_Invoker] [component_instance_id: 5977508] The reason was The execution of this instance "5977508" for process "AM_Invoker" is supposed to be in an active jta transaction, the current transaction status is "MARKED_ROLLBACK" . Root cause: null

 [APP: soa-infra] Error while invoking bean "cube delivery": JTA transaction is not in active state.[[
The transaction became inactive when executing activity "5977508-BpInv1-BpSeq9.78-2" for instance "5,977,508", bpel engine cannot proceed further without an active transaction. please debug the invoked subsystem on why the transaction is not in active status. the transaction status is "MARKED_ROLLBACK".

Message handle error.error while attempting to process the message "com.collaxa.cube.engine.dispatch.message.invoke.InvokeInstanceMessage"; the reported exception is: Transaction Rolledback.: weblogic.transaction.internal.TimedOutException: Transaction timed out after 301 seconds
BEA1-2980B7B48F411EE46991

Solution:

Increase the JTA time out and the BPEL EJB transaction timeout.

Change the JTA transaction timeout:

  1. Log in to Oracle WebLogic Server Administration Console.
  2. In the Domain Structure, select Services > JTA
  3. Increase the JTA transaction timeout value to some higher value like 3600

Change the BPEL EJB transaction timeout settings:

  1. Log in to Oracle WebLogic Server Administration Console.
  2. In the Domain Structure, click Deployments.
  3. Expand soa-infra > EJBs.
  4. Update the following EJBs transaction Timeout value to some higher value like 1200:
 BPELActivityManagerBean
 BPELEngineBean
 BPELInstanceManagerBean
 BPELProcessManagerBean
 BPELServerManagerBean
  1. Click Save.
  2. Restart Oracle WebLogic Server.
There is no standard value for transaction timeout property. We need to trail out and set the value.
If the component still fails with the transaction timeout error then revisit the component design and tune the same.



Sunday, May 6, 2012

Java code to Marshal/Unmarshal XML using JAXB

Java code to Marshal/Unmarshal XML using JAXB:

Unmarshalling:

JAXBContext jc =JAXBContext.newInstance("com.java.test");//add multiple packages seperated by ":" eg.com.java.test1:com.java.test2
Unmarshaller u = jc.createUnmarshaller();
JAXBElement obj =(JAXBElement)u.unmarshal(new File(inputXMLPath)); // ok

Marshalling

Marshaller marshaller = jc.createMarshaller();
marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT,Boolean.TRUE);
String outXML = "Response.xml";
marshaller.marshal(obj,new FileOutputStream(outXML));


Thursday, May 3, 2012

java.lang.ArrayIndexOutOfBoundsException in DB Adapter – Oracle SOA Suite 11g


java.lang.ArrayIndexOutOfBoundsException in DB Adapter – Oracle SOA Suite 11g:

The DB Adapter insert were intermittently failing with the following exception in our Oracle SOA Suite environments. 

Exception occured during invocation of JCA binding: "JCA Binding execute of Reference operation 'update' failed due to: DBWriteInteractionSpec Execute Failed Exception. update failed. Descriptor name: [Update_Interfacebuffer.InterfaceBuffer].
Caused by java.lang.ArrayIndexOutOfBoundsException. Please see the logs for the full DBAdapter logging output prior to this exception. This exception is considered not retriable, likely due to a modelling mistake.

It is caused by using a non-synchronized class instead of a synchronized class. Read the Metalink Note 1332114.1 for more details about this.

Oracle suggested us to apply the below patch to resolve the issue.

Patch 11866793: DBADAPTER INSERT OPERATION IS FAILING INTERMITTENTLY WITH NPE

The issue is observed in the following versions 11.1.1.3.0, 11.1.1.4.0 and 11.1.1.5.0 and Fixed in the version 11.1.1.6.0.

The issue got resolved after applying the patch.


Wednesday, May 2, 2012

WLST script to reset data source password in weblogic server

WLST script to reset data source password in weblogic server


This tutorial explains the approach to reset the password of all the data sources in weblogic server. Sometime we may need to reset the password of all the data sources, the below WLST script can be used to achieve the same.

The reset through console takes more time, the below WLST script helps to reset the password quickly

WLST Script


ResetAllDataSourcePassword.py

adminIP = raw_input("Enter domain1.AdminIP:")
adminPort = raw_input("Enter domain1.AdminPort:")
adminPassword = raw_input("Enter adminPassword:")
DBPASSWORD= raw_input("Enter new DBPASSWORD:")
DOMAIN_PATH='C://Albin/SW/Oracle/Middleware/Oracle_Home/user_projects/domains/base_domain'
es = encrypt(DBPASSWORD,DOMAIN_PATH)
adminURL='t3://'+adminIP+':'+adminPort
adminUserName='weblogic'
connect(adminUserName, adminPassword, adminURL)
server='AdminServer'
cd('Servers/'+server)
target=cmo
edit()
startEdit()# SOADomain Datasource Configuration
cd('JDBCSystemResources')
allDS=cmo.getJDBCSystemResources()
for tmpDS in allDS:
    dsName=tmpDS.getName();
    print  'Changing the Password for DataSource ', dsName
    cd('/JDBCSystemResources/'+dsName+'/JDBCResource/'+dsName+'/JDBCDriverParams/'+dsName)
    set('PasswordEncrypted',es)
save()
activate()
disconnect()


Script

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

Before executing the script, change the configurations as required.

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



Now the data sources password reset to new value.