 | Level: Intermediate Ashish Jain (ashish.jain@in.ibm.com), Software Engineer, IBM
25 Sep 2007 Explore the new features and functions available in IBM® WebSphere® Application Server Community Edition V2.0, including new deployment plans, the ability to run multiple server instances simultaneously, a newly improved Web console, dependency injection, JAX-WS support -- plus all the benefits of full support for Java™ EE 5. Learn how this major release makes WebSphere Application Server Community Edition the most powerful free-to-use application server available.
Introduction
IBM WebSphere Application Server Community Edition V2.0
(hereafter referred to as Community Edition) is a Java Platform, Enterprise Edition 5 (Java EE 5) certified application server that contains integrated components for databases (Apache Derby), messaging services (Active MQ), and directory server (LDAP). Developed over GBeans architecture with Apache Geronimo 2.0 at its core, such features as scalability, modularity, portability, and customizability make Community Edition one of the most powerful application servers available.
As part of the WebSphere family, Community Edition assures integration with other IBM products, such as IBM Rational® Application Developer and WebSphere MQ, and provides a migration path to other WebSphere Application Server products.
 |
Download Community Edition V2.0 now!
IBM WebSphere Application Server Community Edition V2.0 is free to use and deploy. Download it now to get started. |
|
Community Edition is bundled with:
- IBM SDK, Java 2 Technology Edition
- JDBC drivers for Apache Derby and IBM DB2®
- Database connector support for Apache Derby, IBM DB2, Oracle®, Microsoft® SQL Server, MySql
- Directory support for Apache Directory Server, IBM Tivoli® Directory Server, MS Active Directory, OpenLDAP Server, and Sun™ ONE Directory Server
New stuff
The latest version of WebSphere Application Server Community Edition is certified for and contains full support for Java EE 5. In addition, this release includes many new features and major enhancements, including:
-
Enhanced Web console
-
Configuration substitution properties
-
One server, multiple repositories
-
Multiple server instances
-
Multiple server instances, each with its own repositories
-
Simplified deployment
-
Annotations
-
Eclipse plug-in and Eclipse V3.3
-
JAX-WS tools
-
Updated sample applications
Descriptions of these features are provided in the next sections.
Supported specifications
For your reference, the tables below list the specifications supported by Community Edition V2.0:
|
Table 1. Web application technologies
|
| Specification | Version | JSR No. | Changes from J2EE 1.4 |
|---|
| Servlet | Servlet 2.5 | JSR 154 | Maintenance update from Servlet 2.4 | | Java Server Pages | JSP 2.1 | JSR 245 | Upgrade from JSP 2.0 | | JSP Debug | JSP Debug 1.0 | JSR 45 | New for Java EE 5.0 | | Java Server Faces | JSF 1.2 | JSR 252 | New for Java EE 5.0 | | Java Server Pages Standard Tag Library | JSTL 1.2 | JSR 52 | New for Java EE 5.0 |
|
Table 2. Enterprise application technologies
|
| Specification | Version | JSR No. | Changes from J2EE 1.4 |
|---|
| JavaBeans Activation Framework | JAF 1.1 | JSR 925 | Maintenance update from JAF 1.0 | | JavaMail | JavaMail 1.4 | JSR 919 | Maintenance update from JavaMail 1.3 | | Java Persistence API | JPA 1.0 | JSR 220 | New for Java EE 5.0 | | Java Transactions API | JTA 1.1 | JSR 907 | Maintenance update from JTA 1.0 | | Java Authorization Contract for Containers | JACC 1.1 | JSR 115 | Maintenance update from JACC 1.0 | | Common Annotations for the Java Platform | Annotations 1.0 | JSR 250 | New for Java EE 5.0 | | Enterprise JavaBeans | EJB 3.0 | JSR 220 | Upgrade from EJB 2.1 |
|
Table 3. Management specifications
|
| Specification | Version | JSR No. | Changes from J2EE 1.4 |
|---|
| Java EE Management | Java EE Mgmt 1.1 | JSR 77 | Maintenance update from Mgmt 1.0 | | Java EE Application Deployment | App Deploy 1.2 | JSR 88 | Maintenance Update from App Deploy 1.1 |
|
Table 4. Web Services - Axis2
|
| Specification | Version | JSR No. | Changes from J2EE 1.4 |
|---|
| Implementing Web Services | WSEE 1.2 | JSR 109 | Maintenance update from WSEE 1.1 | | Java API for XML-Based Web Services | JAX-WS 2.0 | JSR 224 | New for Java EE 5.0 | | Java Architecture for XML Binding | JAXB 2.0 | JSR 222 | New for Java EE 5.0 | | Web Service Metadata for the Java platform | WS Metadata 2.0 | JSR 181 | New for Java EE 5.0 | | SOAP with Attachments API | SAAJ 1.3 | JSR 67 | Maintenance update from SAAJ 1.2 | | Streaming API for XML | STAX 1.0 | JSR 173 | New for Java EE 5.0 |
|
Table 5. Web services - CXF
|
| Specification | Version | JSR No. | Changes from J2EE 1.4 |
|---|
| Implementing Web Services | WSEE 1.2 | JSR 109 | Maintenance update from WSEE 1.1 | | Java API for XML-Based Web Services | JAX-WS 2.0 | JSR 224 | New for Java EE 5.0 | | Java Architecture for XML Binding | JAXB 2.0 | JSR 222 | New for Java EE 5.0 | | Web Service Metadata for the Java platform | WS Metadata 2.0 | JSR 181 | New for Java EE 5.0 | | SOAP with Attachments API | SAAJ 1.3 | JSR 67 | Maintenance Update from SAAJ 1.2 | | Streaming API for XML | STAX 1.0 | JSR 173 | New for Java EE 5.0 |
Enhanced Web console
To ease the process troubleshooting, the new Debug Views portlet in the Community Edition Web console offers various viewers for displaying information about both system modules and user defined modules. There are specific viewers for JMX, LDAP, ClassLoader, JNDI, and dependencies, as shown in Figure 1.
Figure 1. Debug View portlet in administrative console
Description of these unique viewers are provided below, each showing an example of a DB2 database pool that is deployed on the server using the admin console:
-
JMX Viewer
The JMX Viewer displays the different types of MBeans in a tree representation. Each MBean represents a tree node with an object name representation. The JMX Viewer can show:
- All MBeans
- J2EE™ managed objects
- Geronimo MBeans
- ServiceModule MBeans
- Statistics provider MBeans
- Search MBeans
Expanding any of these categories displays a list of objects, and selecting an object displays the attributes, statistics, and the operations that can be performed on the object. The portlet also has a search feature that takes Object Name Pattern as the key. Some examples for the key are:
-
geronimo:* displays all the MBeans starting with "geronimo:"
-
geronimo.config:* displays all the MBeans starting with "geronimo.config:"
-
*:j2eeType=StatelessSessionBean,* displays all the MBeans that are StatelessSessionBean
To view diagnostic information using the JMX Viewer (considering the database pool example):
- Launch the JMX Viewer from administrative console.
- Expand J2EE Managed Objects => JCAManagedConnectionFactory.
- Select the entry for database pool example.
- The panel on the right displays the Attributes, Info, Stats of the object and Operations that can be performed on the object, as listed on the corresponding tabs (Figure 2).
Figure 2. JMX Viewer for database pool sample
-
LDAP Viewer
Application servers store information about users in a repository based on files, databases, or LDAP (Lightweight Directory Access Protocol). LDAP stores information that is accessible across the enterprise for all applications. The LDAP Viewer helps you connect to any LDAP server and browse its contents (for read only access). Community Edition is compatible with IBM Tivoli Directory Server, Microsoft Active Directory 2000, OpenLDAP Server, and Sun ONE Directory Server. Be sure your directory server is running before the application server is started.
To use the LDAP Viewer:
- Launch the LDAP Viewer from administrative console.
- The viewer has two panels: one contains the tree view of ou (organizational unit) and the other has tabs for Attributes, Search and Connect Info. Expand the tree ou=system, which represents scope over the complete organization (Figure 3).
- Choose uid=admin. The Attributes tab in right panel displays the attributes of user admin.
- Select the Search tab and fill the form as depicted in Figure 4.
- The Connect Info tab displays the connection information of the LDAP server.
Figure 3. LDAP Viewer in administrative console
Figure 4. Search in LDAP Viewer
-
ClassLoader Viewer
ClassLoader is a component of Java-based systems that finds and loads Java classes at run time. The ClassLoader Viewer displays the defined classloaders, the relationships between them, and classes loaded by each. The viewer has two options: Search and Invert Tree.
By default, the ClassLoader Viewer displays the ClassLoader in parent-child format. The parent being sun.misc.Launcher$ExtClassLoader@6fbc6fbc. Select Invert Tree to change the view to child-parent format. The extension classloader sun.misc.Launcher$ExtClassLoader@6fbc6fbc is a child of bootstrap classloader.
To use ClassLoader Viewer (considering the database pool example):
- Launch the ClassLoader Viewer from the administrative console.
- Select Invert Tree.
- Select the entry for the database pool example and expand all the tree nodes. The viewer displays all the classes loaded for the database pool sample.
Figure 5. ClassLoader viewer for database pool sample
-
JNDI Viewer
JNDI (Java Naming and Directory Interface) is a directory interface API used for looking up data and objects, such as data sources, EJB components, and so on, by name. The JNDI Viewer is based on the same functionality, displaying the JNDI context for various modules.
To use the JNDI Viewer:
- Deploy an application, such as geronimo-jsp-examples-2.0.war.
- Launch the JNDI Viewer from the administrative console.
- Expand WebModule, then the org.apache.geronimo.applications.examples.geronimo-examples/geronimo-jsp-examples/2.0/war file. The viewer displays the JNDI context for various modules.
Figure 6. JNDI viewer
-
Dependency Viewer
It is common for applications to have dependencies on external libraries in the form of JAR or compressed archive files. Every module running on the server will also typically reference libraries or other modules. The Dependency Viewer displays a dependency view of all modules installed and running on the server. This information is helpful in finding and resolving duplicate dependencies, and finding any missing dependencies.
To use the Dependency Viewer (considering the database pool example):
- Launch the Dependency Viewer portlet from the administrative console.
- Expand the Resource Adapter Module tree.
- Expand the tree for the database pool sample. The viewer displays the dependencies of the DB2 database pool sample on DB2 JARs and system modules.
Figure 7. Dependency view of database pool sample
 |
