Essential ATG Dynamo Training - Got atg Certified Relationship Management Developer?
This is not an official ATG site: ATG, Dynamo, Scenario Server and Personalization Server are trademarks or registered trademarks of Art Technology Group
Articles Exercises Resources Links Search

J2EE Applications in Dynamo 5.5

Summary

This article goes through the steps to deploy a simple "Hello world" j2ee application. The application consists of a single helloworld.jsp file:

helloworld.jsp

<HTML>
<TITLE>Hello World!</TITLE>
<BODY>
  <H1>Hello There!</H1>
  <P>Today's date is <%= (new Date()).toString()%></P>
</BODY>
</HTML>

Instructions

The instructions are based on the ATG training course lab instructions provided by ATG's talented curriculum development team.

  1. Start Dynamo 5.5 and the ACC
  2. Login to the localhost port 8860 with the ACC (admin/admin)
  3. Select Tools from the ACC menu
  4. Select J2EE Deployment
  5. Select Create New J2EE Application from the File menu
  6. Fill in HelloWorldProject and HelloWorldApplication
  7. Double-click the HelloWorldApplication under the HelloWorldProject
  8. Click Web Modules in the tree view
  9. Enter web-app as the Web Module Name
  10. Click Create Empty Web Module:web-app.war, to create the web application archive...
  11. Click on web-app.war, choose the Server tab, and enter hello as Context Root. This string will form the basis of the URLs used to access your application. So that http://localhost:8840/hello will map to the root of your web application. This has to be unique amongst all the applications on the server so they don't fall over each other.
  12. Add a new helloworld.jsp file to your web application. To do this create the file in the web application folder on your dynamo machine. In our case this will be:
    C:\ATG\Dynamo5.5\HelloWorldProject\j2ee-apps\HelloWorldApplication\web-app.war
    This is actually a folder not a file! Also notice where our J2EE project and application names figure in this path name: HelloWorldProject is the Dynamo module name and HelloWorldApplication is a j2ee application within that module.
    Once you have the file, copy the JSP code listed at the top of this document into it and then save the file.
  13. To tell the server that helloworld.jsp is the default page for this application, add helloworld.jsp to the Welcome File List, thus:
    ,
  14. Save the configuration: Select File -> Save Current Configuration
  15. Build the application: Select Tools -> Build Application. This validates everything and ensures that all the application dependencies are resolved (We don't have any). If there are no errors you should see the following:
  16. Close the output window and start the application in the server:
    Select Tools -> Start J2EE Application
  17. Test the application: Visit http://localhost:8840/hello
  18. The application is currently running out of the staging directory. To deploy your application onto another Dynamo you should build the .dar file and deploy that file. The steps to achieve this are described below. Only do this once you have 'finished' you application.

Deploying your application on another Dynamo

  1.  Open your J2EE application in the ACC
  2. Build a Dynamo Archive (the .dar) file: Select Tools -> Save to Local DAR File.

  3. Copy the .dar file to the target Dynamo machine
  4. Connect the ACC to the target Dynamo machine.
  5. Select Tools from the ACC menu
  6. Select J2EE Deployment
  7. Select Install J2EE Application from Local Archive from the File menu
  8. Fill in the Project Name, Application Name and browse to select the .dar file you just copied.
    If you are just testing this out on the same machine, enter different J2EE Project and Application Names than before (e.g. DeployedHelloWorldProject and DeployedHelloWorldApplication):
  9. Double-click the new DeployedHelloWorldApplication under the DeployedHelloWorldProject
  10. If you are deploying on the same server as you staged the application...
    Rename the application: Click on HelloWorldApplication in the tree view and change both the Display Name and the Dynamo Application Name to DeployedHelloWorldApplication. Save the application by clicking on the disk icon or using the File menu
  11. Select the web-app.war under Web Modules in the tree view. Check the Context Root on the Server tab. Change it to deployed_hello if you are doing all of this on the same machine, so you can differentiate it from the staged version:
  12. Save the configuration: Select File -> Save Current Configuration
  13. Build the application: Select Tools -> Build Application. This validates everything and ensures that all the application dependencies are resolved (We don't have any). If there are no errors you should see the following:
  14. Close the output window and start the application in the server:
    Select Tools -> Start J2EE Application
  15. Check the ATG screen log for errors:
    **** info Mon Oct 01 19:13:25 PDT 2001 1001988805811
    /atg/dynamo/service/j2ee/J2EEContainer
    atg.j2ee.container.J2EEContainerResources->loadingApplication : Loading
    J2EE application from: C:\ATG\Dynamo5.5\DeployedHelloWorldProject\j2ee-apps
    \DeployedHelloWorldApplication
    **** info Mon Oct 01 19:13:25 PDT 2001 1001988805811
    /atg/dynamo/service/j2ee/Darina Stage directory: 
    C:\ATG\Dynamo5.5\DeployedHelloWorldProject\j2ee-apps\
    DeployedHelloWorldApplication
    **** info Mon Oct 01 19:13:26 PDT 2001 1001988806001
    /atg/dynamo/service/j2ee/Darina Validating configuration
    **** info Mon Oct 01 19:13:26 PDT 2001 1001988806021
    /atg/dynamo/service/j2ee/Darina Successfully validated configuration.
    **** info Mon Oct 01 19:13:26 PDT 2001 1001988806041
    /atg/dynamo/service/j2ee/Darina Merging specifier data into base J2EE
    configuration.
  16. Test the deployed application: Visit http://localhost:8840/deployed_hello
  17. Check out the files you created deploying the new application

There you go! Notice that your staging version is still running fine too, just under a different context root.



Technical Training Advertise your Training Programs for Free! Los Angeles Web Design Shopping Cart Software  Form a Corporation