Monday, December 14, 2015

Deploy multiple applications on WebLogic server using Weblogic.Deployer command

Weblogic.Deployer is a utility by WebLogic to deploy applications to WebLogic Server apart from usual way of deploying applications using WebLogic Admin Console.

These deployments can happen on Single-Server Domain or Multiple-Servers Domain(Cluster).

We will go through both of them also look into Sub Module targeting.

Note: 

Here we will use a file name containing names of multiple applications for the deployment and will deploy each one of them on the server/servers.

1. Deployment on Single-Server Domain


A single-server WebLogic Server domain, consisting only of an Administration Server, use the -deploy command and identify the file location, with connection parameters (adminurl,username ,password) for the Administration Server. Use -name command to provide deployment name.


SingleServerDeployment.sh

WL_HOME="opt/app/bea/wlserver_10.3"
# set up class path
. "${WL_HOME}/server/bin/setWLSEnv.sh"

echo "Please enter the admin console url in following format - t3://172.64.34.24:7001"
read adminConsole_url    
echo "Please enter the username for admin console."
read adminConsole_user
echo "Please enter the password for admin console."
read adminConsole_pwd
echo "Please enter the location/directory path where EAR files are placed e.g. /opt/app/local/applications/CustomDeployment/"
read app_directory
echo "Please enter the filename containing list of the applications to be deployed"
read listOfApps

echo "Deploying applications without using the list: " $listOfApps
cat $listOfApps|\
while read currentApp
do
     
 java -cp ${WL_HOME}/server/lib/weblogic.jar weblogic.Deployer 
-adminurl $adminConsole_url 
-username $adminConsole_user 
-password $adminConsole_pwd 
-name $currentApp  
-nostage 
-deploy ${app_directory}/${currentApp}.ear
     
echo ${currentApp}'.ear is deployed.'
done
echo "Completed deploying applications using the list "

2. Deployment on Cluster


Mostly the production environments are clustered with multiple servers so user needs to deploy applications either one or more servers. Use -targets command to any server or collection of servers
to which you can deploy an application.
By using -nostage each target server must access the archive files from a single source directory for deployment. Here the location '/opt/app/local/applications/CustomDeployment/' is shared across all the cluster servers.


ClusterServerDeployment.sh

WL_HOME="opt/app/bea/wlserver_10.3"
# set up class path
. "${WL_HOME}/server/bin/setWLSEnv.sh"

echo "Please enter the domain cluster e.g. myCluster"
read domain_cluster
echo "Please enter the admin console url in following format - t3://172.64.34.24:7001"
read adminConsole_url    
echo "Please enter the username for admin console."
read adminConsole_user
echo "Please enter the password for admin console."
read adminConsole_pwd
echo "Please enter the location/directory path where EAR files are placed e.g. /opt/app/local/applications/CustomDeployment/"
read app_directory
echo "Please enter the filename containing list of the applications to be deployed"
read listOfApps

echo "Deploying applications without using the list: " $listOfApps
cat $listOfApps|\
while read currentApp
do
     
 java -cp ${WL_HOME}/server/lib/weblogic.jar weblogic.Deployer 
-adminurl $adminConsole_url 
-username $adminConsole_user 
-password $adminConsole_pwd 
-name $currentApp 
-targets ${domain_cluster} 
-nostage 
-deploy ${app_directory}/${currentApp}.ear
     
echo ${currentApp}'.ear is deployed to the cluster.'
done
echo "Completed deploying applications using the list "


3. Deployment with Sub-Module Targeting with JMS Application Modules


Certain JMS resources defined within a JMS application module can be further targeted to a JMS Server available on the module’s target during deployment. These resources are known as submodules.

Certain types of submodule require deployment to a JMS Server, such as:
  1.  Queues
  2.  Topics
For an application-scoped JMS module in an EAR use -submoduletargets command with syntax submodule_name@module_name@target_name to target a submodule option to weblogic.Deployer.


ClusterServerSubModuleDeployment.sh

WL_HOME="opt/app/bea/wlserver_10.3"
# set up class path
. "${WL_HOME}/server/bin/setWLSEnv.sh"

echo "Please enter the domain cluster e.g. myCluster"
read domain_cluster
echo "Please enter the admin console url in following format - t3://172.64.34.24:7001"
read adminConsole_url    
echo "Please enter the username for admin console."
read adminConsole_user
echo "Please enter the password for admin console."
read adminConsole_pwd
echo "Please enter the location/directory path where EAR files are placed e.g. /opt/app/local/applications/CustomDeployment/"
read app_directory
echo "Please enter the filename containing list of the applications to be deployed"
read listOfApps

