Quantcast
Channel: Oracle SOA
Viewing all 34 articles
Browse latest View live

OSB Service WSDL URL throws "Error 404--Not Found"

$
0
0
Recently we found an issue with the services registered in OSB. Even though services were registered successfully, we were not able to invoke the WSDL URLs. It was throwing "Error 404-Not Found". As per this error code the service is not available at the server, however when we looked into OSB console, we could see these services. Nothing could be seen in the log to identify the root cause.

Finally after lot of troubleshooting, we found the issue. It was because for the web service registered in the OSB, "State" was not enabled for the proxy service as shown below.

When the state was enabled by clicking the checkbox and the change was activated, we were able to access the WSDL of the registered OSB service.

Oracle Fusion Middleware (SOA/OSB) 11g System Requirements and Specifications

$
0
0
Before installing Oracle SOA/OSB, it is a good practice to ensure that the system requirements and specifications are met. This ensure that during installation no issue will be faced due to missing library or insufficient value if any OS parameter.

This document is for Red Hat Linux 5 (x86-64).

Oracle SOA Suite 11.1.1.6.0 Installation on Windows

Oracle OSB 11g Installation on Linux 64 bit

Steps to install JAVA on Linux

Oracle XE 11.2.0 Installation Guide on Linux 64 bit

//oracle4357.rssing.com/chan-50065777/article7-live.html

$
0
0

Error:-