Configuration substitution properties
Running multiple instances of an application server was somewhat cumbersome before Community Edition V2.0, since manual changes to the port configuration were required to avoid port conflicts. Running multiple server instances is now a one step process. In Community Edition V2.0, config.xml uses the expression of form $(a+b) to evaluate the port number for each module. For example:
Listing 1. From config.xml
<gbean name="RMIRegistry">
<attribute name="port">${NamingPort + PortOffset}</attribute>
</gbean> |
NamingPort and PortOffset variables are acquired from the config-substitutions.properties file while processing config.xml at startup. This file can be found at <WASCE_HOME>/var/config/config-substitutions.properties.
Listing 2. From config-substitutions.properties file
PortOffset=0
PlanServerHostname=0.0.0.0
PlanNamingPort=1099 |
RMIRegistry will start in port 1099, since by default portOffset=0. Changing portOffset=10, RMIRegistry will start in port 1109. Similarly, other modules will start with an offset of 10.
The name of the config-substitutions.properties file can be changed using the command:
Dorg.apache.geronimo.config.substitutions.file=var/config/myconfig-file.properties
Values in the config-substitutions.properties file are overridden by environment variables and system properties.
One server, multiple repositories
Community Edition V2.0 supports multiple repositories for each server instance. This feature comes in handy when physical separation of the data is required. For example, enterprises running large applications will find this feature useful should they need to change one repository without affecting the entire production environment.
To create a multiple repository:
- Create a plan newrepo.xml. For example:
Listing 3. newrepo.xml example
<?xml version="1.0" encoding="UTF-8"?>
<module xmlns="http://geronimo.apache.org/xml/ns/deployment-1.2">
<environment>
<moduleId>
<groupId>org.example.configs</groupId>
<artifactId>samplerepository</artifactId>
<version>2.0.1</version>
<type>car</type>
</moduleId>
<dependencies>
<dependency>
<groupId>org.apache.geronimo.configs</groupId>
<artifactId>j2ee-system</artifactId>
<version>2.0.1</version>
<type>car</type>
</dependency>
</dependencies>
<hidden-classes/>
<non-overridable-classes/>
</environment>
<!--Repository-->
<gbean name="newRepo" class="org.apache.geronimo.system.repository.Maven2Repository">
<attribute name="resolveToServer">true</attribute>
<reference name="ServerInfo">
<name>ServerInfo</name>
</reference>
</gbean>
<!--Configuration Store service-->
<gbean name="Local2" class="org.apache.geronimo.system.configuration.
RepositoryConfigurationStore">
<reference name="Repository">
<name>newRepo</name>
</reference>
</gbean>
</module> |
The resolveToServer attribute is Boolean; if true, it resolves the new repository to the server base directory, and if false, it resolves the new repository to the server base repository.
- Create a directory for the new repository <WASCE_HOME>/newrepo. This directory must be the same referred to by the root attribute in the Maven2Repository gbean. The path newrepo/ is relative to the Community Edition installation directory.
- Deploy newrepo.xml by running this command:
deploy deploy newrepo.xml
The deploy command is the script <WASCE_HOME>/bin/deploy.bat (or deploy.sh, depending on the operating system). It is invoked by typing deploy either from the <WASCE_HOME>/bin directory or by having that directory in system path. This completes the creation of second repository for the server.
To use the new repository:
- Open the command prompt (in Windows) or shell prompt (UNIX).
- Run this command:
deploy list-targets
- The list of repositories available with the server is displayed.
Listing 4. Available targets
org.example.configs/samplerepository/2.0.1/car? ServiceModule=
org.example.configs/samplerepository/2.0.1/car,j2eeType=ConfigurationStore,name=Local2
org.apache.geronimo.configs/j2ee-system/2.0.1/car?ServiceModule=
org.apache.geronimo.configs/j2ee-system/2.0.1/car,j2eeType=Configuration Store,name=Local |
- To deploy an application to the new repository, use this command:
deploy deploy --targets %NEWREPO% mysample.war
- To undeploy an application from the new repository, use this command:
deploy undeploy "%NEWREPO%|default/mysample/2.0.1/war"
Remember that deploying an application to a server's second repository is only supported through command line. Also, if the --target attribute is not used in the deploy command, then the application is deployed to all the repositories.
Multiple server instances
Community Edition V2.0 enables you to run multiple instances of a server from a single installation directory. Running multiple instances from a single directory has several advantages:
- It's cost effective; maintaining multiple servers on multiple machines can require multiple, expensive hardware and software configurations.
- The configuration of one instance does not affect the other instance.
- You reap the benefits of clustering and load balancing from one single installation of the server, improving scalability and ensuring high availability in case one instance crashes or hangs.
- Reduces overhead by distinctly separating the server resources over multiple instances of the server.
To create multiple instances of a server from one single installation:
- Create a directory <WASCE_HOME>/myserver (where myserver is the second instance of the server).
- Copy <WASCE_HOME>/var/* to <WASCE_HOME>/myserver/var.
- Edit the myserver/var/config-substitution.properties, uncomment
portOffset and change its value to 10.
- Start the server. You can do this one of three ways:
- Open the command prompt or shell prompt, then set:
GERONIMO_OPTS=-Dorg.apache.geronimo.server.name=myserver
and run:For Windows: <WASCE_HOME>/bin/startup.bat
For UNIX: startup.sh
- In <WASCE_HOME>/bin/setenv.bat, change:
@if "%JAVA_OPTS%" == "" set JAVA_OPTS=-Xms32m -Xmx256m
to this:
if "%JAVA_OPTS%" == "" set JAVA_OPTS=-Xms32m -Xmx256m -Dorg.apache.geronimo.server.name=myserver
and run:For Windows: <WASCE_HOME>/bin/startup.bat
For UNIX: startup.sh
- Pass -Dorg.apache.geronimo.server.name=myserver to command line
invocation to the server. From <WASCE_HOME>/bin, run this command:
java java -Dorg.apache.geronimo.server.name=myserver -Djava.endorsed.dirs=lib
/endorsed -javaagent:bin/jpa.jar -jar bin/server.jar
- Launch the administrative console in a browser:
http://localhost:8090/console
 |
Multiple server instances, each with its own repositories
Community Edition V2.0 can be configured so that each server instance has its own repository:
- Create a directory <WASCE_HOME>/myserver, where myserver is the second instance of the server.
- Copy <WASCE_HOME>/var/* to <WASCE_HOME>/myserver/var.
- Create a directory <WASCE_HOME>/myserver/newrepo, where newrepo is the repository for the instance myserver.
- In newrepo.xml, change:
<attribute name="root">newrepo/</attribute>
to
<attribute name="root">myserver/newrepo/</attribute>.
- Edit the myserver/var/config-substitution.properties file. Uncomment the
portOffset line and change its value to 10.
- Start the server.
- Deploy the newrepo.xml run this command:
deploy --port 1109 deploy newrepo.xml.
This command deploys the newrepo.xml file in the current instance of the server and binds the new repository to the new instance of the server. Footprints of the new repository will be present in the default instance of the server, as well as in the new instance of the server -- but it will be running only in the new instance.
To deploy an application on the new instance of the server:
- Launch the administrative console in a browser.
- Select Deploy New and deploy a sample application, for example: mysample.war. The application will be deployed on both the instances but will be running only in the new instance.
- The application can also be deployed using the line command:
deploy deploy --targets %NEWREPO% mysample.war
The application deployed using this method will have footprints only in the new repository.
- To undeploy the application, run the command:
deploy undeploy "%NEWREPO%|default/mysample/2.0.1/war"
Simplified deployment
Enterprise JavaBeans™ (EJB) are the server side components for developing an enterprise application. Development of EJB components has become more complex with each subsequent release of EJB specifications, but with the release of EJB 3.0, things have changed dramatically. Community Edition V2.0 supports EJB 3.0, which uses metadata annotations as an alternative to the deployment descriptor.
In EJB 3.0, all EJBs are Plain Old Java Objects (POJO) with annotations. When an enterprise application is written using EJB 3.0, the Community Edition container automatically generates the deployment descriptor at run time. This eliminates the need for ejb-jar.xml or open-ejb-jar.xml files. (This does not mean that XML has been completely removed. The annotations are overridden if you define both the annotations and deployment descriptor.)
Figure 8. Generation of deployment files using the Community Edition EJB container
Listing 5. EJB application prior to Community Edition V2.0
|- SampleApplication.ear
|- META-INF
|- application.xml
|- geronimo-application.xml
|- SampleApplication.jar
|- ejb-jar.xml
|- SampleApplication.war |
Listing 6. EJB application in Community Edition V2.0
|- SampleApplication.ear
|- META-INF
|- application.xml
|- geronimo-application.xml
|- SampleApplication.jar
|- SampleApplication.war
|
Annotations
Annotations are a new language feature provided as part of JSR-175. A metadata facility for Java Programming Language (JPL), you use annotations in your code in such a way that the behavior of the Web containers are altered according to the metadata information. A simple example is:
Listing 7. Annotation example
@webService
public Class HelloWorld
{
@webMethod
public String hellowworld()
{
return “Hello” ;
}
} |
In this example, the @webService annotation type marks this class as a Web service, and @webMethod marks the hellowworld method as a webMethod. What this means is that, with annotations, the standard web.xml file is now optional. The Servlet 2.5 specification states that annotations can be defined on certain Web components, such as servlets, filters, listeners, and tag handlers. Annotations are used to declare dependency on external resources. The Web container will detect annotations on such components and then inject the necessary dependencies before the component lifecycle is initiated. Annotations act as a request for the container to perform tasks that the servlet would have otherwise performed itself. This is also called dependency injection.
Other annotations that can be used with Web applications include @Resource, @PostConstruct, @PreDestroy, and @EJB.
The advantages to using annotations include:
- Deployment descriptors are optional.
- You can give more attention to business logic.
- Since the request for the container can be put in the code, the overhead cost of synchronizing the deployment descriptor with the code is minimized. For example, exposing a class as a Web service.
- Development time is considerably reduced.
Eclipse plug-in and Eclipse 3.3
The Eclipse plug-in provides integration between Community Edition and the Eclipse Web Tools Project (WTP). You can use the plug-in to develop, test, and debug applications in Community Edition within Eclipse. (The upcoming Eclipse plug-in for Community Edition V2.0 will also support Community Edition V1.1.0.x.)
JAX-WS tools
It's easier than ever to generate the required artifacts for Web services deployment and invocation when you use jaxws-tools, the script for which can be found in:
- Windows: <WASCE_HOME>/bin/jaxws-tools.bat
- UNIX: <WASCE_HOME>/bin/jaxws-tools.sh
To generate JAX-WS artifacts used in JAX-WS Web services (see Resources), invoke this command when the server is started or stopped:
jaxws-tools wsgen
If a service is deployed without WSDL, the server will generate the WSDL automatically upon deployment of the project, meaning that it is not necessary to run the wsgen tool.
To generate the JAX-WS portable artifacts from a WSDL URI use this command:
jaxws-tools wsimport
Updated samples
New and updated sample applications (see Resources) are available to demonstrate some of the new Community Edition enhancements and Java EE 5 features, including applications supplied with Apache Geronimo 2.0 and applications that are unique to Community Edition. Each sample includes source code and pre-built installable files, and a README.txt file (in each sample subdirectory) with instructions to help you use them.
The applications included in the samples distribution include:
-
calculator-stateless-pojo: Demonstrates the EJB 3.0 support provided by OpenEJB 3.0.0 on the server. The application has a stateless session bean, which is used by a simple Web client.
-
cviewer: Web application consisting of a JSP file calling a servlet. The user is presented with a form and inputs a fully qualified classname. Upon form submittal, the servlet will examine the classname and return results to the user.
-
daytrader: Emulates a stock trading storyline, enabling you to look at your portfolio, get quotes, and buy and sell stocks. Deployment is via EAR file.
-
dbdemo1: Web application that accesses the Community Edition_USERS table in a Derby database.
-
EMPdemo: Shows how to access a Derby database, and how to configure access to an external (Oracle or MicroSoft SQL) database. Deployment is via WAR file.
-
file-realm-demo: Demonstrates how to setup security restrictions using a flat file of users and groups.
-
geronimo-jsp-examples: Apache Tomcat provided JSP example applications.
-
geronimo-servlet-examples: Apache Tomcat provided servlet example applications.
-
hello: Simple "hello" JSP Web application.
- jaxws-calculator: Demonstrates how to use the JAX-WS support provided by Axis2 1.3 on the server.
-
jpa: Demonstrates how to use the Java Persistence API (JPA) support provided by OpenJPA 1.0.0 on the server. The application has a JPA Entity Bean, which is used by a simple Web client.
-
jsf: Demonstrates how to use the JavaServer Faces (JSF) support provided by MyFaces 1.2 on the server.
-
ldap-realm: Provides a server-wide LDAP realm configuration plan for ldap-realm-demo. (The pre-built file is provided with this sample, but you must customize it to use your LDAP server.)
-
ldap-realm-demo: Uses the ldap-realm sample to demonstrate how to configure your application using the LDAPLoginModule provided by the server.
-
magicGball: Uses CORBA to communicate between the J2EE application client and the EJB. (Separate plans are provided for secure and unsecure transports.)
-
mdb: Demonstrates how to use a message driven bean with OpenEJB to update a customer database via a Web application or standalone Java applications using ActiveMQ.
-
PlantsByWebSphere: Online store specializing in plants and gardening tools. Customers can open accounts, browse for items to purchase, view product details, and place orders.
-
tomcat-cluster: Web-tier clustering, load balancer, and failover sample for the embedded Apache Tomcat Web container. (This sample requires two physical servers and an Internet connection to download the Apache HTTP Server and mod-jk files.)
-
welcome: The default Welcome application supplied with WebSphere Application Server Community Edition.
 |
Conclusion
IBM WebSphere Application Server Community Edition V2 provides new features and enhancements in many technology areas to help improve and accelerate your application development and deployment. Hopefully, this article has helped provide an overview of the newest version of Community Edition. The Resources below will help you to further learn about and explore more of what Community Edition V2.0 has to offer.
Acknowledgements
Thanks to Donald Woods for reviewing this material and for offering valuable suggestions.
Resources Learn
Get products and technologies
Discuss
About the author  | 
|  |
Ashish Jain is a Software Engineer working for Level 2 Technical Support of IBM WebSphere Application Server Community Edition. He received a Bachelors of Engineering in Computer Science from NITK Surathkal, and joined IBM in 2005 as an ELTP. |
Rate this page
|  |