Development of Advanced Applications with IBM WebSphere Application Server Liberty Profile

IBM Redbooks Solution Guide

Published 23 June 2015

More options

Rate and comment

Authors: Miho Hachitani

Abstract

Introduces the WebSphere Application Server V8.5.5 Liberty profile solution for developing the advanced applications and gives an overview of the Liberty profile and its tools.

Contents

IBM® WebSphere® Application Server is the IBM implementation for the Java Platform, Enterprise Edition (Java EE) platform. WebSphere Application Server is available in unique packages that meet a wide range of customer requirements. Each package has its own unique characteristics, but at the core of all of them is the same runtime application server environment.

The run time that is traditionally available with the WebSphere Application Server is referred to as the full profile. The application serving run time, provided by the full profile, is composed of a wide spectrum of components that are always available in the application server.

Starting with WebSphere Application Server V8.5, a Liberty profile is included with each edition. Starting with V8.5.5, a new Liberty Core package is available. You can also download the Liberty profile from WASdev.net at the following website:
https://developer.ibm.com/wasdev/downloads/liberty-profile-using-non-eclipse-environments/

The Liberty profile is an efficient development platform. It also scales up to massive, centrally managed production topologies, allowing you to use the same run time, and one set of management skills, for all your application server environments.

An important change to the license of the Liberty profile download occurred as of the WebSphere Application Server V8.5.5.5 release. You can now use the Liberty profile at no cost under the following listed conditions:

  • Development environments and small scale test or production environment.
  • Use of up to 2 GB of JVM heap space in test or production environment organization-wide.

You can confirm the detailed information about the license of the Liberty profile downloaded from WASdev.net at the following website:
https://developer.ibm.com/wasdev/docs/websphere-application-server-everyone/.

The Liberty profile in WebSphere Application Server V8.5.5 and later supports some specifications of Java Platform Enterprise Edition 7 (Java EE 7) in addition to Java Platform Enterprise Edition 6 (Java EE 6). Java EE 7 is focused on developing applications in simpler, more efficient ways than Java EE 6. You can develop an advanced application efficiently by using these with the Liberty profile.

This IBM Redbooks® publications Solution Guide introduces the WebSphere Application Server V8.5.5 Liberty profile solution for developing advanced applications. Figure 1 gives an overview of the Liberty profile and its tools.


Figure1. WebSphere Application Server Liberty profile and tools


Did you know?

WebSphere Application Server has adopted a continuous delivery model to deliver new features and functions to the Liberty profile. They can be added to an existing Liberty profile installation without needing a version upgrade or migration, and are available for download using an online repository. To access the WebSphere Liberty Repository and add the available features and functions like Java EE 7 technologies to your existing Liberty profile, see the following website:
https://developer.ibm.com/wasdev/downloads/


Business value

The Liberty profile provides a lightweight, simple, and powerful application server for web applications. The Liberty run time supports the full Java EE 7 platform specification, providing a standards-based application programming model. The Liberty profile and the WebSphere Application Server Developer Tools for Eclipse are freely available for single developer use desktops and supported under WebSphere Application Server production runtime licenses.

For developers, the Liberty profile and the supporting developer tools can be downloaded quickly and used at no additional charge. The application server is simple to configure and quick to start. Configuration files can be shared to easily make an array of server configurations available to the development team, reducing the time that is spent on server administration. Developers can develop and test the applications to run on a Liberty profile production server.

The Liberty profile run time can be extended with custom features. This capability is of interest to developers and administrators who want to include additional features, and to IBM Business Partners who want to extend the Liberty profile server to provide a run time for their own products.

Docker image (containing the Liberty profile V8.5.5) is available on Docker Hub, and allows you to get the lightweight Liberty server up and running quickly in your Docker environment with only a single command. The Liberty profile can be used in various environments such as on the cloud and on-premises to suit your needs.

The IBM WebSphere Application Server Migration Toolkit – Liberty Technology Preview is now available. This product enables you to identify most of the porting issues related to moving your existing Java EE applications from third-party Java EE servers to the Liberty profile. Therefore, you can port your applications quickly to the Liberty profile.

Market change is rapid because the customers who adopt cloud, mobile, and social media technologies are expanding and their way of engaging with their clients continuously adapts. The Liberty profile supports Java EE 7 specifications that provide the functions to develop applications required in this current market. With the Liberty profile, you can develop applications to deliver services that respond quickly to changing business needs.


