Develop and debug Java apps faster with this free lightweight server

IBM® WebSphere® Application Server Community Edition is a free, lightweight server that you can use to rapidly develop and debug Java applications in Rational® Application Developer. If you use the community edition server and its adaptor, you can eventually migrate your applications to a WebSphere Application Server in a production environment to leverage its high availability and robust features afterwards. This article focuses on how to use WebSphere Application Server Community Edition 3.0 with Rational Application Developer 8.0.3.

Chi Runhua, Staff Software Engineer, IBM

author photoChi Runhua is a member of the WebSphere Application Server Community Edition development team. He is also an Apache Geronimo committer.



20 September 2011

Also available in Vietnamese

IBM Rational Application Developer 8.0.3 for WebSphere software is based on the Eclipse integrated development environment (IDE). It extends Eclipse functions with visual development tools and IBM WebSphere support. It is a platform for building Java Platform, Standard Edition (Java SE) and Java Platform, Enterprise Edition (Java EE) 6 applications. Beyond these functions, Rational Application Developer provides development tools for technologies, such as OSGi, Service Component Architecture (SCA), Web 2.0, and XML. Rational Application Developer integrates with three types of WebSphere Application Server adaptor so that you can deploy web applications to WebSphere Application Server and WebSphere Portal Server. Beyond application development, you can integrate your development environment with Rational Team Concert and Rational ClearCase® to enable a wide range of change management operations, increasing both collaboration and team productivity.

IBM WebSphere Application Server Community Edition is a lightweight application server that is based onApache Geronimo. The community edition server includes many defect fixes, and is supported by IBM. It is a Java EE 6 compliant application server with an 80-100MB footprint, and you can download and use it for free. It also supports the OSGi application programming model and has a straightforward administrative console for Java asset management.

IBM WebSphere Application Server delivers significant improvements in performance, usability, and security that reduce risk, total cost of ownership (TCO), and time-to-value. It also supports Java EE 6 compliant applications development and deployment as well as OSGi, Web 2.0, and Mobile applications program models. Furthermore, it provides web tier clustering and failover across no more than five application server instances, and a variety of pricing alternatives, including socket-based pricing.

In this article

This article shows you how to use the community edition server adapter in Rational Application Developer and fast debug of Java applications. As we go through the development of a web application, we use the Rational Application Developer IDE with the WebSphere Application Server Community Edition plug-in for Eclipse (also called the WEP), to develop, deploy, and run the application.

Prerequisites

To do the tasks in this article, you must have the following applications installed:

  • IBM Rational Application Developer 8.0.3, or higher
  • IBM WebSphere Application Server Community Edition 3.0: To get this server, see the Resources section later in this article.
  • Community edition server 3.0 Eclipse plug-in (WEP): In order to work with the community edition server in Rational Application Developer, you must install the community edition Eclipse plugin(WEP). This plugin is the adapter that facilitates web application development in IDE with the community edition server. For a link to this plugin, see the Resources section later in this article. Extract the plugin to the IDE directory (where you installed Rational Application Developer) and restart the IDE.

Or you can install WEP from the internet directly:

  1. Start Rational Application Developer.
  2. Go to Help > Software Updates.
  3. Select the Available Software tab and click Add Site. Enter the following URL:http://public.dhe.ibm.com/software/websphere/wasce/updates/
  4. Restart Rational Application Developer.

Set up the community edition server environment

To create a community edition server instance in Rational Application Developer:

  1. Launch Rational Application Developer and go to Window > Open Perspective > Other. Select Java EE as shown in Figure 1 and click OK.
Figure 1. Java EE perspective
Select Java EE perspective in Rational Application Developer
  1. Look for the Servers tab at the bottom of the screen (see Figure 2). In this tab, right-click on a blank space and choose New > Server. Add a new server to the tab. If you do not see the Servers tab, go to Window > Show View, and then select the Servers view.
Figure 2. Create a server environment
Add a server
  1. Select IBM WASCE v3.0 Server and click Next.
Figure 3. Choose the community edition v3.0 server
Select the server from the list
  1. Click Browse and specify the JRE and the location where you have installed the community edition server (see Figure 4), then click Next.
Figure 4. Edit the server runtime environment
Define the runtime environment
  1. Set the administrator ID (The default issystem) and password (The default ismanager) for the community edition server (Figure 5). Click Next.
Figure 5. Default user name and password for the server
Enter the default user name and password
  1. In the Add and Remove Projects window, click Finish. The community edition server is now configured to work in Eclipse.

Your server should be visible in the Servers tab (Figure 6). To start and stop your server, use the appropriate buttons. After you start the server, the value in the State column changes to  Started.

Figure 6. The community edition server status
The status of CE 3.0 server

Tune arguments of the community edition server plugin on Eclipse

There are several ways to tune the server environment and improve performance when developing or debugging the applications on the server. Use the following program arguments by editing launch configuration properties of the server.

