You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 4 Next »

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

Step-1:
Follow the instructions at <link to be added here> to add Geronimo 2.0 server runtime into WTP, and to create & deploy an "HelloWorld" Dynamic Web project.

Step-2: Create a POJO project

  • In "Project Explorer" view, right click in empty space and click "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 might select "No").
  • In "Project Explorer" view, right click on "CurrencyConverterPojo -> src" and click "New -> Class".
  • Enter "myPackage" as package name and "CurrencyConverter" as class name. Click "Finish".
  • Replace the file content with the contents given in "CurrencyConverter.java".
  • Press "Ctrl + S" to save changes.

Step-3:

  • In "Project Explorer "view, right click on "HelloWorld" web-app project, and click "Properties".
  • Click "Java Build Path" and then switch to "Projects" tab.
  • Click "Add". Select "CurrencyConverterPojo" as the project to be added. Click "OK". Click "OK" again.

Step-4: 

  • In "Project Explorer" view, double click on "HelloWorld -> WebContent -> index.jsp" to open it in an editor.
  • Add "<br>100 USD == <%= CurrencyConverter.dollarToRupees(new BigDecimal(100.0)) %> INR" before "</body>" tag.
  • Add following imports before "<hmtl>" tag:

            <%@page import="myPackage.CurrencyConverter"%>
            <%@page import="java.math.BigDecimal"%>

  • Press "Ctrl + S" to save changes.

Step-5:

  • In "Servers" view, double click on the server instance (like "Apache Geronimo v2.0 Server ..") to open the server editor.
  • In server editor, under "Test Environment", select "Enable in-place shared library support." as shown below:
  • Save and close the server editor.

Step-6:

  • Double click on "Hello World -> 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" as below:
  • Press "Ctrl+S" to save the file.
  • In "Source" tab, a dependency on geronimo/sharedlib//car would be added as below:
        <sys:dependencies>
          <sys:dependency>
            <sys:groupId>geronimo</sys:groupId>
            <sys:artifactId>sharedlib</sys:artifactId>
            <sys:type>car</sys:type>
          </sys:dependency>
        </sys:dependencies>
  • For Geronimo v2.0 & above, change <sys:groupId> to "org.apache.geronimo.configs" as below: (this is due to a current bug in Geronimo Deployment Plan Editors)

                <sys:groupId>org.apache.geronimo.configs</sys:groupId>

  • Press "Ctrl + S" again to save the changes.

<work in progress>

  • No labels