Solution overview

The Liberty profile provides a simplified run time for web, enterprise, and Open Service Gateway Initiative (OSGi) applications, supporting the full Java EE programming model. The application-serving environment is configured with the correct level of capabilities that are required for the individual applications. You can use the Liberty profile to specify only those features that are required for the applications that are deployed in your server instance, reducing the memory footprint and increasing performance. The Liberty profile has a simplified installation and uses an easy-to-configure XML configuration file format.

The Liberty Profile supports direct enhancement of the run time through user-defined features that are deployed in product extensions. Creating your own features allows you to customize or extend the behavior of the run time by using system programming interfaces (SPIs) that applications cannot access. User-defined features can also provide additional application programming interfaces (APIs) and services to deployed applications.

Developers can develop the advanced applications using Java EE technologies supported in the Liberty profile, and also use the new technologies delivered in WebSphere Liberty Repository. Developers can deploy the developed applications to Liberty profile server in several ways that are convenient for them. The applications and the server configurations can be updated dynamically.

Because the Liberty profile server is lightweight, it can be packaged easily with the applications in a compressed file. This package fits perfectly into a modern dev-ops flow, with both application code and server configuration under source code control, and the server package produced as build output. This package can be stored, distributed to colleagues, and used to deploy the application to a different location or to another system. It can even be embedded in the product distribution. The package contains all of the binary files, server configuration, and applications that are necessary to distribute the server. Instead of bundling the entire Liberty install, the package can contain what you need based on your server configuration by using the minify option when packaging. This option makes your Liberty profile package more portable and smaller.


Solution architecture

This section covers the architecture of this solution.

Runtime architecture and configuration

The Liberty profile is built on OSGi technologies. The Liberty profile run time is composed of the Liberty profile kernel and any number of optional features that run inside of a single Java virtual machine process. The features that are present in the run time are specific to the function that is needed for that server instance and its applications. The kernel provides configuration, feature management, and logging services. Most of the kernel runs as OSGi bundles within an OSGi framework. Figure 2 shows the architecture of the Liberty profile. In this diagram, the server configuration includes just a few of the many features that are available.


Figure 2. Liberty profile architecture

The Liberty profile server environment operates from a set of built-in configuration defaults. A Liberty profile server configuration consists of a server.xml file, an optional bootstrap.properties file, and any files that are included by these two main configuration files. The server.xml file is the primary configuration file for the server and contains information about the following items:
  • The features to be included in the runtime environment
  • The applications that are deployed into that runtime environment
  • Their data sources and operational properties, such as an override to a configuration default or a trace specification

The server.xml file can point to (include) one or more remote XML files. This allows common configuration settings to be reused in multiple configuration files and to be shared across multiple servers.

Administrators and developers can use the Liberty profile developer tools or a text editor to edit the configuration files. Management of the environment can be done with simple commands, Jython scripts, or by using the developer tools. In addition to these methods of administration, the standard tools for Java run times, such as JConsole, can be used to monitor the Liberty profile runtime characteristics and to start select operations.

Figure 3 shows how Liberty servers can be configured and managed.


Figure 3. Server configuration and management

Expanding the run time with custom features

The Liberty profile run time can be enhanced through the inclusion of product extensions. For example, OSGi bundles in a user-defined feature can augment or extend supported programming models (such as a custom trust association interceptor (TAI) that can be provided by a user-defined feature).

User-defined features in these extensions become an integrated part of the run time:
  • Services that are provided by a user-defined feature can receive a user-specified configuration from the server configuration file.
  • OSGi bundles in a user-defined feature can interact with OSGi services that are provided by the run time and by other extensions.
  • OSGi services that are provided by user-defined features can be shared with OSGi applications.
  • Classes in OSGi bundles that are provisioned by a user-defined feature can use system programming interfaces that are provided by the Liberty profile or by other extensions.

Developing the applications

IBM Rational® Application Developer provides a feature-rich development solution for teams that develop software for WebSphere Application Server. Rational Application Developer Standard Edition provides developers with the ability to have a single environment to help simplify and accelerate the core tasks of designing and writing code, testing WebSphere applications, and then maintaining those applications. Rational Application Developer stays synchronized with WebSphere Application Server in terms of strategic focus on technologies and standards (including Java Platform, Enterprise Edition (Java EE) levels, SOA, web and Web 2.0, Portal, and the OSGi programming model).

