Creating an OSGi Application project

An OSGi Application Project (EBA) groups together a set of bundles. The application can consist of different OSGi bundles types.

Before you begin

Ensure that WebSphere® Application Server Developer Tools is installed in your Eclipse IDE. For more information, see Setting up the development environment.

About this task

The CICS Explorer and CICS Explorer SDK help provides full details on how you can complete each of the following steps to develop and package web applications.

Procedure

  1. Set up a target platform for your Java development, using the CICS® TS 5.4 with Java EE and Liberty template. You might get a warning that the target is a newer version than the current Eclipse installation, but you can ignore this warning message.
  2. Create an OSGi bundle project for your application. The target platform effectively makes the packages available, so you must include the appropriate Import statements in the bundle manifest. A web-enabled OSGi bundle project is the bundle equivalent of a dynamic web project. You can use a web-enabled OSGi bundle project to deploy an application within an OSGi Application Project (an Enterprise Bundle Archive, or EBA file). You can mix web-enabled OSGi bundle projects (WAB files) and non-web-enabled OSGi bundle projects in your OSGi Application Project. A web-enabled OSGi bundle project would typically implement the front end of the application, and interact with the non-web OSGi bundles, which contain the business logic.
  3. Develop your web application. You can use the JCICS API to access CICS services and JDBC to connect to DB2®. The CICS Explorer SDK includes examples of web components and OSGi bundles that use JCICS and DB2. Create OSGi bundles that use JCICS to separate the business from the presentation logic. You can also use semantic versioning in OSGi bundles to manage updates to the business logic of the application. For each WAB or OSGi bundle that uses DB2 through the JDBC DriverManager interface, include an Import-Package header for com.ibm.db2.jcc in the bundle manifest. Omitting this import will result in the error message java.sql.SQLException: No suitable driver found for jdbc:default:connection. The import is not required when using the JDBC DataSource interface.
  4. Optional: If you want to authenticate users of the Web application, create a web.xml file in the web project to contain a security constraint. The CICS Explorer SDK includes a template for this file that contains the correct information for CICS. See Authenticating users in a Liberty JVM server for further information.
  5. Create an OSGi Application Project that references your OSGi bundles.
  6. Create a CICS bundle project that references the OSGi Application Project. You can also add definitions and imports for CICS resources. Each CICS bundle contains an ID and version so you can manage changes in a granular way.
  7. Optional: Add a URIMAP and TRANSACTION resource to a CICS bundle if you want to map inbound web requests from a URI to run under a specific transaction. If you do not define these resources, all work runs under a supplied transaction, which is called CJSA. These resources are installed dynamically and managed as part of the bundle in CICS.

Results

You set up your development environment, created a OSGi web application, and packaged it for deployment.

What to do next

When you are ready to deploy your application, export the CICS bundle projects to zFS. The referenced projects are built and included in the transfer to zFS. Alternatively, you can follow a development deployment model by exporting the application as an EBA file and deploying it to the dropins directory of a running Liberty JVM server. You should be aware that Security and other qualities of service are not configurable using dropins.


create_osgi_app.html | Timestamp icon Last updated: Monday, 5 June 2017