Oracle Weblogic Server Archive

Simple Checklist for WebLogic to JBoss Migration

Compare the supported J2EE specs ( EJB, JMS, Webservices) of the Weblogic Version you are going to migrate from to the JBoss Server version. You will get the details from their official website.

Find out the architecture of the Weblogic Application Server ( How many servers? Clusters? Machines?) either from the config.xml or Admin Console.

Find the dependencies of the applications ( where are third part libraries?)

Find the resources needed by the Application ( Datasources / Queues & Topics / Resource Adapters)

Change the Proxy ( Webserver configurations)

Deployment descriptor changes

Does the application rely of Application Server security? If so you will have to create corresponding users in JBoss.

Migrate the Custom MBeans / Startup classes / Application Listeners.

Change the JNDI lookup code in the application.

Refer this link that explains in details.

Auto Deployment and Hot Deployment

Auto Deployment:  

Features provided by the Application Servers in which applications can be automatically deployed / undeployed on to the server. The App Server provides a mechanism where they scan certain folders for the applications for ex. autoDeploy folder in weblogic, deploy folder in tomcat / Jboss etc.

Hot deployment:

The process of adding new components (such as WAR files, EJB Jar files, enterprise Java beans, servlets, and JSP files) to a running server without having to stop the application server process and start it again.  

Hot deployment is mainly used to update the individual modules or jsps/servlets/classes in a module without redeploying the complete app.

Auto Deployments of Web Applications in WebLogic Server:

This is the simplest form of deployment. When enabled the Admin Server periodically scans the autoDeploy folder and deploy all the applications present in there.

Note: This feature is disabled in the production mode.

Production mode of the application server can be changed using the handle –Dweblogic.ProductionModeEnabled=true in the server startup file.

Need of Auto Deployment:

This is a very quick way of deploying the application which can be using during development and unit testing phase to reduce the deployment time.

How to auto Deploy:

1. Start the WebLogic Server domain in development mode.

2. Place the application’s exploded directory structure or archive file in this autodeploy directory.

It is present under $DOMAIN_HOME folder structure.

Hot Deployment (Redeployment Strategies) in Weblogic server:

This can be achieved by using different Redeployment Strategies.

Production Redeployment:  

Production redeployment strategy involves deploying a new version of an updated application alongside an older version of the same application. WebLogic Server automatically manages client connections so that only new client requests are directed to the new version. Clients already connected to the application during the redeployment continue to use the older version of the application until they complete their work, at which point WebLogic Server automatically retires the older application.

In-Place Redeployment:

In-place redeployment immediately replaces a running application’s deployment files with updated deployment files. In contrast to production redeployment, in-place redeployment of an application or stand-alone J2EE module does not guarantee uninterrupted service to the application’s clients. This is because WebLogic Server immediately removes the running classloader for the application and replaces it with a new classloader that loads the updated application class files.

Partial Redeployment of Static Files:

WebLogic Server enables you to redeploy selected files in a running application, rather than the entire application at once. This feature is generally used to update static files in a running Web application, such as graphics, static HTML pages, and JSPs. Partial redeployment is available only for applications that are deployed using an exploded archive directory.

Partial Redeployment of J2EE Modules :

Partial redeployment also enables you to redeploy a single module or subset of modules in a deployed Enterprise Application. Again, partial deployment is supported only for applications that are deployed using an exploded archive directory.

Further reading.

http://docs.oracle.com/cd/E11035_01/wls100/deployment/redeploy.html

Happy Reading.

Wonders Team 🙂

Weblogic Server Administration for Beginners.

This article is for System Admins who are new to Weblogic Administration.

The following are the day to day task of a Weblogic Server Administrators.

1. Setting up infrastructure ( Managed Servers, Cluster, Nodemanager)
2. Deploying Applications
3. Creating resources( JMS, JDBC, Security)
4. Monitoring
5. Performance Tuning
6. Troubleshooting

Setting up infrastructure ( Managed Servers, Cluster, Nodemanager)

This includes installing Weblogic Server , creating domains, domain templates.
You need to figure out the needs of the application/applications that the domain is going to host.
Do you need a distibuted setup with Weblogic Server running on multiple machines?
Do you need a cluster, is session replication necessary for your application or load balancing is enough?
Do you want to control ( start/stop) the managed server from the console or you’ll prefer scripts to do it for you?
What environment you are going to create, DEV, UAT, SIT, Production?