For developers who do not need the full range of features that are offered by Rational Application Developer, an alternative is the WebSphere Application Server Developer Tools for Eclipse V8.5.5. This product is available for developing applications that are targeted at a WebSphere Application Server full profile and Liberty profile as a run time. WebSphere Application Server Developer Tools for Eclipse contains the tools that are required for the development of Java EE applications (beyond what is in Eclipse), OSGi applications, and applications using the web and mobile programming models. It includes support for deploying applications to existing WebSphere Application Server V7, V8, and V8.5 installations and the V8.5 Liberty profile.

WebSphere Application Server Developer Tools for Eclipse is available at no additional charge for developer desktops. When you install the software from the Eclipse Marketplace, you typically pick WebSphere Application Server Developer Tools for Eclipse for the WebSphere Application Server version that you are using, which filters out support for the other versions. After you install the tools, you can see and install additional features, such as support for a different version of WebSphere Application Server.

Programming models

The WebSphere Application Server Liberty Core edition is a separate offering that is available for production usage that is based on the Liberty profile. Table 1 shows the Java EE 6 technologies that are supported in Liberty Profile and Liberty Core Edition.

Table 1. Supported Java EE 6 technologies (part 1 of 2)
Java EE 6 TechnologiesLiberty ProfileLiberty Core
Java Platform, Enterprise Edition 6 Web Profile
Java API for RESTful Web Services (JAX-RS) 1.1
Implementing Enterprise Web Services 1.4
Java API for XML-Based Web Services (JAX-WS) 2.2
Java Architecture for XML Binding (JAXB) 2.2
Web Services Metadata for the Java Platform
Java API for WSDL (JWSDL)
SOAP with Attachments API for Java (SAAJ) 1.3
Java Servlet 3.0
JavaServer Faces (JSF) 2.0
JavaServer Pages 2.2/Expression Language (JSP/EL) 2.2
Standard Tag Library for JavaServer Pages (JSTL) 1.2
Debugging Support for Other Languages 1.
Contexts and Dependency Injection for Java (Web Beans 1.0)
Dependency Injection for Java 1.0
Bean Validation 1.0
Enterprise JavaBeans (EJB) 3.1 (includes Interceptors 1.1)○ (only EJB Lite subset and MDB)○ (only EJB Lite subset)
Table 1. Supported Java EE 6 technologies (part 2 of 2)
Java EE 6 TechnologiesLiberty ProfileLiberty Core
Java EE Connector Architecture 1.6
Java Persistence 2.0
Common Annotations for the Java Platform 1.1
Java Message Service (JMS) API 1.1
Java Transaction API (JTA) 1.1
Java Database Connectivity (JDBC) 4.0
Java Management Extensions (JMX) 2.0
JavaBeans Activation Framework (JAF) 1.1
Streaming API for XML (StAX) 1.0

Table 2 shows the Java EE 7 technologies that are supported in the Liberty Profile and Liberty Core Edition.

Table 2. Supported Java EE7 technologies (part 1 of 2)
Java EE 7 TechnologiesLiberty ProfileLiberty Core
Java Platform, Enterprise Edition 7 Web Profile
Java API for RESTful Web Services (JAX-RS) 2.0
Implementing Enterprise Web Services 1.4
Java API for XML-Based Web Services (JAX-WS) 2.2
Java Architecture for XML Binding (JAXB) 2.2
Web Services Metadata for the Java Platform
Java API for WSDL (JWSDL)
SOAP with Attachments API for Java (SAAJ) 1.3
Java API for JSON Processing 1.0
Java Servlet 3.1
JavaServer Faces (JSF) 2.2
JavaServer Pages 2.3
Expression Language (JSP/EL) 3.0
Standard Tag Library for JavaServer Pages (JSTL) 1.2
Debugging Support for Other Languages 1.0
WebSockets 1.1
WebSockets 1.0
EE Concurrency Utilities 1.0
Table 2. Supported Java EE7 technologies (part 2 of 2)
Java EE 7 TechnologiesLiberty ProfileLiberty Core
Contexts and Dependency Injection for Java (Web Beans) 1.2
Contexts and Dependency Injection for Java (Web Beans) 1.1
Dependency Injection for Java 1.0
Bean Validation 1.1
Enterprise JavaBeans (EJB) 3.2
Java EE Connector Architecture (JCA) 1.7
Java Persistence 2.1
Common Annotations for the Java Platform 1.21
Java Message Service (JMS) API 2.0
JavaMail 1.5
Java Authentication Service Provider Interface for Containers (JASPIC) 1.1
Java Authorization Contract for Containers (JACC) 1.5
Java Database Connectivity (JDBC) 4.1
Java Management Extensions (JMX) 2.0
JavaBeans Activation Framework (JAF) 1.1
Streaming API for XML (StAX) 1.0
The following list shows the supported technologies for OSGi applications in all editions of the Liberty profile:
  • Web Application Bundles
  • Blueprint Container
  • Blueprint Transactions
  • Blueprint Managed JPA
  • JNDI
  • JSP
  • JSTL
  • JSF
  • JAX-RS