<Error> <EJB> <BEA-010026><Exception occurred during commit of transaction Name=[EJB com.collaxa.cube.engine.ejb.impl.bpel.BPELDeliveryBean.handleInvoke(java.lang.
String,boolean)],Xid=BEA1-11A31559DD40A4092BE4(257133113),Statxus=Rolled back. [Reason=javax.transaction.xa.XAException: JDBC driver does not support XA, hence cannot be a participant in two-phase commit. To force this participation, set the GlobalTransactionsProtocol attribute to LoggingLastResource (recommended) or EmulateTwoPhaseCommit for the Data Source = AIADataSourceDS],numReplie
sOwedMe=0,numRepliesOwedOthers=0,seconds since begin=2,seconds left=60,NonXAServerResourceInfo[WL_JDBC_LLR_POOL.SOADataSource]=(ServerResourceInfo[WL_JDBC_LLR_POOL.SOADataSource]

Root Cause:- 

 Data source "AIADataSourceDS" is non-XA data source using "oracle.jdbc.OracleDriver" driver. "Supports Global Transactions" was enabled to support Global Transaction by the non-XA data sources. When you select Supports Global Transactions, you must also select the protocol for WebLogic Server to use for the transaction branch when processing a global transaction. There are three protocols for this-
  • Logging Last Resource
  • Emulate Two-Phase Commit
  • One-Phase Commit  
However in this case, none of the above protocol was selected.

Solution:-

There are two solutions for this based on the requirement

1. If your requirement is to support global transaction using nonXA datasource then select any of the above protocol. Save and activate your changes. Restart the servers to which the data source was targeted.

2. If your requirement is to support local transaction then uncheck "Supports Global Transactions". Save and activate your changes. Restart the servers to which the data source was targeted.

weblogic.management.DeploymentException: Bind operation failed

$
0
0
Error:-

weblogic.management.DeploymentException: Bind operation failed: eis/jms/CommonXA, weblogic.management.DeploymentException: Resource Adapter with JNDIName: eis/jms/CommonXA already deployed
        at weblogic.connector.deploy.JNDIHandler.bindConnectionFactory(JNDIHandler.java:219)
        at weblogic.connector.outbound.RAOutboundManager.activatePool(RAOutboundManager.java:1076)
        at weblogic.connector.outbound.RAOutboundManager.activate(RAOutboundManager.java:183)


Cause:-

The JNDI "eis/jms/CommonXA" already exists under a resource adapter and you are trying to create a new JNDI with the same JNDI name i.e. "eis/jms/CommonXA"

Solution:-

1. Delete the newly created JNDI and then create it with a different JNDI name
2. Delete the existing JNDI

A JNDI name should be UNIQUE across the DOMAIN.



keytool error: java.lang.Exception: Input not an X.509 certificate

$
0
0
Problem Statement:-

While importing .pem format certificate in weblogic keystore using keytool command error was thrown as below
keytool error: java.lang.Exception: Input not an X.509 certificate



Background:-


I converted .p7b to .pem format using below command
openssl pkcs7 -print_certs -in ABC.p7b -inform der -out ABC.pem

and then tried importing it using keytool command 
keytool -importcert -alias ABC -file ABC.pem -keystore demoidentity.jks -storepass password

Cause:-

ABC.pem contains extra lines as highlighted below

subject=/serialNumber=6npr-psjxdqgGUW/7AUAFQC-27Xr/C=US/ST=California/L=Sunnyvale/O=ABC/CN=b2btest.abc.net
issuer=/C=US/O=GeoTrust, Inc./CN=GeoTrust SSL CA
-----BEGIN CERTIFICATE-----

Solution:-
Remove ALL the occurrence of highlighted line in the pem file and re-try.
 

 

JAVA API to abort RUNNING SOA Composite Instances

$
0
0
I got a requirement from our client to create a JAVA API that can abort all the RUNNING composite instances. This was required as purging script do not purge composite instances in running instances.
JAVA API Source Code-

import java.util.Hashtable;
import java.util.List;
import javax.naming.Context;
import oracle.soa.management.facade.Component;
import oracle.soa.management.facade.ComponentInstance;
import oracle.soa.management.facade.Composite;
import oracle.soa.management.facade.Locator;
import oracle.soa.management.facade.LocatorFactory;
import oracle.soa.management.util.ComponentInstanceFilter;
import oracle.soa.management.util.CompositeInstanceFilter;
import oracle.soa.management.facade.CompositeInstance;
import oracle.soa.management.CompositeDN;

public class abortComposite {
        public abortComposite() {
        super();
        }
        public void abortRunningComposite() {
        Locator locator = null;
        Hashtable jndiProps = new Hashtable();
        //Connection Details to Connect to Server
        jndiProps.put(Context.PROVIDER_URL, "t3://hostname:portnumber/soa-infra");
        jndiProps.put(Context.INITIAL_CONTEXT_FACTORY,  "weblogic.jndi.WLInitialContextFactory");
        jndiProps.put(Context.SECURITY_PRINCIPAL, "weblogic");
        jndiProps.put(Context.SECURITY_CREDENTIALS, "password");
        jndiProps.put("dedicated.connection", "true");

        try {
                //Connect to SOA Server
                locator = LocatorFactory.createLocator(jndiProps);
                System.out.println("Connected to SOA Server.");
                java.util.List
compositeDN=locator.listComposites();
                CompositeInstanceFilter filter = new CompositeInstanceFilter();
                //Set Minimum Creation Time
                filter.setMinCreationDate(new java.util.Date("Tue Aug 10 13:22:02 PDT 2013"));
                //Set Maximum Creation Time
                filter.setMaxCreationDate(new java.util.Date("Tue Aug 30 13:22:02 PDT 2013"));
                //Set for RUNNING State
                filter.setState(0);
                Composite composite=null;
                List
obInstances=null;
                //For each of the returned composite
                for (CompositeDN compositeDN1 : compositeDN) {
                        composite = locator.lookupComposite(compositeDN1);
                        //Get composite instances by filter
                        obInstances = composite.getInstances(filter);
                        //for each of the returned composite instances
                        for (CompositeInstance instance : obInstances) {
                                System.out.println(" DN: " + instance.getCompositeDN() + " Instance: " + instance.getId() + " creation-date: " + instance.getCreationDate() + " state (" + instance.getState() + "): " + getStateAsString(instance.getState()));
                                //Set up a component filter
                                ComponentInstanceFilter cInstanceFilter = new ComponentInstanceFilter();
                                //Get child component instances
                                List
childComponentInstances = instance.getChildComponentInstances(cInstanceFilter);
                                //For each child component instance
                                 for (ComponentInstance cInstance : childComponentInstances) {
                                        System.out.println(" -> componentinstance: " + cInstance.getComponentName() + " type: " + cInstance.getServiceEngine().getEngineType() + " state: " +getStateAsString(cInstance.getState()));
                                        System.out.println("State: "+cInstance.getNormalizedStateAsString());
                                        }
                                instance.abort();
                                }
                                obInstances=null;
                }
        }
        catch (Exception e) {
        System.out.println("Exception in API " + e);
        }
        }
        private String getStateAsString(int state){
                //Note that this is dependent on whether the composite state is captured or not
                if (state == CompositeInstance.STATE_COMPLETED_SUCCESSFULLY)
                        return ("success");
                else if (state == CompositeInstance.STATE_FAULTED)
                        return ("faulted");
                else if (state == CompositeInstance.STATE_RECOVERY_REQUIRED)
                        return ("recovery required");
                else if (state == CompositeInstance.STATE_RUNNING)
                        return ("running");
                else if (state == CompositeInstance.STATE_STALE)
                        return ("stale");
                else
                        return ("unknown");
        }

        public static void main(String[] args) {
        abortComposite  abortcomposite=new abortComposite();
        abortcomposite.abortRunningComposite();
        }
}
 


Steps:-
Set Classpath
export CLASSPATH=$CLASSPATH:$ORACLE_FMW_HOME/oracle_common/soa/modules/oracle.soa.mgmt_11.1.1/soa-infra-mgmt.jar:$ORACLE_FMW_HOME/oracle_common/modules/oracle.fabriccommon_11.1.1/fabric-common.jar:$ORACLE_FMW_HOME/wlserver_10.3/server/lib/weblogic.jar:$ORACLE_FMW_HOME/oracle_common/modules/oracle.jrf_11.1.1/jrf-api.jar

Compile the code
javac abortComposite.java

Execute the Code
java abortComposite

[JDeveloper] javax.net.ssl.SSLKeyException: [Security:090542] Certificate chain received from soa-dev.corp.xxx.com - 10.XXX.XXX.XXX was not trusted causing handshake failure

$
0
0
 ISSUE:-


CAUSE:-

This issue is because the client (JDev) is not trusting the certificate chain received from the server. So the solution here is to add the certificate of the server into trust store of Jdeveloper.

SOLUTION:-

1.       Open JDeveloper
2.       Goto Tools -> Preferences -> Credentials




1
3. Go to the location mentioned in “Client Trusted Certificate Keystore”
4. Backup DemoTrust.jks
5. Import the public key/certificate of the server you are trying to connect into  DemoTrust.jks.
6. Restart Jdev
7. Try now

[Jdeveloper] java.net.ConnectException: Connection refused: connect; No available router to destination

$
0
0
Error:-


java.lang.RuntimeException: javax.naming.CommunicationException [Root exception is java.net.ConnectException: t3s://hostname.mycompany.com:8001: Destination unreachable; nested exception is:
    java.net.ConnectException: Connection refused: connect; No available router to destination]
    at oracle.tip.tools.ide.fabric.asbrowser.WeblogicSOAServer.initPartitions(WeblogicSOAServer.java:89)
    at oracle.tip.tools.ide.fabric.asbrowser.WeblogicSOAServer.(WeblogicSOAServer.java:68)
    at oracle.tip.tools.ide.fabric.asbrowser.ASBrowserHelper.listWeblogicSOAServers(ASBrowserHelper.java:275)
    at oracle.tip.tools.ide.fabric.asbrowser.ASBrowserHelper.listSOAServers(ASBrowserHelper.java:201)
    at oracle.tip.tools.ide.fabric.asbrowser.ASBrowserHelper$RunnableListSOAServers.run(ASBrowserHelper.java:333)
    at oracle.ide.dialogs.ProgressBar.run(ProgressBar.java:655)
    at java.lang.Thread.run(Thread.java:662)
Caused by: javax.naming.CommunicationException [Root exception is java.net.ConnectException: t3s://hostname.mycompany.com:8001: Destination unreachable; nested exception is:
    java.net.ConnectException: Connection refused: connect; No available router to destination]
    at weblogic.jndi.internal.ExceptionTranslator.toNamingException(ExceptionTranslator.java:40)
    at weblogic.jndi.WLInitialContextFactoryDelegate.toNamingException(WLInitialContextFactoryDelegate.java:788)
    at weblogic.jndi.WLInitialContextFactoryDelegate.getInitialContext(WLInitialContextFactoryDelegate.java:368)
    at weblogic.jndi.Environment.getContext(Environment.java:315)
    at weblogic.jndi.Environment.getContext(Environment.java:285)
    at weblogic.jndi.WLInitialContextFactory.getInitialContext(WLInitialContextFactory.java:117)
    at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:667)
    at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:288)
    at javax.naming.InitialContext.init(InitialContext.java:223)
    at javax.naming.InitialContext.(InitialContext.java:197)
    at oracle.soa.management.internal.facade.ServerManagerImpl.(ServerManagerImpl.java:76)
    at oracle.soa.management.internal.facade.ServerManagerFactoryImpl.createServerManager(ServerManagerFactoryImpl.java:28)
    at oracle.tip.tools.ide.fabric.asbrowser.WeblogicSOAServer.initPartitions(WeblogicSOAServer.java:85)
    ... 6 more