You will need answers to these questions before going ahead with setting up the infrastructure.

Deploying Applications

You will have to select the mode of deployment ( stage, nostage, external stage) of the application.
This is largely determined by the size of the application. Also before deploying the applications you will have to know the dependency of the applications. Does your application need a datasource configuration? Do you have MDB’s in your application?What Queues/Topics the application needs? Read the Create Configurations section.

Create resources

Your application might need datasources/ jms queues and topics. You need to configure them. Also check if your application is using J2EE security , does it rely on Application Server container authentication. If yes, you’ll have to create users and groups. In some cases you will have to configure external security providers.

Monitoring

In production usually third party tools ( that rely on SNMP) are available to do the monitoring. You can also use JMX and WLST to write your own monitoring tools.

Performance Tuning

This is a very important area. You need to know the number of concurrent users who will be accessing the application, what wil be the transaction per second. You need to tune the heap and work manager accordingly to cater to the load. There is a calculation that goes behind it and I will try to cover in a separate article.

Troubleshooting

Admins are expected to resolve issues starting from the initial phase of setting up the infrastructure till the application goes live. A lot of Weblogic related issues are covered in the troubleshooting section of wonders.

Sample JMX Code to retrieve JDBC Connection Pool Parameter

import java.io.IOException;
import java.util.*;

import javax.management.*;
import javax.management.remote.*;

import javax.naming.Context;

import weblogic.jndi.Environment;
import weblogic.management.*;

public class JDBCConnectionPoolProperties {

	static MBeanServerConnection connection;
	static JMXConnector connector;
	static ObjectName service;

	public static void main(String[] args) {

		try {

			JMXServiceURL serviceURL = new JMXServiceURL("t3", "localhost",
					80,
					"/jndi/weblogic.management.mbeanservers.domainruntime");
			service = new ObjectName(
					"com.bea:Name=DomainRuntimeService,Type=weblogic.management.mbeanservers.domainruntime.DomainRuntimeServiceMBean");

			Hashtable h = new Hashtable();
			h.put(Context.SECURITY_PRINCIPAL, "weblogic");
			h.put(Context.SECURITY_CREDENTIALS, "weblogic123");
			h.put(JMXConnectorFactory.PROTOCOL_PROVIDER_PACKAGES,
					"weblogic.management.remote");
			connector = JMXConnectorFactory.connect(serviceURL, h);
			connection = connector.getMBeanServerConnection();

			JDBCConnectionPoolProperties jdbcConnPP = new JDBCConnectionPoolProperties();
			jdbcConnPP.getJDBCRuntime();

		} catch (Exception e) {
			e.printStackTrace();
		}
	}

