Thursday Oct 12, 2006

GlassFish works on Windows Vista!

GlassFish works on Windows Vista![Read More]

Thursday Aug 31, 2006

GlassFish V2 Lightweight!

GlassFish V2 Quick Downlables.[Read More]

Wednesday Aug 09, 2006

GlassFish V2 with Clustering Features

GlassFish V2 with Clustering Features[Read More]

Wednesday Mar 22, 2006

GlassFish Builds on Hudson

GlassFish Builds with Hudson
GlassFish Build Monitoring using Hudson
Contents:
Introduction
Building and Monitoring GlassFish
Hudson Details


Introduction

GlassFish is the name for the open source development project for bulding a Java EE 5 application server. It is based on the source code for Sun Java System Application Server PE 9 donated by Sun Microsystems and TopLink persistence code donated by Oracle.

You can find complete build instructions here - How to build GlassFish and the other build resources like GlassFish Build Blog and GlassFish with Netbeans Blog for building GlassFish server easily.

We have deployed Web Application Hudson, which is open source java.net project by itself. Hudson is deployed on GlassFish Server on promoted build #41 of GlassFish . Hudson application monitors executions of repeated jobs, such as building a software project or jobs run by cron.

Building and Monitoring GlassFish Builds:

The job "glassfish" is created on the publicly available host : glassfishbuildtools.sun.com and can be accessed from http://glassfishbuildtools.sun.com:8000/hudson/job/glassfish/

Essentially, it executes following shell commands configured in hudson application.
% cd glassfish/bootstrap
% maven checkout bootstrap-all build configure-runtime    
% maven checkout-quicklook
% export APS_HOME=$PWD/../appserv-tests;
% export S1AS_HOME=$PWD/../../publish/glassfish;
% cd $APS_HOME;
% maven runtest
Second command above checks out the sources using maven tool, which is build tool for GlassFish workspace, downloads all binary components and builds all source modules and finally it configures the server image to be able to run and deploy JavaEE applications on GlassFish Server.

Next "maven checkout-quicklook" checks out Quicklook test which covers most of the component level tests, and sets required variables like APS_HOME, S1AS_HOME and runs the tests using "maven runtest"

Hudson Details:

We can find most of the Features and Benefits of Hudson application from its project home page, Hudson on java.net. But main features that I wanted to specify here are "Console Output" and "Change Log"
  • For monitoring GlassFish Build status,  click on the first link of build number which is blinking circle for current build status. The output of the last build can be found from its Status Link on the Left hand side, and click on second build number from the top which is last completed build number, and click on "Console Output" link to see the complete build log.
  • "Changes" link on the status page will show the latest checkin integrated for this build.
Here is the screen shot of Hudson application deployed on GlassFish Server to monitor GlassFish regular builds.

GlassFish on Hudson



Tuesday Feb 28, 2006

How to improve GlassFish easily -- using NetBeans 5.5

GlassFish build with NetBeans 5.5 Preview
How to improve GlassFish easily -- using NetBeans 5.5

Contents
Get NetBeans 5.5
Checkout GlassFish Project, and configure Server Image
Add & Start GlassFish Server in NetBeans
Modify the Source Code and Build GlassFish Project using NetBeans
Verify the changes Quickly in GlassFish Server

Following are the detailed steps to develope GlassFish with NetBeans IDE.
  • Get NetBeans 5.5 : Download Netbeans 5.5 and install it to develope GlassFish Application Server.  Netbeans installation process is pretty easy and straight forward, just follow the installer.

Netbeans Install

  • Checkout GlassFish Project, and configure Server Image
Checkout Glassfish bootstrap module as below:
% cvs -d <java.net-ID>@cvc.dev.java.net:/cvs glassfish/bootstrap
% cd glassfish/bootstrap

Checkout project: appserv-core and install/configure GlassFish Server image by running following command, more details on GlassFish builds.
% maven -Dmodules=appserv-core checkout bootstrap configure-runtime

Maven Checkout Core

  • Add & Start GlassFish Server in NetBeans
Now we have GlassFish Application Server image, called as ${glassfish.home} in this document later as GlassFish documents. We have checked out appserv-core module in GlassFish, so we will modify the code and build the workspace using NetBeans IDE.

Open the IDE by running  <ws>/netbeans-5.5preview/bin/netbeans command. In the "Runtime" tab, you will see Tomcat and Sun Java System Application Server in the "Servers" tree, add "GlassFish" Server to test your newly installed GlassFish server from ${glassfish.home} and start the server by right clicking GlassFish Server name and select "Start" menu. You will see the server log messages in the bottom of the IDE window.

AddnStartGFServer

  • Modify the Source Code and Build GlassFish Project using NetBeans