Caused by: java.net.ConnectException: t3s://hostname.mycompany.com:8001: Destination unreachable; nested exception is:
    java.net.ConnectException: Connection refused: connect; No available router to destination
    at weblogic.rjvm.RJVMFinder.findOrCreateInternal(RJVMFinder.java:216)
    at weblogic.rjvm.RJVMFinder.findOrCreate(RJVMFinder.java:170)
    at weblogic.rjvm.ServerURL.findOrCreateRJVM(ServerURL.java:153)
    at weblogic.jndi.WLInitialContextFactoryDelegate.getInitialContext(WLInitialContextFactoryDelegate.java:353)
    ... 16 more
Caused by: java.rmi.ConnectException: Destination unreachable; nested exception is:
    java.net.ConnectException: Connection refused: connect; No available router to destination
    at weblogic.rjvm.ConnectionManager.bootstrap(ConnectionManager.java:470)
    at weblogic.rjvm.ConnectionManager.bootstrap(ConnectionManager.java:321)
    at weblogic.rjvm.RJVMManager.findOrCreateRemoteInternal(RJVMManager.java:254)
    at weblogic.rjvm.RJVMManager.findOrCreate(RJVMManager.java:197)
    at weblogic.rjvm.RJVMFinder.findOrCreateRemoteServer(RJVMFinder.java:238)
    at weblogic.rjvm.RJVMFinder.findOrCreateInternal(RJVMFinder.java:200)


