Friday, March 07, 2008

An example JBoss build and deployment project

[Edit: also see the demo section of the ControlTier Wiki for an up to date version of this]

(It was when I posted these notes to our Google group that I realized that there's real value in being able to post HTML. With that in mind. I'm re-posting here complete with links and formatting!)

These notes document using the ControlTier Elements Solution Library to build and deploy Sun's "Duke's Bank" sample application (from their J2EE 1.4 Tutorial) to JBoss 4.0.3SP1 following the "Getting Started with JBoss 4.0" guide. I've tested the project on Windows 2003 Server R2 and CentOS 4.5 (and it can also be easily adapted to run on other Unix/Linux platforms). You'll need around 4GB of disk space and 1GB of memory on a reasonably up-to-date system.

The basic idea was to implement the instructions from chapter 4 as a Workbench project building and deploying the sample application to a development environment on the (single) node (localhost) that's also running Workbench and Jobcenter.

1) Install
  • Install the latest version of the Java 1.5 SDK available from Sun into "$CTIER_ROOT/pkgs" (for use both by ControlTier - instead of Java 1.4 - and the Dukes Bank application).
  • Create a new ControlTier project called "DukesBank" (JBoss 4.0 J2EE 1.4 "Duke's Bank" sample application project) using Workbench.
  • Download the Elements Solution Library 1.0 seed from Sourceforge and "Import" it using the Workbench administration page (note that you can also check out the library's source and use ProjectBuilder to build and load the library).
2) Configure
  • Configure a ProjectBuilder object and download from Sourceforge and load into Workbench either the Linux or Windows version of the objects as required (note that on Unix/Linux it is assumed installation will occur to "~/dukesbank", while on Windows to "C:\dukesbank") by cutting and pasting the appropriate commands:

    $ ad -p DukesBank -m Deployment -c Register -- -name elements -type ProjectBuilder -basedir $CTIER_ROOT/src/elements -installroot $CTIER_ROOT/target/elements -install
    .
    .
    .
    For more information about this object run: ad -p DukesBank -t ProjectBuilder -o elements -c Get-Properties -- -print
    [command.timer.Deployment.Register: 4.150 sec]

    $ ad -p DukesBank -t ProjectBuilder -o elements -c load-objects -- -format projectxml -filename $CTIER_ROOT/src/elements/demo/DukesBank/objects/linux.xml
    Loading "/home/demo/ctier/src/elements/demo/DukesBank/objects/linux.xml" ...
    1 file(s) have been successfully validated.
    Processing /home/demo/ctier/src/elements/demo/DukesBank/objects/linux.xml to /home/demo/ctier/antdepo/depots/DukesBank/deployments/ProjectBuilder/elements/var/null226801341.xml
    Loading stylesheet /home/demo/ctier/antdepo/depots/DukesBank/lib/ant/modules/ProjectBuilder/lib/load-objects/projectxml/project.xsl
    Mapping XML to properties ...
    Collecting object attributes ...
    Batching object attribute updates ...
    Batching resource and referrer updates ...
    Executing batch update ...
    [command.timer.load-objects: 20.873 sec]
    load-objects completed. execution time: 20.873 sec.

    C:\>ad -p DukesBank -m Deployment -c Register -- -name elements -type ProjectBuilder -basedir %CTIER_ROOT%\src\elements -installroot %CTIER_ROOT%\target\elements -install
    .
    .
    .
    [command.timer.Deployment.Register: 2.359 sec]

    C:\ctier\tmp>ad -p DukesBank -t ProjectBuilder -o elements -c load-objects -- -format projectxml -filename windows.xml
    Loading "C:\ctier\tmp/windows.xml" ...
    1 file(s) have been successfully validated.
    Processing C:\ctier\tmp\windows.xml to C:\ctier\antdepo\depots\DukesBank\deployments\ProjectBuilder\elements\var\null580203106.xml
    Loading stylesheet C:\ctier\antdepo\depots\DukesBank\lib\ant\modules\ProjectBuilder\lib\load-objects\projectxml\project.xsl
    Mapping XML to properties ...
    Collecting object attributes ...
    Batching object attribute updates ...
    Batching resource and referrer updates ...
    Executing batch update ...
    [command.timer.load-objects: 6.906 sec]
    load-objects completed. execution time: 6.906 sec.

  • Download the required third-party packages from the Internet and upload them to Workbench via their "PlatformZip" and "JBossZip" object pages: apache-ant-1.7.0-bin.zip, J2EE 1.4 Tutorial Update 7, jbossj2ee-src.zip (note that you must unpack the required Zip archive from the downloaded Zip), and jboss-4.0.3SP1.zip. (Note: Make sure that you set the DAV directory path to "/pkgs/DukesBank/zip/zips" to match the object XML when uploading the package files).
  • Install the objects:

    $ depot-setup -p DukesBank -a install
    "Install" command running for object: (AntBuilder) development
    "Install" command running for object: (ProjectBuilder) elements
    "Install" command running for object: (Updater) development
    "Install" command running for object: (Site) development
    "Install" command running for object: (JBossServer) development

    C:\>depot-setup -p DukesBank -a install
    "Install" command running for object: (AntBuilder) development
    "Install" command running for object: (ProjectBuilder) elements
    "Install" command running for object: (Updater) development
    "Install" command running for object: (Site) development
    "Install" command running for object: (JBossServer) development
  • Download the sample job definitions from Sourceforge and install them into Jobcenter using "Upload Job XML File ..." via the "Create a new Job ..." page.