Now open project appserv-core using NetBeans 5.5 IDE from the GlassFish Workspace,  in Netbeans "File" menu, go to "Open Project.." and select "appserv-core" directory from GlassFish workspace that we checked out earlier.
Goto "src\\java" source tree and select package "com.sun.enterprise.server" and double click on PEMain.java and goto line at the log message string variable: "pemain.startup.complete" (for message "Application server startup complete"). Add few messages using System.out.println statements so that it will be displayed on the output or log file.
Now right click on "Sun... glassfisher core" project and select "Build Project" from the menu, you will be able to build appserv-core project as below.

Core Build Complete

  • Verify the changes Quickly in GlassFish Server
Now you can start the GlassFish Server, you should be able to see the new added output lines around the "Application server startup complete" message in PEMain.java which is the main launcher java program for GlassFish Server.

Done!

This illustrates the full IDE support of NetBeans 5.5 to improve GlassFish Server in your developement environment which provides:
  • Administration - Add, Stop, Start Server Instance.
  • Ease of Development - Write source code, Compile, Build, Install, Configure GlassFish workspace.

Friday Feb 17, 2006

GlassFish Build

GlassFish  Build made Easy GlassFish


Introduction:

Welcome to the wonderful world of GlassFish! GlassFish is the name for the open source development project for bulding a Java EE 5 application server. It is based on the source code for Sun Java System Application Server PE 9 donated by Sun Microsystems and TopLink persistence code donated by Oracle. It is the response to Java developers who want access to the source code and the ability to contribute to the development of Sun's next generation application server which is based on GlassFish. This project is designed to encourage communication between Sun and Oracle engineers and the community and will enable all developers to participate in the application server development process.

This document will focus on the glassfish project workspace and will show you how to:

  • Check out the latest GlassFish development sources from CVS
  • Setup your build environment
  • Build GlassFish
  • Start and verify the Server
  • Execute the Quicklook tests

To follow the GlassFish workspace, simply read the sections in order and perform the tasks which each section defines.

Requirements:

First of all, you need to sign up to get java.net User ID from GlassFish developers community https://glassfish.dev.java.net. Glassfish workspace is built using Apache Maven 1.0.2. All GlassFish modules use Maven as a build tool, which replaces gmake. Maven is available on all platform supporting Java.

Build tools requirement to start working with GlassFish workspace:
    • Apache Maven 1.0.2  as a build framework replacing gmake/shell scripts
    • JDK 1.5.0_06 or later, and define JAVA_HOME, and add into executable PATH variable.
    • Setup CVS Client for checking out sources from java.net CVS Repository, so users need to login the repository.
Following OS specific requirements:
    • A UNIX (posix) or Windows (win32) compatible operating system.
    • Sun Solaris 9, 10 (SPARC) Solaris 9, 10 (x86) Memory: 512 MB, Disk Space: 250 MB free
    • 64–bit Sun Solaris 10 (SPARC, x86) : Memory 512 MB, Disk Space: 250 MB free
    • Redhat Enterprise Linux 3.0 U1, 4.0 : Memory 512 MB, Disk Space- 250 MB free 
    • Windows Server 2000 SP4+, Windows 2000 Advanced Server SP4+, Windows Server 2003, Windows XP Pro SP1+ : Memory 1 GB, Disk Space 500 MB free
    • MAC OS X (not for standalone Platform Edition; via Tools only) : Memory 512 MB, Disk Space 250 MB free 
Build Flexibility
  • It is possible to check out and build each independent module separately. Also it is be possible for a module engineer (e.g. appserv-webtier) to just check out the relevant module files instead of the checking out the entire workspace.
  • It is possible to build the entire source tree from a top level directory / workspace from glassfish/bootstrap.
  • It doesn't require developer to download and setup any tools other than Maven, JDK, and CVS client.
  • Maven is new, evolving build tool so can utilize the new developements in maven by applying the same to GlassFish workspace.
  • There is a facility for obtaining a "binary" module (i.e. one whose source code is not available) from the remote repository. Its flexible to add any third party dependencies by staging the binary into the Remote repository and edit configuration files, and developer is free to download and use any number of binary modules on the project.
  • Developers don't have to compile and build every dependent module. Instead it is possible to retrieve a pre-compiled and tested version of the module. They are also be able to download an entire Glassfish installation (called Glassfish image) and build the module against it using "maven bootstrap" build type.
  • The build environment must be completely reproducible meaning that all tools and external modules used in the build environment can be retrieved from a known location.
  • Workspace doesn't depend on any shared server or remote network directory.
Checkout the Sources:

You can get the sources for the glassfish project from CVS. To get the sources from CVS, follow the instructions on the CVS page to get and setup your CVS client. Once you have done that you can check out the module:

% cvs -d :pserver:dpatil@cvs.dev.java.net:/cvs checkout glassfish/bootstrap

You should see output similar to:

U glassfish/bootstrap/ant-common.xml
U glassfish/bootstrap/appserv-admin.mf
U glassfish/bootstrap/appserv-cmp.mf
U glassfish/bootstrap/appserv-deployment-client.mf
U glassfish/bootstrap/appserv-ext.mf
U glassfish/bootstrap/appserv-rt.mf
U glassfish/bootstrap/build.xml
U glassfish/bootstrap/glassfish.subcomponent.properties
U glassfish/bootstrap/glassfish.xml
U glassfish/bootstrap/j2ee-jar.mf
U glassfish/bootstrap/javaee-jar.mf
U glassfish/bootstrap/maven.xml
. . .
U glassfish/bootstrap/legal/3RD-PARTY-LICENSE.txt
U glassfish/bootstrap/legal/BinariesLicense
U glassfish/bootstrap/legal/CDDLv1.0.txt
U glassfish/bootstrap/legal/COPYRIGHT
U glassfish/bootstrap/legal/LICENSE.txt
U glassfish/bootstrap/legal/README
. . .

To get the source for the AS9_BETA_BRANCH Branches use one of the following commands:
% cvs -d :pserver:dpatil@cvs.dev.java.net:/cvs checkout -r AS9_BETA_BRANCH glassfish/bootstrap

Create  glassfish/bootstrap/build.properties or for re-usable GlassFish workspace, one-time process is to create ${HOME}/build.properties (Unix)  or %HOMEPATH%\\build.properties (Windows) and  set following variables:
glassfish.os.name= // The OS name - possible values are WINNT, SunOS, Linux, SunOS_X86, Darwin
glassfish.cvs.username= // The java.net id that will be used to checkout the source code.

Once you have checked out glassfish/bootstrap module, do following step to checkout all modules.

% cd glassfish/bootstrap
% maven checkout

Now you will have glassfish directory with a sub-directory layout similar\* to this:

activation            appserv-http-engine   CVS                   mail
admin                 appserv-jstl          deployment-api        management-api
admin-cli             appserv-native        ejb-api               persistence-api
admin-core            appserv-webtier       entity-persistence    pwc-commons
admin-gui             avk                   jacc-api              servlet-api
annotation-framework  bootstrap             jacc-provider         tools
appserv-addons        cmp                   jdbcra                transaction-api
appserv-commons       common-util           jms-api               webtier-extensions
appserv-core          connector-api         jmx-remote
appserv-docs          container-auth        jts

\* The exact directory layout will change as modules are added or removed from the project. As long as there were no problems durring the checkout everything should be fine.

Understand Your Build Environment

Now that you have the sources you might want to browse through the workspace to become more comfortable with the module and directory structure. The sub-directories inside of glassfish/ are each module directories (except for the CVS/ directory, which we will ignore from now on).  Each module contains the same basic layout with a few exceptions, which you are about to learn.

The bootstrap module is a special module which contains top level build scripts, property files to specify binary libraries and other files which are required for the the build system to function. Unless you are adding new functionality to the build system or updating a binary dependency, you can safely ignore it. This module controls the building of all other modules and is responsible for generating project release directory called ${glassfish.home} and SNAPSHOT files like glassfish-image-SNAPSHOT.jar for installable application server image..

All of the other modules follow a standard layout and usually contain source files in the src/java sub-directory.
Each module has a maven.xml, project.xml, project.properties and build.xml files.
build.xml : the build control file and contains all of the information, targets and tasks to build the module.
other maven build files which are wrappers to build.xml and used for building from top level build module bootstrap using maven tool.

The build system is based on Maven which calls Ant scripts in each module. To build complete GlassFish workspace  you will have to start build from glassfish/bootstrap module.

Once you are comfortable we can start building. As a mandatory configuration step, you need to  pre-initialize the build system and define or set some user local properties like your java.net userid as glassfish.cvs.user and glassfish.os.name. These two variables can be defined in a glassfish/bootstrap/build.properties file or user's home directory ~/build.properties. This file allows you to change how the build system works with on different platform. If this is the first time you are building the sources you might want to look at detailed Glassfish Build Instructions if you run into problems.

GlassFish can be build with NetBeans or using the command line options.  The article has more information on building and developing the GlassFish project with NetBeans.  Command line options for building GlassFish are below.

Build GlassFish
You need to define 2 properties to build the workspace in ${HOME}/build.properties to do Initial Configuration.
glassfish.os.name= The OS name, values can be WINNT, SunOS, SunOS_X86, Linux, Darwin
glassfish.cvs.username=<java.net -id>

Use following command to login to java.net CVS at least once so build checks out sources from java.net repository.
% cvs -d :pserver:<java.net-id>@cvs.dev.java.net:/cvs login

Building entire GlassFish workspace:


% mkdir workspace
% cd workspace
% cvs -d :pserver:<java.net-id>@cvs.dev.java.net:/cvs co glassfish/bootstrap
% cd glassfish/bootstrap
% maven bootstrap-all checkout build

This may take minutes or hours depending on how fast (or slow) your computer is. On an Sun LX50 x86 running solaris 9 it takes about 20 minutes.  The output of the build look something like this:

You may see some warnings durring the build, probably due to the usage of deprecated methods or something, but you can safely ignore those. If everything built with no errors you should see a BUILD SUCCESSFUL message at the end (as shown above).

Checking out a subset of the workspace and build it:
The following steps will checkout a subset of the source, build it. Command: maven bootstrap will download already build glassfish server image (i.e.unzip glassfish-image-SNAPSHOT.jar) and update the server with your new changes.
% mkdir workspace
% cd workspace
% cvs -d :pserver:<java.net-id>@cvs.dev.java.net:/cvs co glassfish/bootstrap
% cd glassfish/bootstrap
% maven checkout -Dmodules=appserv-webtier,webtier-extensions bootstrap build

so your workspace will look like this after the complete build.
cd /workspace
        |--- glassfish_dependencies  (downloaded binaries)
        |--- glassfish (module sources)
        |--- publish/glassfish (server image)

Following 2 variables are defined by default referencing from ${glassfish.root} which is root directory e.g. /workspace as above.
glassfish.home=${glassfish.root}/publish/glassfish
maven.repo.local=${glassfish.root}/glassfish_dependencies

Start GlassFish Server

To Configure the GlassFish Server runtime: following step will create the asadmin script (CLI utility to administer application server), run create-domain, etc which are needed to run the GlassFish server.
    % cd glassfish/bootstrap
    % maven configure-runtime (Default is silent installation)
All GlassFish server commands are located in the ${glassfish.home}/bin directory.  For more documentation on how to administer the application server domain and instances please refer to the documentation for the Sun Java System Application Server PE. 
To Start the Application Server, follow the steps below:
  • Add the install-dir/bin/ (in this case its ${glassfish.home}/bin) directory to the PATH environment variable.
  • Start the server by entering this command: asadmin start-domain domain1.
When the server has started, this message appears:
Domain domain1 is ready to receive client requests. Additional services are being started in the background.

To verify GlassFish server is running on your system, click this URL: http://localhost:8080.
Refer to GlassFish Quickstart Guide for deploying and running a sample application.

Run the Quicklook Tests

Quicklook tests are breadth tests with high-level coverage of many functions in the Application Server. They are meant to give the developer a way of testing major functionality in the Application Server and of running a sanity check to ensure that nothing major is broken.

To run the Quicklook tests:

  1. Install GlassFish or get the server image (${glassfish.home}) bootstrapped using maven bootstrap
  2. Checkout the Quicklook tests
  3. cd workspace (directory where you have the server code)
    cvs -d :pserver:<userid>@cvs.dev.java.net:/cvs checkout glassfish/appserv-tests
  4. Environment settings and permissions:
    • Set the proper environment variables in your .cshrc, or .bat file:
    • Set APS_HOME. This is the directory where you checked out the workspace including the workspace root name (e.g. /workspace/appserv-tests)
    • Set S1AS_HOME. This is installation directory for the Application Server (e.g. /Sun/Appserver)
    • Set JAVA_HOME. This is directory where you installed JDK 5 (e.g. /Sun/jdk1.5.0_01)
    • Set MAVEN_HOME. This is installation directory for Maven 1.0.2 (e.g. /workspace/maven-1.0.2).

    On Unix:  setenv PATH $S1AS_HOME/bin;$JAVA_HOME/bin;$MAVEN_HOME/bin;$PATH
    On Windows: set PATH=%S1AS_HOME%/bin;%JAVA_HOME%/bin;%MAVEN_HOME%/bin;%PATH%

  5. Modify the installation properties under ${APS_HOME}/config.properties to match your installation (e.g. admin.password, http.port, etc.)
  6. Run the test:
    % cd $APS_HOME
    % maven runtest
  7. Open the ${APS_HOME}/test_results.html file in a browser and examine the results, total test count is 50.
What's Next:

Great! You should be proud of yourself for getting this far. As for what you will do next, only you really know that. We suggest reading over the Glassfish Build System Guide, the GlassFish FAQ to get the full view of the build system.

If you are looking for other non-build system developer docs, you can probably find them in the guides section.

Be sure to check out the Project Info for GlassFish on java.net as well as the Contributors Guide.

If you have any ideas, suggestions to enhance on any of the above build steps like some of the ideas listed on GlassFish Enhancement document, just drop an email to dev@glassfish.dev.java.net.

Good luck, happy coding and remember we love you!

About

dpatil

Search

Categories
Archives
« April 2014
SunMonTueWedThuFriSat
  
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
   
       
Today