Cause:-

The issue was caused by incorrect password of the identity keystore. Below message was seen in the log.

<Nov 8, 2013 4:16:53 AM PST> <Error> <Security> <BEA-090133> <Could not load a JKS keystore from the file /u02/shared/certs/keystore/DemoIdentity.jks. Exception: java.io.IOException: Keystore was tampered with, or password was incorrect>
<Nov 8, 2013 4:16:53 AM PST> <Emergency> <Security> <BEA-090034> <Not listening for SSL, java.io.IOException: Failed to load identity keystore of type JKS from file /u02/shared/certs/keystore/DemoIdentity.jks on server SOA_MngdSvr1.>

Fix:-

1. Update correct password for identity and trust keystores under "keystores" and "SSL" tab for Admin and Managed Servers.
2. Do "Restart SSL" for all the admin and managed servers for which password has been updated. Verify in the log that keystores are loaded without any error now.
3. Try deployment from JDev now.

oracle.xml.parser.schema.XSDException: Can not build schema

$
0
0
HTML Generator Sample PageERROR:- SampleBPELProcess.bpel:2211: error: query "/ns7:create" is invalid, because oracle.xml.parser.schema.XSDException: Can not build schema 'urn:sobject.enterprise.soap.sforce.com' located at 'urn:sobject.enterprise.soap.sforce.com.__OAUX_GENXSD_.TOP.XSD' [Cause=Can not build schema 'urn:sobject.enterprise.soap.sforce.com' located at 'urn:sobject.enterprise.soap.sforce.com.__OAUX_GENXSD_.TOP.XSD']

