How to use JOPE in Eclipse

The aim of this document is to show basics for JOPE usage within Eclipse. It assumes that the reader does not need explanation about Eclipse particular tasks.

This document describes how to install, configure and use JOPE plugin.

The first step is to download the JOPE-1-0-0.zip file

(URL : http://download.forge.objectweb.org/jope/JOPE-1-0-0.zip )

Supported Eclipse versions (Eclipse version tested):

Eclipse 2.0

Eclipse 2.1

Supported Jonas versions :

JOnAS 3.0 and higher.

 

  1. JOPE INSTALLATION
  2. Take the JOPE-1-0-0.zip file and explode it in the ECLIPSE_HOME/plugins directory.

    Start Eclipse. Usually the plugin is automatically detected, and you can see the Jonas menu.

    If you don't see the Jonas menu in Eclipse, you have to add the Jonas Perspective in Eclipse. You can do Window -> Customize Perspective and choose Other. You should see Jonas and you have to select it.

    At this step, you must see the Jonas menu in Eclipse.

     

  3. JOPE CONFIGURATION
  4. To configure the Jonas Plugin, you can do Window -> Preferences. You select Jonas and you can choose between two versions of Jonas :

      1. Jonas 3.0 et 3.1 : it's a good choice to the Jonas versions without CAROL integration. If you select this choice, you can choose the protocol (RMI or JEREMIE) to start the server.
      2. Jonas 3.1.x and higher (with CAROL integration) : it's a good choice to the Jonas versions with CAROL integration.

    Then, you can configure the JONAS_ROOT and JONAS_BASE directory.

    You can add some jar file in XTRA_CLASSPATH (it's the same thing than the environment variable).

    You can choose to start JOnAS in one of two modes :

    Debug mode : to make debug in eclipse

    Non debug mode : to start JOnAS in DOS console (only for windows platforms).

    If you select JVM Parameters, you can add some JVM parameters or CLASSPATH parameters to add for the server's start. You can choose to start in debug mode or not.

    It's very important to make this configuration before creating a Jonas project or creating a new JOnAS server.

     

  5. Start, stop, restart or create a JonAS server
  6. To start, stop or restart JOnAS you can select this in JOnAS menu in Eclipse or on the tool bar. When you start JOnAS you switch to the Debug Perspective.

    You can also create a new JOnAS server. You select this in the JOnAS menu or in the tool bar. By default you have the JONAS_ROOT directory. You have to put the JONAS_BASE directory equivalent to the new JonAS server. The plugin will create the new server.

    If you want to use this server, you have to change the JONAS_BASE configuration in plugin preferences.

     

  7. How to create a JOnAS project
  8. Be careful, before creating a JOnAS project you must be sure to configure the JOnAS plugin preferences (with JONAS_ROOT information).

    To create a JOnAS project, you can do File -> New -> Project. You select Java and JOnAS project.

    You can choose the project name and the directory.

    Then you can create a web application :

      1. you can define a web application context name : it will be the name of the war file and the name used to call the web application in the browser. By default the project name is proposed.
      2. you can define the workspace directory where the web application will be stored. In this directory you should find the WEB-INF directory with classes and lib directories (the plugin create these directories) and the resources files (JSP and images files). By default, webApplication is proposed.
      3. you can define the workspace directory where the source will be stored. In this directory you should find all the java files. When you make a compile the class files are stored in WEB-INF\classes. By default, source is proposed.

     You can also choose to generate some servlet examples and jsp sources files.

    It's also possible to create an empty project (just to develop EJB).

    You can click on Finish and your project is created. The JRE jar files are added and the web_catalina.jar and jonas.jar (or JONAS_RMI.jar and JONAS_JEREMIE.jar) are added to your project.

    You have also the web app tree project. You can find in the web application directory (by default webApplication) a build.xml file. This file is used by the plugin to build the war file. By default all the java files in source web directory will be in WEB-INF/classes. But you can customize this file to add or remove some files.

    You can see also a build.properties file in the root of the project. This file will be used by the plugin to take some properties when the EJB will be built. You can also customize this file.

    For the moment the plugin support one WAR per project.

     

  9. How to change the CLASSPATH of your JOnAS project when you change the version of JOnAS (JOPE 1.1.5)
  10. Until JOPE 1.1.4, there was statics references in build.xml files generated by JOPE. Now JOPE 1.1.5 has relative reference and allow to change the project name or the project path.

    If you change the version of JOnAS, you can update your project classpath. You can make a right click on the JOnAS project and do :

    Jonas Project -> Modify Classpath with JOnAS lib

    Automatically the J2EE jar associated with the JOnAS version will replaced the J2EE jar of your JOnAS project.

     

  11. How to create an EJB in a JOnAS project
  12. When you have created your JOnAS project, you can do File -> New -> Other -> Jonas EJB to create an EJB.

    When you click on next button you have a wizard to choose the package, the EJB name and the jar name. You cannot choose the root directory of EJB components. This root directory will be "components".

    You have to choose an EJB type and the type of interface. If you choose Remote interface, the plugin will generate a Client of the EJB.

    Then you can click on Finish button. The plugin generate all the EJB source file in the package directory. The xml descriptors are in the same directory. You can see in the package directory a build.xml file, and it's this file which will be run by the plugin to build the EJB. You can customize this file if it is necessary.

     

  13. WAR and EJB generation

When you have created and developed your JOnAS project, you can generate the war or the ejb files.

If you right click on your project name, you have a choice "Jonas project". In this choice you can make :

WAR tasks :

EJB tasks :

EAR tasks :

 

  1. DEBUG and hot deployment

The debug and hot deployment depends of the code you have added. If the plugin is not be able to do a hot deploy, you will see a popup. But in the lot of cases if you add codes or if you want to put a breakpoint, you have only to save the file and normally the modification or the breakpoint will be detected and hot deploy.