The support list of the Liberty profile is routinely updated because of the continuous delivery model as already mentioned. You can find the latest support list of the Liberty profile at the following website:
http://www-01.ibm.com/support/knowledgecenter/SSAW57_8.5.5/com.ibm.websphere.wlp.nd.multiplatform.doc/ae/rwlp_prog_model_support.html

Deploy the applications

Developers can deploy applications to a Liberty profile server in several ways. Each of the following listed methods is simple to use and quickly installs and starts the application:
  • The developer can deploy the application to a server by using the developer tools.
  • The developer can drop the application archive file (WAR, EAR, or EBA) or extracted archive into a drop-ins directory.
  • The application can be declared in the server.xml file, allowing you to explicitly configure attributes for the application.

Whether you deploy the application in the drop-ins directory or at a location that is defined in the server.xml file, these locations can be monitored for dynamic updates. When an application is placed in the directory, the server automatically deploys and starts the application. When an application is removed from the directory, it is removed from the server. When the application is updated, the updates are automatically made to the application on the server.

You can also package the applications and server configuration to deploy to other systems. This can be accomplished by using the developer tools or a command that is included with the Liberty profile. In this scenario, the developer simply stops the server from the developer tools Server view, and uses the Package Server utility, which is available by right-clicking the server. The utility gives the option of including the server content (such as the server binary files) along with the applications and configuration. In this case, the developer is passing a package (including only the applications and configurations) to an administrator who deploys the application on a production system.


Usage scenarios

The developers can start to develop the applications quickly because the Liberty profile and the developer tools are freely available for developer desktops. The developers can develop the advanced application using Java EE 7 technologies anytime. The following scenario illustrates the development of the advanced applications using one of Java EE 7 technologies.

Scenario: Develop the interactive applications using WebSocket of Java EE 7

If you want to make your customer’s applications interactive, you can use WebSocket from Java EE 7 with the Liberty profile. The Liberty profile supports WebSocket 1.0 and 1.1.

To get started, the developer uses the instructions on the WASdev.net website to install the developer tools. They are available at the following link: http://www.ibm.com/developerworks/community/blogs/wasdev/entry/home.

The developer then uses the developer tools to create a test server. Because the Liberty profile run time has not been installed, the tools provide the option to download and install the Liberty profile as part of the server creation process. The server is created with a default configuration and is listed in the Servers view of the developer tools (shown in the lower portion of Figure 4). The server can be started normally or in debug mode, or can be stopped from this view. The developer needs to enable the WebSocket-1.1 feature by selecting Feature Manager in the server configuration of the test server.


Figure 4. Server Configuration opened in the developer tools

The developer tools provide intuitive tools and aids (including wizards) that assist with the creation of the application using WebSocket. The developer can create a WebSocket Server endpoint class by clicking the Developer Tools view. The endpoint class will already have some predefined implementations and annotations as defined by the WebSocket specification.
The developer can then add the business processing code into the endpoint class, as shown in Figure 5.


Figure 5. WebSocket Server endpoint
The developer can test this application in the Liberty servers by selecting the test server that is listed in the Servers view of the developer tools. Then, the developer can deploy this application to the production environment by one of the following ways:

  • Using the developer tools
  • Dropping the application into the drop-ins directory
  • Declaring the attributes for the application in the server.xml file
  • Passing the packaged file to the administrator who deploys the application


Integration

The Liberty profile can take advantage of integration with products that both enhance its ability to provide the quality of service required in production environments, and extend its reach to other systems and databases.

IBM WebSphere eXtreme Scale and the IBM WebSphere DataPower Appliance XC 10 V2