	public void getJDBCRuntime() throws Exception {

		ObjectName[] serverRuntime = (ObjectName[]) connection.getAttribute(service,
				"ServerRuntimes");

		int length = (int) serverRuntime.length;

		for (int i = 0; i < length; i++) {
			String name = (String) connection.getAttribute(serverRuntime[i], "Name");
			ObjectName[] jdbcRuntime = (ObjectName[]) connection.getAttribute(new ObjectName("com.bea:Name="+name+",ServerRuntime="+name+",Location="+name+",Type=JDBCServiceRuntime"),"JDBCDataSourceRuntimeMBeans");
			int jdbcLength = (int) jdbcRuntime.length;

			for (int x = 0; x < jdbcLength; x++) {
				System.out.println("\nServer Name   " + name
						+ "   Datasource Name: "
						+ (String) connection.getAttribute(jdbcRuntime[x], "Name"));
				System.out.println("ActiveConnectionsCurrentCount    : "
						+ connection.getAttribute(jdbcRuntime[x],
								"ActiveConnectionsCurrentCount"));
				System.out.println("ActiveConnectionsAverageCount    : "
						+ connection.getAttribute(jdbcRuntime[x],
								"ActiveConnectionsAverageCount"));
				System.out.println("ActiveConnectionsAverageCount    : "
						+ connection.getAttribute(jdbcRuntime[x],
								"ActiveConnectionsAverageCount"));
				System.out.println("ConnectionsTotalCount            : "
						+ connection.getAttribute(jdbcRuntime[x],
								"ConnectionsTotalCount"));
				System.out.println("CurrCapacity                    : "
						+ connection.getAttribute(jdbcRuntime[x], "CurrCapacity"));
				System.out.println("CurrCapacityHighCount            : "
						+ connection.getAttribute(jdbcRuntime[x],
								"CurrCapacityHighCount"));
				System.out.println("HighestNumAvailable              : "
						+ connection.getAttribute(jdbcRuntime[x],
								"HighestNumAvailable"));
				System.out.println("HighestNumAvailable              : "
						+ connection.getAttribute(jdbcRuntime[x],
								"HighestNumAvailable"));
				System.out.println("LeakedConnectionCount            : "
						+ connection.getAttribute(jdbcRuntime[x],
								"LeakedConnectionCount"));
				System.out.println("WaitSecondsHighCount             : "
						+ connection.getAttribute(jdbcRuntime[x],
								"WaitSecondsHighCount"));
				System.out.println("WaitingForConnectionCurrentCount: "
						+ connection.getAttribute(jdbcRuntime[x],
								"WaitingForConnectionCurrentCount"));
				System.out.println("WaitingForConnectionFailureTotal: "
						+ connection.getAttribute(jdbcRuntime[x],
								"WaitingForConnectionFailureTotal"));
				System.out.println("WaitingForConnectionTotal        : "
						+ connection.getAttribute(jdbcRuntime[x],
								"WaitingForConnectionTotal"));
				System.out.println("WaitingForConnectionHighCount    : "
						+ connection.getAttribute(jdbcRuntime[x],
								"WaitingForConnectionHighCount"));
				String poolName = (String) connection.getAttribute(jdbcRuntime[x],
						"Name");
				ObjectName jdbcSystemResource = new ObjectName("com.bea:Name="
						+ poolName + ",Type=JDBCSystemResource");
				ObjectName jdbcDataSourceBean = (ObjectName) getObjectName(
						jdbcSystemResource, "JDBCResource");

				System.out.println("\n Connection Pool Parameters");
				ObjectName jdbcConnectionPoolParams = (ObjectName) getObjectName(
						jdbcDataSourceBean, "JDBCConnectionPoolParams");
				Integer CapacityIncrement = (Integer) getObjectName(
						jdbcConnectionPoolParams, "CapacityIncrement");
				System.out
						.println(" CapacityIncrement                      :"
								+ CapacityIncrement);

				Integer ConnectionCreationRetryFrequencySeconds = (Integer) getObjectName(
						jdbcConnectionPoolParams,
						"ConnectionCreationRetryFrequencySeconds");
				System.out
						.println(" ConnectionCreationRetryFrequencySeconds:"
								+ ConnectionCreationRetryFrequencySeconds);

				Integer ConnectionReserveTimeoutSeconds = (Integer) getObjectName(
						jdbcConnectionPoolParams,
						"ConnectionReserveTimeoutSeconds");
				System.out
						.println(" ConnectionReserveTimeoutSeconds        :"
								+ ConnectionReserveTimeoutSeconds);

				Integer HighestNumWaiters = (Integer) getObjectName(
						jdbcConnectionPoolParams, "HighestNumWaiters");
				System.out.println(" HighestNumWaiters                     :"
						+ HighestNumWaiters);

				Integer InactiveConnectionTimeoutSeconds = (Integer) getObjectName(
						jdbcConnectionPoolParams,
						"InactiveConnectionTimeoutSeconds");
				System.out.println(" InactiveConnectionTimeoutSeconds      :"
						+ CapacityIncrement);

				Integer InitialCapacity = (Integer) getObjectName(
						jdbcConnectionPoolParams, "InitialCapacity");
				System.out.println(" InitialCapacity                       :"
						+ InitialCapacity);

				Integer JDBCXADebugLevel = (Integer) getObjectName(
						jdbcConnectionPoolParams, "JDBCXADebugLevel");
				System.out.println(" JDBCXADebugLevel                      :"
						+ JDBCXADebugLevel);

				Integer LoginDelaySeconds = (Integer) getObjectName(
						jdbcConnectionPoolParams, "LoginDelaySeconds");
				System.out.println(" LoginDelaySeconds                     :"
						+ LoginDelaySeconds);

				Integer MaxCapacity = (Integer) getObjectName(
						jdbcConnectionPoolParams, "MaxCapacity");
				System.out.println(" MaxCapacity                           :"
						+ MaxCapacity);

				Integer ProfileHarvestFrequencySeconds = (Integer) getObjectName(
						jdbcConnectionPoolParams,
						"ProfileHarvestFrequencySeconds");
				System.out.println(" ProfileHarvestFrequencySeconds        :"
						+ ProfileHarvestFrequencySeconds);

				Integer ProfileType = (Integer) getObjectName(
						jdbcConnectionPoolParams, "ProfileType");
				System.out.println(" ProfileType                           :"
						+ ProfileType);

				Integer SecondsToTrustAnIdlePoolConnection = (Integer) getObjectName(
						jdbcConnectionPoolParams,
						"SecondsToTrustAnIdlePoolConnection");
				System.out.println(" SecondsToTrustAnIdlePoolConnection    :"
						+ SecondsToTrustAnIdlePoolConnection);

				Integer ShrinkFrequencySeconds = (Integer) getObjectName(
						jdbcConnectionPoolParams, "ShrinkFrequencySeconds");
				System.out.println(" ShrinkFrequencySeconds                :"
						+ ShrinkFrequencySeconds);

				Integer StatementTimeout = (Integer) getObjectName(
						jdbcConnectionPoolParams, "StatementTimeout");
				System.out.println(" StatementTimeout                      :"
						+ StatementTimeout);

				Integer TestFrequencySeconds = (Integer) getObjectName(
						jdbcConnectionPoolParams, "TestFrequencySeconds");
				System.out.println(" TestFrequencySeconds                  :"
						+ TestFrequencySeconds);

				String TestTableName = (String) getObjectName(
						jdbcConnectionPoolParams, "TestTableName");
				System.out.println(" TestTableName                         :"
						+ TestTableName);

				String StatementCacheType = (String) getObjectName(
						jdbcConnectionPoolParams, "StatementCacheType");
				System.out.println(" StatementCacheType                    :"
						+ StatementCacheType);

				String InitSql = (String) getObjectName(
						jdbcConnectionPoolParams, "InitSql");
				System.out.println(" InitSql                               :"
						+ InitSql);

				Boolean CredentialMappingEnabled = (Boolean) getObjectName(
						jdbcConnectionPoolParams, "CredentialMappingEnabled");
				System.out.println(" CredentialMappingEnabled              :"
						+ CredentialMappingEnabled);

				Boolean IdentityBasedConnectionPoolingEnabled = (Boolean) getObjectName(
						jdbcConnectionPoolParams,
						"IdentityBasedConnectionPoolingEnabled");
				System.out.println(" IdentityBasedConnectionPoolingEnabled :"
						+ IdentityBasedConnectionPoolingEnabled);

				Boolean IgnoreInUseConnectionsEnabled = (Boolean) getObjectName(
						jdbcConnectionPoolParams,
						"IgnoreInUseConnectionsEnabled");
				System.out.println(" IgnoreInUseConnectionsEnabled         :"
						+ IgnoreInUseConnectionsEnabled);

				Boolean PinnedToThread = (Boolean) getObjectName(
						jdbcConnectionPoolParams, "PinnedToThread");
				System.out.println(" PinnedToThread                        :"
						+ PinnedToThread);

				Boolean RemoveInfectedConnections = (Boolean) getObjectName(
						jdbcConnectionPoolParams, "RemoveInfectedConnections");
				System.out.println(" RemoveInfectedConnections             :"
						+ RemoveInfectedConnections);

				ObjectName jdbcDriverParams = (ObjectName) getObjectName(
						jdbcDataSourceBean, "JDBCDriverParams");
				ObjectName jdbcProperties = (ObjectName) getObjectName(
						jdbcDriverParams, "Properties");
				ObjectName[] jdbcPropertyBeans = (ObjectName[]) getObjectName(
						jdbcProperties, "Properties");

				for (int j = 0; j < jdbcPropertyBeans.length; j++) {
					ObjectName jdbcPropertyBean = null;
					jdbcPropertyBean = jdbcPropertyBeans[j];
					String jdbcPropertyName = (String) getObjectName(
							jdbcPropertyBean, "Name");
					String jdbcPropertyValue = (String) getObjectName(
							jdbcPropertyBean, "Value");
					System.out.println("\n Name & Value  "+ jdbcPropertyName + " " + jdbcPropertyValue);
				}

			}
		}
	}

