Tutorial: Create an EJB

In Manager, you can create geospatial EJBs for use in an enterprise application. The EJBs expose the GIS services that are being served from various servers to applications running within J2EE 1.4 compliant application servers.

This tutorial will guide you through the work flow of creating a simple mapping EJB in Manager, exporting it as a standard EAR file, and deploying it to a J2EE-compliant application server.
  1. From the Manager Home page, click on the Create EJB Module link.
  2. Click 'Create New EJB Module...'.
  3. Enter the name of the EJB itself. Do not use spaces in the name. You can optionally add some descriptive text as well. Click the Next button.
  4. This is the capabilities page where you specify what GIS capabilities will be exposed by the EJB. Chose the Map radio button. Click the Next button.
  5. Here, you will specify the services that the EJB will use. Click the Add GIS Server button.
  6. Enter the name of an ArcGIS Server host machine running at least one MapServer service. Give the username, password and domain parameters for that host. Click the OK button.
  7. The Available Services list will be populated with service names of only those services with mapping capabilities enabled. Select one and click the Add button to add it to the Selected Services list. Click the Next button.
  8. For the EJB interface(s), choose 'Local & Remote'. For the Target Container, choose 'JBoss Application Server 4.0.2'. Leave the other check boxes unchecked. Click the Finish button.
  9. You will now see the summary page for the EJB. Click the Done button.
  10. You are now back to the Manage EJB Modules page. The EJB configured in the previous setups will now appear in the list of configured EJBs. Take note of the JNDI Name, as it will be needed in a later step.
  11. Check on the check box next to it and click on 'Export'. This will generate all of the necessary classes and resources for the EJB and bundle them into an Enterprise Archive file (.ear) for deployment.
  12. Enter the name of the .ear file. Click the OK button.
  13. A File Download page will appear. Click the Save button. In the Save As dialog, browse to the desired output location on the file system, choose 'All Files' for the type, and change the file name extension to .ear. Click Save.
  14. The target application server was specified as JBoss in a previous step. Outside of Manager, copy the .ear file and drop it into the <JBoss_home>/server/default/deploy directory. If JBoss server has not been started, you can start it now. The EJB has now been deployed.
  15. The Java Server SDK comes with some sample EJB client Web applications. Locate the war file in <arcgishome>/java/samples/server/eadf.testarcgisejb/webarchive called testarcgisejb.war. This is a simple web application that looks up a Map EJB through it's JNDI name and gets the map image from it, displaying it in the JSP page. Copy it to the <JBoss_home>/server/default/deploy directory. It is now deployed.
  16. In a web browser, browse to http://<servername>:8080/testarcgisejb.
  17. In the input text box, enter the JNDI Name noted from a previous step. You can go to Manager again and select the Applications tab, EJB Module page. Find the JNDI Name in the list of EJBs and copy and paste it. Click the Test button.

You should see the Map exported from the EJB.