IBM WebSphere eXtreme Scale provides an extensible framework to simplify the caching of data that is used by an application. You can use WebSphere eXtreme Scale to build a highly scalable, fault-tolerant data grid with nearly unlimited horizontal scaling capabilities. WebSphere eXtreme Scale creates an infrastructure that can deal with very high levels of data processing and performance. When the data and resulting transactions experience incremental or exponential growth, the business performance does not suffer because the grid is easily extended by adding additional capacity in the form of JVMs and hardware. The IBM WebSphere DataPower® Appliance XC10 V2 is a hardware adaptation of a subset of the features of WebSphere eXtreme Scale. This appliance is purpose-built and easy-to-use for the caching tier of the enterprise application infrastructure.

The Liberty profile can interoperate a data grid in WebSphere eXtreme Scale or the XC10 appliance in two ways. The Liberty profile can persist HTTP session data to the grid for session failover and high availability purposes, rather than to a database. Liberty also supports caching for dynamic web content. By default, this caching is performed with a local caching service. For scalability or to cache other data, Liberty can interoperate with WebSphere eXtreme Scale or the WebSphere DataPower XC10 V2 Appliance.

For more information about WebSphere eXtreme Scale, see the following website:
http://www-01.ibm.com/software/webservers/appserv/extremescale/.

For more information about the WebSphere DataPower Appliance XC10 V2, see the following website:
http://www.ibm.com/software/webservers/appserv/xc10/.

IBM Security Directory Server

IBM Security Directory Server provides a high-performance LDAP identity infrastructure that can handle millions of entries. It is built to serve as the identity data foundation for web applications and identity management initiatives. The Liberty profile server can use the IBM Security Directory Server as a single user registry option, or (new in Version 8.5.5) as part of federated LDAP registries for authentication and role-based authorization. For more information about the IBM Security Directory Server, see the following website: http://www.ibm.com/software/products/us/en/directory-server/.

IBM WebSphere MQ

IBM WebSphere MQ is an asynchronous messaging technology for application-to-application communication that offers a fast, robust, and scalable messaging solution. WebSphere MQ ensures one time only delivery of messages to queue destinations that are hosted by queue managers. The Liberty profile provides a lightweight JMS provider in the wasJmsServer-1.0 feature. This messaging engine is ideal for fast test setups and for non-critical messaging applications. It does not provide clustering or failover of the messaging engine, so for applications that require that level of service, use IBM WebSphere MQ as the JMS provider.

Databases

The Liberty profile supports the Java Database Connectivity (JDBC) specification to access databases. All database drivers that are compliant with JDBC versions from 2.0 to 4.1 are supported. Testing is performed on a specific set of database types and versions, including IBM DB2®, Apache Derby, IBM Informix® database, Microsoft SQL Server Enterprise Edition, Oracle Database, and Sybase Adaptive Server Enterprise. This list is kept up-to-date on the Supported Software site: http://www-01.ibm.com/support/docview.wss?rs=180&uid=swg27006921.

Using a database from that previously noted list will provide you with added assurance through product testing, but IBM will support (and thus accept PMRs for any issues with) the use of any database driver that is JDBC-compliant.

The Liberty profile that is included with the base, Express, Network Deployment, and IBM z/OS editions has features that provide easy integration with MongoDB, CouchDB, and IBM Cloudant, which are scalable, document-oriented NoSQL databases. These features allow the database connection to be configured in the server.xml file to avoid hardcoding such information in the application.

MongoDB support is not available in Liberty Core.


Supported platforms

WebSphere Application Server is supported on IBM AIX®, HP-UX, IBM i, Linux, Solaris, Windows, and z/OS. MAC OS X is also supported for development. Complete information about the supported platforms and hardware can be found at http://www.ibm.com/software/products/us/en/appserv-was/.


Ordering information

This product is only available through IBM Passport Advantage®. Ordering information can be found in the software announcement for WebSphere Application Server V8.5.5 at http://ibm.co/13tRFV2.


Related information

For more information, see the following documents:


Special Notices

This material has not been submitted to any formal IBM test and is published AS IS. It has not been the subject of rigorous review. IBM assumes no responsibility for its accuracy or completeness. The use of this information or the implementation of any of these techniques is a client responsibility and depends upon the client's ability to evaluate and integrate them into the client's operational environment.

Follow IBM Redbooks

Follow IBM Redbooks