	private Object getObjectName(ObjectName objectName, String attributeName)
			throws AttributeNotFoundException, InstanceNotFoundException,
			MBeanException, ReflectionException, IOException {
		return connection.getAttribute(objectName, attributeName);
	}
}

OUTPUT

Server Name AdminServer Datasource Name: PegaRULES
ActiveConnectionsCurrentCount : 0
ActiveConnectionsAverageCount : 0
ActiveConnectionsAverageCount : 0
ConnectionsTotalCount : 10
CurrCapacity : 2
CurrCapacityHighCount : 4
HighestNumAvailable : 5
HighestNumAvailable : 5
LeakedConnectionCount : 0
WaitSecondsHighCount : 0
WaitingForConnectionCurrentCount: 0
WaitingForConnectionFailureTotal: 0
WaitingForConnectionTotal : 0
WaitingForConnectionHighCount : 0

Connection Pool Parameters
CapacityIncrement :1
ConnectionCreationRetryFrequencySeconds:0
ConnectionReserveTimeoutSeconds :10
HighestNumWaiters :2147483647
InactiveConnectionTimeoutSeconds :1
InitialCapacity :1
JDBCXADebugLevel :10
LoginDelaySeconds :0
MaxCapacity :15
ProfileHarvestFrequencySeconds :300
ProfileType :0
SecondsToTrustAnIdlePoolConnection :10
ShrinkFrequencySeconds :900
StatementTimeout :-1
TestFrequencySeconds :120
TestTableName :SQL SELECT 1 FROM DUAL
StatementCacheType :LRU
InitSql :null
CredentialMappingEnabled :false
IdentityBasedConnectionPoolingEnabled :false
IgnoreInUseConnectionsEnabled :true
PinnedToThread :false
RemoveInfectedConnections :true