echo "Deploying applications without using the list: " $listOfApps
cat $listOfApps|\
while read currentApp
do
     
 java -cp ${WL_HOME}/server/lib/weblogic.jar weblogic.Deployer 
-adminurl $adminConsole_url 
-username $adminConsole_user 
-password $adminConsole_pwd 
-name $currentApp 
-targets ${domain_cluster} 
-submoduletargets myQueue@myJMSModule@myJMSServer 
-nostage 
-deploy ${app_directory}/${currentApp}.ear
     
echo ${currentApp}'.ear is deployed to the cluster.'
done
echo "Completed deploying applications using the list "

Hope the article helps you in understanding how to deploy applications using Weblogic.Deployer utility, please leave your feedback or query

Sunday, November 29, 2015

Capture thread dumps on WebLogic server or on Metasolv application servers

At many instances one might notice that the WebLogic/Metasolv servers (Weblogic Admin or Managed servers) are displayed in WARNING state in the admin console, one of the possible reason for the WARNING is stuck threads or JMS bridges not coming up properly or similar such issues.

In such situations it becomes very important to debug(using thread dumps) to find out which application(API)/code is causing these warnings/issues.

Lets look at the ways of capturing the thread dumps.

1. WebLogic console


This is one of very easy way to capture thread dumps but it is not the preferred method due to the limited details of its output.

To capture thread dump please follow below steps.

Login to WebLogic Admin Console —> Servers —> Monitoring —> Threads

Then click Dump Thread Stack.


2.  Command Line or shell


WebLogic 8.1 does not provide a way to invoke a THREAD DUMP using the "Dump Thread Stacks" feature from the WebLogic Administration Console as provided in 10.3.

For Weblogic 8.1 thread dumps can be captured from below command from a command line or shell.