CAUSE:- We faced this error during deployment of SampleBPELProcess through JDeveloper. When looked into the log file we found got below log snippet

"Global Type declaration/definition of name '{urn:sobject.enterprise.soap.sforce.com}CSE_Assignment__c' are duplicated at the following locations:

oramds:/deployed-composites/default/SampleBPELProcess_rev2.0.0/SFDCDevEnterpriseWsdl.wsdl [line#: 3739]
oramds:/apps/wsdls/sfdc/SFDCDevEnterpriseWsdl.wsdl [line#: 3738]
There are at least two of them looking different:
oramds:/deployed-composites/default/SampleBPELProcess_rev2.0.0/SFDCDevEnterpriseWsdl.wsdl [difference starting at line#:3774]
oramds:/apps/wsdls/sfdc/SFDCDevEnterpriseWsdl.wsdl [difference starting at line#:3773]"

When verified the WSDL at both the location, they were NOT identical. Thus resulting in the issue.

SOLUTION:- Make sure both the WSDLs are identical in MDS. Now try deployment.

FabricInvocationException weblogic.jms.common.InvalidDestinationException

$
0
0
HTML Generator Sample Page

ERROR:-<Error> <oracle.soa.bpel.engine.ws> <BEA-000000> <got FabricInvocationException weblogic.jms.common.InvalidDestinationException: [JMSClientExceptions:055144]Destination must be a topic, JMSModule!mycompany.dev.queue.Process.ErrorMessage.Routing

CAUSE:- The issue occurred due to incorrect setting of JMS Adapter Outbound Connection Pool. "mycompany.dev.queue.Process.ErrorMessage.Routing" is a queue created in JMSModule. However the outbound connection pool created at JMS Adapter to interact with this queue has IsTopic set as TRUE. This means it is searching for a TOPIC by the name "mycompany.dev.queue.Process.ErrorMessage.Routing" and not a queue.

SOLUTION:- If you are creating JMS Adapter Outbound Connection Pool for QUEUE, set isTopic= FALSE. If you are creating JMS Adapter Outbound Connection Pool for TOPIC, set isTopic= TRUE.

Undeploying SOA Composite is taking longer time

$
0
0

Issue :- When undeploying a soa composite through Jdeveloper/WLST/EM console, it is taking longer time than usual.

Cause:- Based on the diagnostic log file, undeployment is stuck when it is trying to remove data from MDS during undeployment. 

If you tail the diagnostic log file while un-deployment is in progress, you will see that it get stuck at line containing the string "Removing command lock for". The next step during undeployment after command lock has been removed is removing data from MDS. When checked at Database side, a DELETE SQL query on MDS_COMPONENTS can be seen executing for long time.

Fix:- Execute force gather statistics on MDS Schema.

exec dbms_stats.gather_schema_stats (ownname=>'SOADomain_MDS',estimate_percent => DBMS_STATS.AUTO_SAMPLE_SIZE,block_sample=>FALSE,method_opt=>'FOR ALL COLUMNS SIZE AUTO',granularity=>'ALL',cascade=>true,no_invalidate=>false,options=>'gather') ;


Puppet Installation on Linux Master and Node

$
0
0
Master Machine OS - Red Hat Enterprise Linux Server release 6.3 (Santiago)
Client Machine OS - Red Hat Enterprise Linux Server release 6.3 (Santiago)

Reference URL - https://puppetlabs.com

Update weblogic keystores and SSL tab keystore location and password using WLST

$
0
0
We can use WLST to update identity and trust keystore location and password for admin and manager server under Configuration --> Keystores tab. It will also update Private Key Alias and Private Key Passphrase under Configuration --> SSL tab.

So I will create a function keystoreSSLSetup which will have below input arguments

Input ParameterDescription
serverNameName of Admin or Managed Server where update is required
CustIdentityKeyStoreName Identity Keystore containing the private and public key of the server 
CustIdentityKeyStorePassPhrasePassword of Identity Keystore
CustTrustKeyStoreFileNameTrust keystore containing CA certificates
CustServerPrivateKeyAliasAlias/name of the private key stored in identity keystore
CustServerPrivateKeyPassPhrasePassword for private key. (Generally it is kept same as password of identity keystore)
domainHomeAbsolute path of domain

We will also encrypt the password for security reasons.

Now the function will look like below:

def keystoreSSLSetup(serverName,CustIdentityKeyStoreName,CustIdentityKeyStorePassPhrase,CustTrustKeyStoreFileName,CustServerPrivateKeyAlias,CustServerPrivateKeyPassPhrase,domainHome):  
    try:
        print "Setup KeyStore and SSL"
        cd ("/Servers/" + serverName)
        CustIdentityKeyStorePassPhraseEncrypted = encrypt (CustIdentityKeyStorePassPhrase, domainHome)
        set ("KeyStores", "CustomIdentityAndCustomTrust")
        set ("CustomIdentityKeyStoreFileName", CustIdentityKeyStoreName)
        set ("CustomIdentityKeyStorePassPhrase", CustIdentityKeyStorePassPhrase)
        set ("CustomIdentityKeyStorePassPhraseEncrypted", CustIdentityKeyStorePassPhraseEncrypted)
        set ("CustomIdentityKeyStoreType", "JKS")
        set ("CustomTrustKeyStoreFileName", CustTrustKeyStoreFileName)
        set ("CustomTrustKeyStorePassPhrase", CustIdentityKeyStorePassPhrase)
        set ("CustomTrustKeyStorePassPhraseEncrypted", CustIdentityKeyStorePassPhraseEncrypted)
        set ("CustomIdentityKeyStoreType", "JKS")
        print "Keystore Setup Successful"
        cd ("SSL/"+ serverName)
        set ("ServerPrivateKeyAlias", CustServerPrivateKeyAlias)
        set ("ServerPrivateKeyPassPhrase", CustServerPrivateKeyPassPhrase)
        CustServerPrivateKeyPassPhraseEncrypted = encrypt (CustOutboundPrivateKeyPassPhrase, domainHome)
        set ("ServerPrivateKeyPassPhraseEncrypted", CustServerPrivateKeyPassPhraseEncrypted)
        print "SSL Setup Successful" 
    except Exception, e:
        print e
        print "Error while trying to Setup KeyStore and SSL!!!"
        dumpStack()
        raise
        cancelEdit('y')
        activateTheChanges()
        disconnectFromServer()      
        exit() 

To get TARGETS for application deployed on Weblogic using WLST

$
0
0
This function will return the list of Targets on which application has been deployed. 
It will take application name as the input parameter (i.e. APPNAME). 
It is using regular expression to extract server name or cluster name from the string. 
The FOR loop will run for each cluster/server. 
You need to import below classes for this function to work:

import re
import java.util.ArrayList as ArrayList

So the function will look like below:

def Target(APPNAME):
    try:
        print('#######################################################')
        print('Below are the Targets for '), APPNAME
        print('#######################################################')
        cd('AppDeployments/'+APPNAME)
        arr = ArrayList()
        arr=get('Targets')
        for myStr in arr:
            m = re.search('=(\w+),', str(myStr))
            print m.group(1)
        print('#######################################################')
    except Exception, e:
        print('Exception is ')
        print e
        dumpStack()
        raise

Sample Output:

#######################################################
Below are the Targets for  ServerState
#######################################################
SOA_MngdSvr1
SOA_MngdSvr2
#######################################################
.
.
.
.
#######################################################
Below are the Targets for  ServerState
#######################################################
B2B_Cluster
BAM_Cluster
SOA_Cluster
#######################################################

The WebLogic Server encountered a critical failure

$
0
0
ERROR:-

INFO: Notification event sent for activating changes.
***************************************************************************
The WebLogic Server encountered a critical failure
Reason: PermGen space
***************************************************************************

So I received this error while trying to start Admin Server. Even though how much I increase MaxPermSize, this error kept on coming.

CAUSE:-

Well the error came because by mistake I setup USER_MEM_ARGS in setDomainEnv.sh.(Well stop laughing at me :( . Remember "To err is human" ) This variable  override the standard memory arguments (MEM_ARGS) passed to java.

USER_MEM_ARGS="-Djava.security.egd=file:///dev/./urandom"
export USER_MEM_ARGS

Since I did not pass any other required JVM parameter. All the default values were used by JVM (Admin Server) while coming up which was insufficient.

I kept on hitting the error even though I increased MaxPermSize to 4GB :( Coz this paramter was part of MEM_ARGS which was overridden by USER_MEM_ARGS.

SOLUTION:-

Remove the USER_MEM_ARGS or set is as NULL (whatever you prefer :P )

USER_MEM_ARGS=""
export USER_MEM_ARGS

( Also I am not sure why but some how even after removing the USER_MEM_ARGS, it was still overriding MEM_ARGS. May be the value got saved in some GHOST cache. Open new putty session and then try starting the Admin Server )

Export current messages from weblogic JMS Queue using WLST

$
0
0
Many a times it is required to export oracle weblogic JMS Messages from weblogic JMS queue to an XML file. One way of achieving this is using Weblogic Console. However doing it using WLST is a little tricky. I am providing a WLST snippet that can export jms messages for into a files. For distributed queue, one file will be created for each server on which it is targeted. So if a distributed queue is targeted on a cluster of two servers and contains messages, then two separate jms files will be created. After exporting all the messages from the queue, this script will delete the messages.

def exportMessages(serverName,server,jms_module,destination,messageSelector):
    try:
        serverRuntime()
        cd('JMSRuntime/' + serverName + '.jms/JMSServers/' + server + '/Destinations/'
+ jms_module + '!' + server + '@' +  destination)
        if cmo.getMessagesCurrentCount() > 0 :
            print ("No. of current messages are: ")
            print cmo.getMessagesCurrentCount()
            msgCursor=cmo.getMessages(messageSelector,1000,1)
            amountOfMessages=cmo.getCursorSize(msgCursor)
            allDestinationMessages=cmo.getNext(msgCursor,amountOfMessages)
            print allDestinationMessages
            outf = open (server+'-jmsmessages.xml','w')
            outf.write('<?xml version="1.0" encoding="UTF-8"?>' + '\n'
+ '<JMSMessageExport>' + '\n')
            for jmsmessage in allDestinationMessages:
                jmsmsginfo = JMSMessageInfo(jmsmessage)
                wlmsg = jmsmsginfo.getMessage()
                wlmsgid = wlmsg.getJMSMessageID()
                completeMsg = cmo.getMessage(msgCursor,wlmsgid)
                outf.write(completeMsg.get("MessageXMLText") + '\n')
            outf.write('</JMSMessageExport>')
            outf.close()
            cmo.closeCursor(msgCursor)
   cmo.deleteMessages(messageSelector)
        else:
            print ("No current message")
    except Exception, e:
        print('Exception is ')
        print e
        dumpStack()
        raise

serverName- Managed Server Name

server- JMS Server Name ( Domain_Name --> Messaging --> JMS Servers )

jms_module- JMS Module name ( Domain_Name --> Messaging --> JMS Modules )

destination- Queue Name

messageSelector- Selecting messages based on jms message properties such as JMS Priority etc. 

To modify the script to export pending messages, replace

msgCursor=cmo.getMessages(messageSelector,1000,1)

with

msgCursor=cmo.getMessages(messageSelector,1000,4)

The syntax for getMessages function is:
String getMessages(String selector, Integer timeout, Integer state)
where state is various message states such as 1 for current weblogic jms messages and 4 for pending weblogic jms messages
Viewing all 34 articles
Browse latest View live