Name & Value user SYSTEM

Configuring Datasource on Weblogic Server

Precondition: We will create a Data Source using PostgresSQL. In order to test it you will have to install Postgres  and keep and instance running on port-5460. We also need to keep the Postgres-driver in the domain/lib folder.

Steps to Create a Data Source:

Step 1: Expand Services link Domain Structure, the Data Sources link will be displayed as given below:

Step1

 

Step 2: Click on the Data Sources link. the Summary for JDBC Data Sources page will be displayed. Click on new button, it will list down the different options. Select Generic Data Source from the dropdown menu as given below:

Step2

 

 

 

Step 3:  Create a new JDBC Data Source page is displayed. Enter the following details:

Name: DS1
JNDI Name: DS1
Database Type: PostgresSQL

Step3

 

 

 

 

Click on next button.

Step 4:   Select Database Driver: Other.

Step4

Click on next button.

Step 5:  The following page is displayed:

Step5

Click on next button.

Step 6: Enter the following details:

Database Name: postgres
Host Name: localhost
port: 5460
Database User Name: postgres
Password: saky
Confirm Password: saky

Step6

Click on next button.

Step 7:  Enter the following details:

Driver Class Name: org.postgresql.Driver
URL: jdbc:postgresql://postgres:5460/postgres
Database User Name: postgres
Password: saky
Confirm Password:saky
Properties: user=postgres
Step7

Click on next button.

Step 8:  Click on Test Configuration button. The following message should be displayed:

“Connection test succeeded.”

Click on next button.

Step 9: Select AdminServer as given below:

Step8

 

Step 10:  The Data source DS1 created appears in the Summary of JDBC Data Sources page as given below:

Step9

Step 11: Click on DS1 on the the Summary of JDBC Data Sources page. Click on Connection Pool link.

Step12

Expand Advanced section and check the field Test Connections On Reserve as given below:

Step13

 

Click on Save button.

Step 12: To test the connection:

Click on  Monitoring -> Testing

Step10

Step 13: Select the AdminServer .

Step11

Step 14: Click on Test data source. The following message is displayed:

“Test of DS1 on server AdminServer was successful.”

Note: You can also test by deploying a basic application on Weblogic Server and using the datasource created by the above steps.