You might encounter some out-of-memory exceptions during application development and debug. You can pump up permanent generation of objects in the JVM by specifying a PermGen argument for IDE.

Figure 7. Configure a PermGen argument
Configuring VM arguments for CE server

All bundles that are installed into the server are stored in the /var/cache directory. Each bundle is assigned an ID. You can use the –clean argument to clean the bundle cache for next server start, or select the Clean OSGi bundle cache check box on the Overview page. This feature is especially useful when you develop OSGi bundles and frequently modify the code.

Figure 8. OSGi cache cleaning
Clean the OSGi cache

To get debugging information from the server log, you can use the –veryverbose argument to generate this information for the application, or select DEBUG on the Console Output tab of the Overview page.

Figure 9. Console output of the WEP setting
Selecting debug mode of server log information

When working on a web module, it is likely that you only updated some resource files. To avoid the whole web application being deployed again, you can choose to publish those modified files by specifying certain patterns with the Copy modified files instead of re-deploying web module feature. For example, included files pattern means that files with those prefixes will only be copied to the server and refreshed upon invocation. You can do the same to the modified OSGi bundles by selecting the Copy modified OSGi bundle check box.

Figure 10. Publish the modified files only
Publishing modified files only

Develop and debug a simple web application

We will use a simple HelloWorld web application to demonstrate how to develop and debug applications on the community edition server.

  1. Select IBM WASCE v3.0 server from Servers view and start the server in debug mode.
Figure 11. Starting the server in debug mode
Starting the server in debug mode
  1. Create a dynamic web project HelloWorld and select IBM WASCE v3.0 as its target runtime.
Figure 12. Create a web project
Creating a dynamic web project
  1. Open the Geronimo-web.xml file in the Geronimo Deployment Plan Editor. The <context-root> element represents the entry to access the web application.
Figure 13. Specify the <context-root> element
Defining deployment plan for the application
  1. Create an index.jsp file the following code snippet and place a breakpoint in the file.
Figure 14. Complete the code
Code for the index.jsp file
  1. Select the project and choose Debug on server.
Figure 15. Debug on server view
Select Debug on Server menu
  1. Select IBM WASCE v3.0 server as the target server and click Finish.
Figure 16. Choose the community edition server
Choose community edition as the server
  1. On the keyboard, press F5 or F6 to debug the application.
Figure 17. Debug the application
The debug perspective

Deploy the application to the community edition server

The community edition server has a console for server administration and resource management. We will use the Deployer portlet to deploy HelloWorld.war on the server.

  1. Start the community edition server and go to http://localhost:8080. Log in to the administrative console with the default ID system and password manager.
  2. Click Deployer on the navigation panel.
Figure 18. Deployer portlet
Use the Deployer portlet from the admin console
  1. Browse to the HelloWorld.war application and then click Install. The deployment plan file is included in WAR file, so we leave the other field blank.
Figure 19. A completed deployment
The web application was successfully deployed.
  1. After successfully installing the application, select Web Apps(WAR).
Figure 20. Access the web application
Review the status of deployed web application
  1. In the URL column, click /HelloWorld to access the newly deployed application.
Figure 21. HelloWorld
Access the web application

Migrate the application to WebSphere Application Server

Both WebSphere Application Server 8.0 and its community edition server version 3.0 support the Java EE specification. Therefore, you can seamlessly migrate Java EE 6 applications that you develop on the community edition server to WebSphere Application Server.

Acknowledgement

Thanks to Elson Yue, Xiao Yi and Han Hong Fang for their thoughts and thorough review of the paper.

Resources

Learn

Get products and technologies

Discuss

Comments

developerWorks: Sign in

Required fields are indicated with an asterisk (*).


Need an IBM ID?
Forgot your IBM ID?


Forgot your password?
Change your password

By clicking Submit, you agree to the developerWorks terms of use.

 


The first time you sign into developerWorks, a profile is created for you. Information in your profile (your name, country/region, and company name) is displayed to the public and will accompany any content you post, unless you opt to hide your company name. You may update your IBM account at any time.

All information submitted is secure.

Choose your display name



The first time you sign in to developerWorks, a profile is created for you, so you need to choose a display name. Your display name accompanies the content you post on developerWorks.

Please choose a display name between 3-31 characters. Your display name must be unique in the developerWorks community and should not be your email address for privacy reasons.

Required fields are indicated with an asterisk (*).

(Must be between 3 – 31 characters.)

By clicking Submit, you agree to the developerWorks terms of use.

 


All information submitted is secure.

Dig deeper into Rational software on developerWorks


static.content.url=http://www.ibm.com/developerworks/js/artrating/
SITE_ID=1
Zone=Rational, WebSphere, DevOps
ArticleID=757484
ArticleTitle=Develop and debug Java apps faster with this free lightweight server
publish-date=09202011