Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Configuring GEP to publish POJO projects as shared library is illustrated below using a web application and adding a POJO project as a dependency:

  1. Create a HelloWorld Dynamic Web project as given in

Setup:
Sun Java v1.5.0_11 + Apache Geronimo v2.0.2
Eclipse 3.3.1 + WTP2.0.1 + Geronimo Eclipse Plugin v2.0

...

  1. <link to be added here>

...

  1. .

...

...

  1. Create a POJO project

...

  1. as given below:
    • Click File -> New -> Project

...

    • .
    • Select

...

    • Java Project

...

    • and click

...

    • Next

...

    • .
    • Enter

...

    • CurrencyConverterPojo

...

    • as the project name and click

...

    • Finish

...

    • . (If asked to switch to Java perspective, you

...

    • may select

...

    • No

...

    • ).
    • In

...

    • Project Explorer

...

    • view, right-click on

...

    • CurrencyConverterPojo, select New -> Class

...

    • .
    • Enter

...

    • myPackage

...

    • as package name

...

    • , CurrencyConverter

...

    • as class name

...

    • and click Finish

...

    • .
    • Replace the

...

    • content of CurrencyConverjer.java with the contents

...

...

    • .
    • Press

...

    • Ctrl + S

...

    • to save changes.

...

  1. Add POJO project into web-app's Java Build Path as given below:
    • In

...

    • Project Explorer

...

    • view, right-click on

...

    • HelloWorld

...

    • , and click

...

    • Properties

...

    • .
    • Click

...

    • Java Build Path

...

    • and then switch to

...

    • Projects

...

    • tab.
    • Click

...

    • Add

...

    • . Select

...

    • CurrencyConverterPojo

...

    • as the project to be added

...

    • and click OK

...

    • . Click

...

    • OK

...

    • again.

      Image Modified

...


  1. To use POJO inside

...

  1. web-app's index.jsp:
    • Double click on HelloWorld -> WebContent -> index.jsp

...

    • to open it in

...

    • JSP editor.
    • Add

...

    • the following code before the </body> tag.
      Code Block
      
      <br>100 USD == <%= myPackage.CurrencyConverter.dollarToRupees(new java.math.BigDecimal(100.0)) %>

...

    •  INR
    • Press
    • Ctrl + S

...

    • to save the changes.

...

  1. Enable in-place shared library support in Server editor as given below:
    • In

...

    • Servers

...

    • view, double click on

...

    • Apache Geronimo v2.

...

    • 1 Server at localhost to open the server editor.
    • In the server editor, under

...

    • Test Environment

...

    • , select

...

    • Enable in-place shared library support.

...


...


    • Image Added

    • Press Ctrl + S to save the changes.
  1. To add

...

  1. a dependency on

...

  1. org.apache.geronimo.configs/sharedlib//car

...

  1. in geronimo-web.xml:
    • Double click on

...

    • HelloWorld -> Web Content -> WEB-INF -> *geronimo-web.xml" to open it in Geronimo Deployment Plan Editor.
    • In

...

    • General

...

    • tab, select

...

    • Add a run time dependency to Geronimo's shared library

...

    • .

      Image Added
    • Press "Ctrl+S" to save the file.
      Note

      In

...

    • Source

...

    • tab, a dependency on geronimo/sharedlib//car would be added as below:

...

    • Code Block
      
      <sys:dependency>

...

    • 
          <sys:groupId>geronimo</sys:groupId>

...

    • 
          <sys:artifactId>sharedlib</sys:artifactId>

...

    • 
          <sys:type>car</sys:type>

...

    • 
      </sys:dependency>

...

    • 
      

      This

...

    • is due to a current bug in Geronimo Deployment Plan Editors

...

    • . Change <sys:

...

    • groupId> from geronimo to org.apache.geronimo.

...

    • configs and press Ctrl + S

...

    • to save the changes.

Step-7: Redeploy and Run the web-app

...

  1. To run the HelloWorld application:
    • Right click on HelloWorld, click Run As -> Run on Server

...

    • .
    • Select Apache Geronimo v2.1 Server at localhost and click Finish. This will run the application and the welcome page will open in a browser inside eclipse.

      Image Added

Use the steps below to verify that POJO projoct dependency is indeed added as a shared library:

  1. Verify that a file HelloWorld.eclipse.jar

...

  1. is created under <geronimo_home>/var/shared/lib.
  2. Verify that the Manifest.mf file

...

  1. in HelloWorld.eclipse.jar contains the following:
    Code Block
    
    Manifest-Version: 1.0

...

  1. 
    Class-Path:file:/E:/IDEworkspaces/m2eclipseSharedLib/CurrencyConverte

...

  1. 
     rPojo/bin/
    
    Note

    The file path used in the manifest Class-Path may differ based on the location of your workspace directory.