3) Run
  • Deploy the packages that support building the application using Ant and deploy and start the empty JBoss server instance (you'll be able to pick up the JBoss server page at http://localhost:8180 since JBoss is configured to run on non-default ports to avoid colliding with Workbench):

    [jboss@development dukesbank]$ ad -p DukesBank -t Updater -o development -c Deploy -- -resourcetype 'AntBuilder|Site'
    Start: "Run the coordinated deployment cycle across the configured Sites." commands: dispatchCmd
    begin workflow command (1/1) -> "dispatchCmd -command Deploy -resourcename .* -resourcetype AntBuilder|Site" ...
    dispatching command: "Deploy " to: (AntBuilder) development, (Site) development ...
    .
    .
    .
    dispatched command: Deploy completed for: (AntBuilder) development, (Site) development
    end workflow command (1/1) -> "dispatchCmd -command Deploy -resourcename .* -resourcetype AntBuilder|Site"
    [command.timer: 29.828 sec]
    Completed: execution time: 29.828 sec

    C:\>ad -p DukesBank -t Updater -o development -c Deploy -- -resourcetype "AntBuilder|Site"
    Start: "Run the coordinated deployment cycle across the configured Sites." commands: dispatchCmd
    begin workflow command (1/1) -> "dispatchCmd -command Deploy -resourcename .* -resourcetype AntBuilder|Site" ...
    dispatching command: "Deploy " to: (Site) development, (AntBuilder) development ...
    .
    .
    .
    dispatched command: Deploy completed for: (Site) development, (AntBuilder) development
    end workflow command (1/1) -> "dispatchCmd -command Deploy -resourcename .* -resourcetype AntBuilder|Site"
    [command.timer: 41.531 sec]
    Completed: execution time: 41.531 sec

    (Note that this command can also be run from Jobcenter using the "development.Deploy" job and setting the "resourcetype" to "AntBuilder|Site" from the "Choose Options and Run Job ..." page).
  • Edit the client JNDI properties file in the J2EE Tutorial source to adjust the hard-coded naming provider port (this is necessary since JBoss is deployed using non-default ports to avoid colliding with Workbench):

    $ pwd
    .../dukesbank/j2eetutorial14/examples/bank/dd/client
    $ diff jndi.properties jndi.properties.orig
    3c3
    < url="jnp://localhost:1199"> java.naming.provider.url=jnp://localhost:1099
  • Run the application build and deployment cycle to build the Duke's Bank application from source, initialize the database schema and deploy to JBoss:

    $ ad -p DukesBank -t Updater -o development -c BuildAndDeploy -- -buildstamp 20080222.0
    Start: "Run the coordinated end-to-end the build and deployment processes across the configured Builders and Sites.." commands: Build,Change-Dependencies,Deploy ...
    begin workflow command (1/3) -> "Build -buildstamp 20080222.0" ...
    Start: "Run the coordinated build cycle across the configured Builders." Beginning build process with the following builders: (AntBuilder) development ...
    workflow command (1/1) -> "dispatchCmd -buildstamp 20080222.0 -command Build -resourcetype [^\.]*Builder -dispatchOptions buildstamp" ...
    .
    .
    .
    Completed: execution time: 31.322 sec
    end workflow command (3/3) -> "Deploy -buildstamp 20080222.0"
    [command.timer.DukesBank.Updater.development.BuildAndDeploy: 2:14.950 sec]
    Completed: End-to-end build and update process completed: Build,Change-Dependencies,Deploy. execution time: 2:14.950 sec

    C:\>ad -p DukesBank -t Updater -o development -c BuildAndDeploy -- -buildstamp 20080222.0
    Start: "Run the coordinated end-to-end the build and deployment processes across the configured Builders and Sites.." commands: Build,Change-Dependencies,Deploy ...
    begin workflow command (1/3) -> "Build -buildstamp 20080222.0" ...
    Start: "Run the coordinated build cycle across the configured Builders." Beginning build process with the following builders: (AntBuilder) development ...
    workflow command (1/1) -> "dispatchCmd -buildstamp 20080222.0 -command Build -resourcetype [^\.]*Builder -dispatchOptions buildstamp" ...
    .
    .
    .
    Completed: execution time: 11.313 sec
    end workflow command (3/3) -> "Deploy -buildstamp 20080222.0"
    [command.timer.DukesBank.Updater.development.BuildAndDeploy: 2:06.844 sec]
    Completed: End-to-end build and update process completed: Build,Change-Dependencies,Deploy. execution time: 2:06.844 sec

    (Note that this command can also be run from Jobcenter using the "development.BuildAndDeploy" job and setting the "buildstamp" from the "Choose Options and Run Job ..." page).
If you don't want to go through this setup process, I've prepared a CentOS 4.5 VMware virtual machine with the demonstration installed and ready to roll that I plan to post to Sourceforge imminently. I'll also post the DukesBank project archive file if you'd like to avoid the type/object model setup steps and cut right to the chase finishing up configuration and running the demonstration.

Thanks,

Anthony.

23 comments:

Anonymous said...

Can anyone recommend the well-priced Remote Management & Monitoring system for a small IT service company like mine? Does anyone use Kaseya.com or GFI.com? How do they compare to these guys I found recently: [url=http://www.n-able.com] N-able N-central it outsourcing
[/url] ? What is your best take in cost vs performance among those three? I need a good advice please... Thanks in advance!

Unknown said...

Hi,
I'm a beguinner in controlier and zenoss.
I just want to know how i can connect controltier
and zenos so that controltier can be aware if zenoss sends its alerts.
Thanks

Unknown said...

Hi again,
I also, how controltier can send command to zenoss?

Damon Edwards said...

Hi Daouda,

The best place to get help with ControlTier is the the ControlTier Google Group:
http://groups.google.com/group/controltier

markson said...

An ever increasing number of experts take this test each year to test their abilities. ExcelR PMP Certification

digitaltucr said...

Great Information sharing .. I am very happy to read this article .. thanks for giving us go through info.Fantastic nice. I appreciate this post.ExcelR pmp certification Bangalore

Neethuuu said...

Very helpful.
PMP Certification in malaysia
pmp course in malaysia
pmp training in malaysia

360digiTMG said...

I feel very grateful that I read this. It is very helpful and very informative and I really learned a lot from it.
360digiTMG data science course in guduvanchery

Unknown said...

Just saying thanks will not just be sufficient, for the fantastic lucidity in your writing.
pmp training in hyderabad

360digitmgas said...

Excellent Blog! I would like to thank for the efforts you have made in writing this post. I am hoping the same best work from you in the future as well. I wanted to thank you for this websites! Thanks for sharing. Great websites! data analytics certification training course in coimbatore

Priya Rathod said...

I really enjoyed while reading your article, the information you have mentioned in this post was damn good. Keep sharing your blog with updated and useful information.
DevOps Training in Hyderabad
DevOps Course in Hyderabad

Tom said...

Thank you 😊 The international travelers who traveling to Kenya need visas Kenya check kenya entry requirements. That they can apply online and can get the 24*7 customer assistant.

Lara said...


Great article this is really informative and innovative: with new updates.with new updates. It was really valuable. Thanks a lot. Travelers can easily apply online for evisa India. Thus the Government of India has provided an easy-to-use method to apply for visas through a simple online Indian visa application form.

Rebecca Grundy said...
This comment has been removed by the author.
Rebecca Grundy said...

Excellent post..... India visa for Australian citizens, Australian nationals require a valid visa for entry into India, Australian citizens can obtain online indian evisa via Indian visa website.

Unknown said...

Hey There. I found your blog using msn. This is a very well written article. I’ll be sure to bookmark it and come back to read more of your useful info. Thanks for the post. I’ll definitely return. data science course in kanpur

isabella said...

Thanks for all you do. I like the website themes and layout, you are posting amazing blogs.... (Overseas Citizenship Of India Services) OCI card application online process. You can apply for an OCI card online and you can read all the info related to OCI(Overseas Citizenship Of India Services) card via the Indian visa website.

sivakumar said...

Two full thumbs up for this magneficent article of yours. I've really enjoyed reading this article today and I think this might be one of the best article that I've read yet. Please, keep this work going on in the same quality.data science training in rohtak

Lucas mia said...

I am really thankful to the owner of this web page who has shared this wonderful writing at this place.Do you know Digital marketing strategy & types of digital marketing? No, If you have any query related to Digital marketing services then visit our website will get complete information related to your query.

Edison Berg said...

Hello guys, many people ask, how can I apply for a visa? You can e visa apply online. And your visa processing time depends on your nationality and your visa type.

henryisabella said...

The most beautiful places in Turkey. Turkey is home to an array of breathtakingly beautiful places that showcase the country's rich natural and cultural diversity. Cappadocia stands out as one of the most enchanting destinations, with its surreal rock formations, known as fairy chimneys, and the opportunity to float above the stunning landscape in hot air balloons.

henryisabella said...

The evisa Kenya official site is the designated online platform for seamless visa applications to this captivating African destination. By visiting our website , individuals can access the necessary forms and guidelines to complete their visa application process with ease.

henry milton said...

I'm delighted to have discovered this treasure trove of valuable insights. It's the kind of manual that should be widely shared, not the false information that's often found on other blogs. Also, I'd like to shed light on the Festivals Luring Tourists to Saudi Arabia. Saudi Arabia's vibrant festivals, such as the Riyadh Season, Jeddah Season, and the Diriyah Season, are enchanting tourists with a blend of culture, entertainment, and heritage, creating unforgettable travel experiences.