WebLogic command (java weblogic.Admin -url t3://serverhost:serverport -username <USER> -password <PASSWORD> THREAD_DUMP)

NOTE: The weblogic.jar must be in the CLASSPATH to avoid a "java.lang.NoClassDefFoundError: weblogic/Admin" exception (see below).



3. Kill -3 <PID> command


Use the "ps -ef | grep"  or "/usr/ucb/ps auxwwwww|grep"(shows memory parameters too) command
to identify the WebLogic Server's java process ID or <PID>.

Grep argument could be your server name but the <PID> will be the java process ID.

See below for exact steps.


THREAD DUMP data is logged to the ${MSLV_HOME}/${SERVER_NAME}/appserver/logs/${SERVER_NAME}.mss.log file.

4.  Using a WLST script

Below script describes how to take thread dump using WLST.
  1. Establish a connection to the Admin Server.
  2. Provide Server Name where you want to take thread dump i.e. managed server test_srvr_1.1 and provide 5 number(any quantity) of thread dumps and take each dump after 10 secs interval.
  3. Save the file as "ThreadDump.py" at /opt/xyz/abc/Test_domain(choose your location).
  4. Now to execute the above file and go to weblogic server bin directory(as per your directory structure), run cd /opt/xyz/abc/bea/wli10gR3MP1/wlserver_10.3/server/bin.
  5. Run ". ./setWLSEnv.sh" ---to set up class path.
  6. Run "java weblogic.WLST /opt/xyz/abc/Test_domain/ThreadDump.py"
  7. As the result of the script, you will get some dmp files that contain the thread dumps in the same directory where ThreadDump.py is placed.


File: ThreadDump.py

# Purpose: To generate thread dump at specific interval
# Author: Alok Mishra
# Contact: alokmishra188@gmail.com

connect('weblogic','weblogic1','localhost:7001')

from time import strftime
from java.text import SimpleDateFormat
serverName = 'test_srvr_1.1'
counter = 0
sleepTime = 10000
threadNumber = 5

for counter in range(threadNumber):
        currentDate = java.util.Date().toString()
        myDate = currentDate.split(' ');
        finalDate = myDate[3]
        java.lang.Thread.sleep(sleepTime)
        fileName = 'Thread dump' + '_' + serverName + '_' + finalDate + '.dmp'
        threadDump('true', fileName, serverName)

disconnect()


Hope the article helps you in understanding how to take thread dumps, please leave your feedback or query.

Monday, November 2, 2015

Applications showing warning due to MessageBufferBean and MessageBufferTopicBean while migrating projects from WebLogic 8.1 to 10.3

PROBLEM

While deploying WebLogic applications to cluster, the following warning messages are displayed in server logs.

<Jun 9, 2015 3:37:43 PM EDT> <Error> <Deployer> <BEA-149202> <Encountered an exception while attempting to commit the 1 task for the application 'cluster-nur'.>
<Jun 9, 2015 3:43:42 PM EDT> <Warning> <EJB> <BEA-010061> <The Message-Driven EJB: MessageBufferTopicBean is unable to connect to the JMS destination: weblogic.test1.WlwRuntimeAppScopedJMS#MSG_B
UFFER_TOPIC. The Error was:
Can not get distribute destination information. The destination JNDI name is weblogic.test1.WlwRuntimeAppScopedJMS#MSG_BUFFER_TOPIC, the provider URL is null>
<Jun 9, 2015 3:43:42 PM EDT> <Warning> <EJB> <BEA-010061> <The Message-Driven EJB: MessageBufferBean is unable to connect to the JMS destination: weblogic.test1.WlwRuntimeAppScopedJMS#MSG_BUFFER
_QUEUE. The Error was:
Can not get distribute destination information. The destination JNDI name is weblogic.test1.WlwRuntimeAppScopedJMS#MSG_BUFFER_QUEUE, the provider URL is null>

Also the applications display Warning in console, to confirm the reason for warning go to click on application and go to monitoring tab as below.




CAUSE 

weblogic-application.xml  in the WebLogic applications has a reference to the library weblogic-controls-10.0. Because of which we get a additional MDBs from a jar file in this library (weblogic-
messagebuffer-mdb) that listen on a specific application-scoped queue and topic and as our application does not define these queues, the WebLogic will report a warning that these MDBs could not connect to their destination.

Below is weblogic-application.xml(inside TestEar.ear\META-INF\) of a sample test application which is using weblogic-controls-10.0. See highlighted.

<?xml version="1.0" encoding="UTF-8"?>
<wls:weblogic-application xmlns:wls="http://www.bea.com/ns/weblogic/weblogic-application" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/javaee_5.xsd http://www.bea.com/ns/weblogic/weblogic-application http://www.bea.com/ns/weblogic/weblogic-application/1.0/weblogic-application.xsd">
    <!-- server-version: 10.3 -->
    <wls:ejb>
        <wls:start-mdbs-with-application>false</wls:start-mdbs-with-application>
    </wls:ejb>
    <wls:application-param>
        <wls:param-name>webapp.encoding.default</wls:param-name>
        <wls:param-value>UTF-8</wls:param-value>
    </wls:application-param>
    <wls:classloader-structure>
        <wls:classloader-structure>
            <wls:module-ref>
                <wls:module-uri>TestWeb.war</wls:module-uri>
            </wls:module-ref>
            <wls:classloader-structure>
                <wls:module-ref>
                    <wls:module-uri>TestWeb_WLI_ProjectBeans</wls:module-uri>
                </wls:module-ref>
            </wls:classloader-structure>
            <wls:classloader-structure>
                <wls:module-ref>
                    <wls:module-uri>TestWeb_WLI_ComponentBeans</wls:module-uri>
                </wls:module-ref>
            </wls:classloader-structure>
        </wls:classloader-structure>
    </wls:classloader-structure>
    <wls:listener>
        <wls:listener-class>com.bea.wli.management.WLIAppListener</wls:listener-class>
    </wls:listener>
    <wls:library-ref>
        <wls:library-name>beehive-controls-1.0.1-10.0</wls:library-name>
        <wls:specification-version>1.0</wls:specification-version>
        <wls:exact-match>true</wls:exact-match>
    </wls:library-ref>
    <wls:library-ref>
        <wls:library-name>sb-transport-control-10.0</wls:library-name>
        <wls:specification-version>10.0</wls:specification-version>
        <wls:exact-match>true</wls:exact-match>
    </wls:library-ref>
    <wls:library-ref>
        <wls:library-name>weblogic-controls-10.0</wls:library-name>
        <wls:specification-version>10.0</wls:specification-version>
        <wls:exact-match>true</wls:exact-match>
    </wls:library-ref>
    <wls:library-ref>
        <wls:library-name>wls-commonslogging-bridge</wls:library-name>
        <wls:specification-version>1.0</wls:specification-version>
        <wls:exact-match>true</wls:exact-match>
    </wls:library-ref>
</wls:weblogic-application>


These JMS destinations are created by the application when the MessageBuffer annotation is used and our applications are not using com.bea.control.annotations.MessageBuffer annotation which is why above error is thrown.  These created JMS elements are used in the following library:

-{BEA_HOME}\workshop_10.3\common\deployable-libraries\weblogic-controls-10.2.ear
-in APP-INF/lib/weblogic-controls.jar
-in weblogic-messagebuffer-mdb.jar, in META-INF, weblogic-ejb-jar.xml


where the following are noted:
WlwRuntimeAppScopedJMS#MSG_BUFFER_QUEUE
WlwRuntimeAppScopedJMS#MSG_BUFFER_TOPIC

Below is  weblogic-ejb-jar.xml of weblogic-controls-10.2.ear.See highlighted.

<?xml version="1.0" encoding="UTF-8"?>

<weblogic-ejb-jar xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://www.bea.com/ns/weblogic/90
    http://www.bea.com/ns/weblogic/90/weblogic-ejb-jar.xsd"
    xmlns="http://www.bea.com/ns/weblogic/90"
    xmlns:j2ee="http://java.sun.com/xml/ns/j2ee">

  <weblogic-enterprise-bean>
    <ejb-name>MessageBufferBean</ejb-name>

    <message-driven-descriptor>
      <pool>
        <initial-beans-in-free-pool>1</initial-beans-in-free-pool>
      </pool>
    </message-driven-descriptor>

    <transaction-descriptor>
        <trans-timeout-seconds>300</trans-timeout-seconds>
    </transaction-descriptor>

    <dispatch-policy>controls_buffering_mdb_execute_queue</dispatch-policy>
  </weblogic-enterprise-bean>  

  <weblogic-enterprise-bean>
    <ejb-name>MessageBufferTopicBean</ejb-name>

    <message-driven-descriptor>
      <pool>
        <initial-beans-in-free-pool>1</initial-beans-in-free-pool>
      </pool>
      <generate-unique-jms-client-id>true</generate-unique-jms-client-id>
      <durable-subscription-deletion>true</durable-subscription-deletion>
    </message-driven-descriptor>

    <transaction-descriptor>
        <trans-timeout-seconds>300</trans-timeout-seconds>
    </transaction-descriptor>

    <dispatch-policy>controls_buffering_mdb_execute_topic</dispatch-policy>
  </weblogic-enterprise-bean>  
  
  <message-destination-descriptor>
    <message-destination-name>MessageBufferInvokeQueue</message-destination-name>
    <destination-resource-link>WlwRuntimeAppScopedJMS#MSG_BUFFER_QUEUE</destination-resource-link>
  </message-destination-descriptor>
  <message-destination-descriptor>
    <message-destination-name>MessageBufferInvokeTopic</message-destination-name>
    <destination-resource-link>WlwRuntimeAppScopedJMS#MSG_BUFFER_TOPIC</destination-resource-link>
  </message-destination-descriptor>
</weblogic-ejb-jar>


Above is a known Oracle bug.


SOLUTION


Controls Message Buffering in a cluster requires submodule targeting.

If your application enables message buffering on controls use the annotation
'com.bea.control.annotations.MessageBuffer', you may have the following error when you try to deploy it on a cluster:"While attempting to create destination MSG_BUFFER_QUEUE in module
<name_of_your_ear>!WlwRuntimeAppScopedJMS the JMSServer of name <name_of_your_cluster> could not be found".


Workaround: 

In this case, you must target the MSG_BUFFER_QUEUE to a specific JMS Server with the following submoduletargets option to your weblogic.Deployer command:

-submoduletargets cgJMSServer@WlwRuntimeAppScopedJMS@WseeJmsServer_auto_1

Hope above helps in understanding the WebLogic behavior behind these warnings, please leave your feedback or query.

Sunday, October 25, 2015

Send messages to IBM WebSphere MQ from Unix server using Shell script and JAVA

A standalone shell script to send messages to MQ on an IBM WebSphere MQ server using JAVA program.

The application mostly helps in testing connectivity from Metasolv M6 server to IBM WebSphere connectivity in MQ event generators in WLI.

In order to build this utility please follow below steps.

STEP 1. 


Create a alok_tmp(choose any name) in any directory on your unix box and create src and bin folder and below files.

Folders created inside directory i.e. /opt/app/script are as below

1. alok_tmp
2. alok_tmp/src
3. alok_tmp/bin

Files created inside directory src and bin

1. alok_tmp/sendMQ.sh
2. alok_tmp/src/MQSendUtility.java
3. alok_tmp/bin/requestMessage.xml
4. alok_tmp/bin/mq.properties

Below should be directory structure.


Class file will automatically be created after each time sh file is run.

STEP 2. 


Copy below to Java file to send the messages to MQ on IBM WebSphere server. Code below is self explanatory.

File: MQSendUtility.java

/** 
* This class provides access to the MQSeries queue facilities.  Once 
*
* instantiated, the main application program need only call the 'send'
*
* method to put message on request queue. The send method returns an MQMessage. 
*
* reply queue is still kept in class as earlier it was also used to receive the reply.
*
* but now it is now utilised to send a MQ message only. 
*
* @author Alok Mishra
*
* @version 1.0
*/

import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Properties;
import com.ibm.mq.MQC;
import com.ibm.mq.MQEnvironment;
import com.ibm.mq.MQException;
import com.ibm.mq.MQMessage;
import com.ibm.mq.MQPutMessageOptions;
import com.ibm.mq.MQQueue;
import com.ibm.mq.MQQueueManager; // Include the MQ package

public class MQSendUtility {
private static Properties props = new Properties();
private MQQueueManager qMgr;
private MQQueue requestQueue;
private MQQueue replyQueue;
public String replyQueueName;
private int openOptions;
private MQMessage storedMessage;

@SuppressWarnings("unchecked")
public MQSendUtility(String hostname, String channel, String qManager,
String aRequestQueue, String aReplyQueue) throws MQException {

try {
MQEnvironment.hostname = hostname;
MQEnvironment.channel = channel;
MQEnvironment.port = Integer.valueOf(props
.getProperty("mq.listen.port"));
MQEnvironment.userID = props
.getProperty("mq.server.security.principal");
MQEnvironment.password = props
.getProperty("mq.server.security.credentials");
MQEnvironment.properties.put(MQC.TRANSPORT_PROPERTY,
MQC.TRANSPORT_MQSERIES);
try {
qMgr = new MQQueueManager(qManager);
} catch (MQException e) {
print("An MQException occurred trying to connect to the QManager.");
Object o = e.exceptionSource;
print("MQException originated from object '" + o.toString());
print("Completion code = " + e.completionCode);
System.exit(1);
}
print("Connected to QManager " + qManager);

replyQueueName = aReplyQueue;

if (aRequestQueue.equals(aReplyQueue)) {
print("Open Options from IF");
openOptions = MQC.MQOO_INPUT_AS_Q_DEF | MQC.MQOO_OUTPUT;
} else {
print("Open Options from ELSE");
openOptions = MQC.MQOO_OUTPUT;
}
print("Open Options"+openOptions);
requestQueue = qMgr.accessQueue(aRequestQueue, openOptions, 
null, // default queue manager
null, // no dynamic q name
null); // no alternate user id

print("Got access to request queue "+requestQueue);

} catch (MQException ex) {
print("MQCommunicator.constructor - MQException occurred : Completion code "
+ ex.completionCode
+ "\n>MQStatus: Reason code "
+ ex.reasonCode + " mesage" + ex.getClass());
System.exit(1);
}

catch (Exception e) {
print("MQCommunicator.constructor - Exception occurred - "
+ e.toString());
System.exit(1);
}
}

public MQMessage send(String buffer) {

try {
MQMessage sendMessage = null;

try {
// Create new MQMessage object
sendMessage = new MQMessage();
} catch (NullPointerException e) {
print("Unable to create new MQMessage");
return null;
}
print("MQMessage created");

sendMessage.format = MQC.MQFMT_STRING;
sendMessage.messageType = MQC.MQMT_REQUEST;
sendMessage.replyToQueueName = replyQueueName;
sendMessage.writeString(buffer);
MQPutMessageOptions pmo = new MQPutMessageOptions();
try {
requestQueue.put(sendMessage, pmo);
} catch (NullPointerException e) {
print("Request Q is null - cannot put message");
return null;
}
print("Message placed on queue");
storedMessage = new MQMessage();
storedMessage.correlationId = sendMessage.messageId;
print("Message ID for sent message = "
+ sendMessage.messageId.toString());
print("Correlation ID stored = "
+ storedMessage.correlationId.toString());

return storedMessage;

} catch (MQException ex) {
print("MQCommunicator.send - MQException occurred : Completion code "
+ ex.completionCode + " Reason code " + ex.reasonCode);
return null;
} catch (java.io.IOException ex) {
print("MQCommunicator.send - IOException occurred: " + ex);
return null;
} catch (Exception ex) {
print("MQCommunicator.send - General Exception occurred: " + ex);
return null;
}
}

public void finalise() {
try {
// Closing the queues
requestQueue.close();

if (requestQueue != replyQueue)
replyQueue.close();

// Disconnect from the queue manager
qMgr.disconnect();

} catch (MQException ex) {
print("MQCommunicator.finalise - MQException occurred : Completion code "
+ ex.completionCode
+ ">MQStatus: Reason code "
+ ex.reasonCode);
}
}

public static void print(String msg) {
PrintWriter message = new PrintWriter(System.out, true);
message.println(">MQStatus: " + msg);
}

private static String getFileContent(String fileName) throws Exception {
File file = new File(fileName);
StringBuffer strBuffer = new StringBuffer();
try {
FileInputStream fileIn = new FileInputStream(file);
int lengthOfFile = (int) file.length();
byte[] outputByte = new byte[lengthOfFile];
// copy binary content to output stream
while (fileIn.read(outputByte) != -1) {
strBuffer.append(new String(outputByte));
}
fileIn.close();
} catch (Exception e) {
print("Exception FileInputStream" + e.getMessage());
e.printStackTrace();
throw e;
}
return strBuffer.toString();
}

public static void main(String args[]) throws Exception {


InputStream file = null;
String propertyFile = "mq.properties";
print("Load property File");
try {
file = MQSendUtility.class.getClassLoader().getResourceAsStream(
propertyFile);
props.load(file);
print("Loaded property File");
String filePath="requestMessage.xml";
String message = MQSendUtility.getFileContent(filePath);
String reqQueueName = props.getProperty("mq.request.queue");
String repQueueName = props.getProperty("mq.reply.queue");
String queueManager = props.getProperty("mq.queue.manager");
String channel = props.getProperty("mq.channel.name");
String qManagerUrl = props.getProperty("mq.provider.url");
print("Calling Constructor");
MQSendUtility util = new MQSendUtility(qManagerUrl, channel,
queueManager, reqQueueName, repQueueName);
MQMessage replyMsg = util.send(message);


} catch (IOException io) {
if (file == null)
print("No input file specified");
} catch (Exception e) {
print("Exception occured in main " + e.getMessage());
} finally {
if (file != null) {
try {
file.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}

}

}

STEP 3. 


Copy below to shell script.

File: sendMQ.sh

#!/bin/ksh

#Execute Domain variables
. /opt/app/domains/my_domain/bin/setDomainEnv.sh

# Assuming domain variables don't include com.ibm.mq.jar so include it
CLASSPATH=$CLASSPATH:/opt/app/domains/my_domain/mq-jars/com.ibm.mq.jar
export CLASSPATH

cd /opt/app/script/alok_tmp
javac -d bin -sourcepath src src/MQSendUtility.java

cd /opt/app/script/alok_tmp/bin
java -Dbea.home=$BEA_HOME  MQSendUtility


STEP 4. 


Below is property file & request message file(XML).

File: mq.properties 

mq.provider.url=#IP Address of the IBM WebSphere MQ server i.e. 172.0.0.1
mq.channel.name=#Channel Name.This must be a valid channel on the IBM WebSphere MQ server.
mq.request.queue=# MQ Name where msg need to be put.This should be a valid queue for the specified queue manager.
mq.reply.queue=# reply queue name.This should be a valid queue for the specified queue manager.
mq.queue.manager=# This should be a valid queue manager on the IBM WebSphere MQ server i.e. qmgr123.
mq.listen.port=# Specifies the port of the IBM WebSphere MQ server.
mq.server.security.principal=#Specifies the username who has permission to use this channel.
mq.server.security.credentials=# Specifies the password for the given user.


File: requestMessage.xml

Hello, this is a test message being sent to MQ on IBM websphere server.

STEP 5. 


Now run sendMQ.sh and see output as below.




Hope above helps in testing Metasolv to WebSphere MQ connectivity by checking if M6 application server is able to send a message to MQ , please leave your feedback or query.


Monday, September 21, 2015

Set Up Metasolv Gateway Events

PURPOSE


To set up gateway events in Metasolv.

SOLUTION


The gateway events are configured to integrate Metasolv to third party application. Please follow below steps to set the gateway events up.

STEP 1. 


Go to find links in M6 GUI and click gateway event, right click on left pane and click New-> Gateway, create a new gateway 'Test' as below.


STEP 2.


 Right Click on newly created gateway Test and click New-> Gateway Event 'Test Gateway Event' as below.



STEP 3.


Now in the provisioning plan associate the gateway event with the task by selecting the task and adding the gateway events to the task.

1. Select the task in the gateway tab.
2. Now select the gateway event from right pane and add it to the left pane by selecting the arrow button.




STEP 4.


Modify the following files located at “<MSLV_HOME>/<SERVER_NAME>/appserver/gateway”

1. In gateway.ini


For setting up gateway events Integration Server (integration.xml gateway events) and / or the Event Server (CORBA gateway events/gateway binding configured) should be up and running.

In order to do that uncomment the highlighted line by removing semicolon and restart the application server.

[ThreadProcs]
INTEGRATIONSERVER=com.mslv.integration.integrationServer.S3Startup
;EVENTPROC=MetaSolv.eventServer.S3Startup
;EVENT2PROC=MetaSolv.event2Server.Event2ServerStartup
;SYSTEMTASKSERVERPROC=com.mslv.core.api.internal.WM.systemTaskServer.SystemTaskServer
;SIGNALSERVERPROC=com.metasolv.system.StartServer
;INTERNET_SIGNAL_SERVER=MetaSolv.CORBA.WDIINTERNETSERVICES.WDIRoot,MetaSolv.SignalServer.WDIInternetSignalServerRootImpl

2. In integration.xml


Get your gateway event id by running the following query

SELECT gateway_event_id, gateway_event_nm
  FROM asap.gateway_event ge
 WHERE gateway_event_nm = 'Test Gateway Event'


Add the following lines in the handlers section of integration.xml

<handler enabled="true">
<event-id>your gateway event id from above query</event-id>
<class>com.mslv.integration.handlers.DefaultEventHandler</class>
<destination>api</destination>
</handler>

STEP 5.

The message from the Gateway Event first reaches mss.internal.event.queue.

In the WLICONSOLE window opened by
http://MetasolvApplicationServer:AdminServerPort/wliconsole create the event generator to capture the event from mss.internal.event.queue to mss.external.event.queue as below.



Note: While executing the Gateway Events through the Integration server, the messages will flow from from mss.internal.event.queue to mss.external.event.queue through the InternalOutBoundGenerator event generator.

See below number of messages have been read out by above event generator.


Now create another jms event generator to get the event from mss.external.event.queue to the channel of your JPD which is created in the schema folder of your JPD.
In default Rule Channel select the channel of your JPD.

Hope above helps in setting up gateway events for your Metasolv application, please leave your feedback or query

Monday, September 14, 2015

Configure Metasolv Background Processor Server

PURPOSE


To configure Background Processor Server for Metasolv application.

SOLUTION


Please follow below steps to configure Background Processor Server.

STEP 1.


It is recommended that you create a separate user in M6 for configuring background processor.Lets say BPADMIN is the user.

Multiple Backgound Processors can be created seeing the business requirement.



STEP 2.


Update the jmaster.ini file in the Metasolv client directory.

[DBMS_Profiles]
[Application Servers]
J2EEProfiles= 'TEST'

[J2EEProfile TEST]
url=http://M6_Application_Server_IP:Port
database=MetasolvDB SID

[PROFILE PURGEUTIL]
DBMS=O84
Database=Oracle
UserId=
DatabasePassword=
LogPassword=
ServerName=ServerName-->to be given
LogId=
Lock=
Prompt=1
DbParm=DisableBind=0
DelimitIdentifier='No'
CommitOnDisconnect='No?
AutoCommit=0

Note:Background Processor connects to application server IP as mentioned above in jmaster.ini. Background Processor uses JDBC connection using mslvNoneTxDataSource. While creating multiple background processors keep Maximum Capacity and Initial Capacity of the DataSource in consideration. Its recommended to have sufficient Initial Capacity of the DataSource.


STEP 3. 


Go to M6 client directory and run jmanager.exe.

Login with ASAP user to launch jmanager console.




STEP 4. 

In job manager console click on Servers, then go to File--> New

Give in the details for the Background Processor Server.


Server Logical Name= Any name for your background processor
i.e. M6_BACKGROUND_PROCESSOR  etc.

Host Name= Host Name of machine where the background processor to be set up.
i.e. Alok Laptop etc.

Job Worker Exe Path = Path of M6 client directory.
i.e. c:/mss etc.

similarly provide other details.

STEP 5. 


Go to M6 client directory and in order to run Background Processor launch jmaster.exe.

Login with BPADMIN user created above. Here you go with running Background Processor server.


Note: Only one jmaster.exe will be running on one host.

STEP 6. 


In order to avoid STEPS 3-4 use below SQL( Not recommended).

Login to M6 database with ASAP user and RUN below SQL.

Insert into JOB.JOB_SERVER
 (SERVER_LOGICAL_NM, HOST_NM, SERVER_DESC, SERVER_STATUS_IND, MAX_WORKERS_ALLOWED, JOB_MASTER_REFRESH_RATE, REROUTE_JOB_MIN, LAST_MODIFIED_DATE, LAST_MODIFIED_USERID, WORKER_EXE_PATHS, ACTIVE_IND)
 Values
 ('M6_BACKGROUND_PROCESSOR', 'Alok Laptop', 'BackGround Processor', 'R', 60, 60, 15, SYSDATE, 'ASAP', 'c:/mss', 'Y');
COMMIT;


Hope above helps in configuring Background Processor for your Metasolv application, please leave your feedback or query. 

Tuesday, September 8, 2015

Install WebLogic Patch to MetaSolv Solution WebLogic Servers

search for a patch using the Patch Number

  1. Log onto My Oracle Support.
  2. Click on the "Patches & Updates" tab.
  3. Click on "Patch Name or Number".
  4. For the "Patch Name or Number" type in the patch number (for example: 1748XXXX).
  5. Choose the "Platform" and Hit Search.
  6. Click on the Patch Name to bring up the download page.



search for a patch using the Smart Update Patch ID

  1. Log onto My Oracle Support.
  2. Click on the "Patches & Updates" tab.
  3. Click on "Product or Family" (Advanced Search)
  4. For the "Product is" choose Oracle WebLogic Server.
  5. For the "Release is" choose WLS 10.3.
  6. For "Description contains" type in your Smart Update Patch ID (like XXXX).
  7. Hit Search.
  8. Click on the Patch Name to bring up the download page.



Install WebLogic Patch to MetaSolv Solution WebLogic Servers



  1. Extract the contents from the patch zip file downloaded into the ($BEA_HOME/utils/bsu/cache_dir) directory, you will have a jar file and patchcatalog_XXXX.xml.                                                                                                                          
                                                                                                                                                                                                                                           
  2. Copy the files (for example, XXXR.jar) and the patchcatalog_xxx.xml from the zip file to the target machine. You do not need the readme file. 
  3. Run below command for unzip or unzip through other unzip utilities like(winzip, 7zip etc)

./p964XXXX_103100_Generic.zip -d $BEA_HOME/utils/bsu/cache_dir

replace $BEA_HOME/utils/bsu/cache_dir/patch-catalog_XXXX.xml? [y]es, [n]o, [A]ll, [N]one, [r]ename: y
  inflating: $BEA_HOME/utils/bsu/cache_dir/patch-catalog_XXXX.xml
replace $BEA_HOME/utils/bsu/cache_dir/README.txt? [y]es, [n]o, [A]ll, [N]one, [r]ename: y
  inflating: $BEA_HOME/utils/bsu/cache_dir/README.txt
  inflating: $BEA_HOME/utils/bsu/cache_dir/XXXX.jar

Note: Always copy the patchcatalog_xxx.xml file from the downloaded patch to the cache_dir along with the patch itself. Do NOT rename this file. Run the Smart Update with user use to
run WebLogic Server

Now install the patch using Smart Update either in GUI mode following step '1' or Command Line mode following step '2'.

1. Smart Update in graphical (GUI) mode



  1. Run the <BEA_HOME>/utils/bsu/bsu script (bsu.sh for UNIX, bsu.cmd for Windows). This will start the Smart Update GUI.
  2. Look for the patches you copied in the "Downloaded Patches" section at the bottom.
  3. Select the "Apply" button for each patch you want to apply. This will validate the patch and apply it to the whole installation.




2. Smart Update in Command Line mode



  1. Go to directory as below.

    cd $BEA_HOME/utils/bsu

  2. Run below command.

    ./bsu.sh -prod_dir=<weblogic-home> -patch_download_dir=$BEA_HOME/utils/bsu/cache_dir -patchlist=XXXX  -verbose -install

  3. Install multiple patches.

    ./bsu.sh -prod_dir=<weblogic-home> -patch_download_dir=$BEA_HOME/utils/bsu/cache_dir -patchlist=XXXX, XXXX  -verbose -install

  4. In case you want to remove a patch run below command.

    ./bsu.sh -prod_dir=<weblogic-home> -patchlist=XXXX  -verbose -remove
Note: Here XXXX is the name of the jar file in the patch.

Hope above helps you in installing Metasolv patches on your environment, please leave your feedback or query.