Accueil > Eclipse RAP > My first steps with Eclipse RAP [step1]

My first steps with Eclipse RAP [step1]


In [step0] I have introduced Eclipse RAP and explained why we have chosen Eclipse RAP for XDocReport. In this step, we will generate a RAP Hello World by using Eclipse PDE Wizard « RAP Hello World ». At the end of this article we will be able to launch this WEB Application :

The goal of this article is to explain how to :

Generated code, RAP Target Platform… will be explained in the next articles.

Download

You can download rap_step1.zip which contains the following explained projects :

  • org.akrogen.dynaresume.raphelloworld which is the generated Eclipse « RAP Hello World » explained in this article.

To use this project you must unzip it and copy/paste in your Eclipse workspace. Import the Eclipse Plugin Project org.akrogen.dynaresume.raphelloworld with File/Import … menu. Go at General/Existing Projects Into Workspace and select org.akrogen.dynaresume.raphelloworld. This action will import the project in your workspace. It requires to install RAP Target Platform to avoid compilation problems.

Download Eclipse RCP/RAP

Before starting read those articles, you must download Eclipse. To develop Eclipse RAP application, I suggest you to download Eclipse for RCP and RAP Developers, distribution :

When you have downloaded it, open your eclipse to start generate our first Eclipse RAP application.

Eclipse Helios is the actual version (may 2011) and provides Eclipse RAP 1.3. But in June 2011, Eclipse Indigo will be available and will provide RAP 1.4. If you want play with RAP 1.4 now, you can download RAP 14 Runtime/Tooling.

RAP Hello World

In this section we will generate a basic RAP application with the PDE template RAP Hello World with RAP 1.3. Before developing RAP Application you must install RAP Target Platform. But at this step we will not do that to see compilation problems when RAP application will be generated.

For RAP 1.4 (Tooling) you will not have this problem. When you chose one of the RAP templates in the New Plug-in Project wizard, the tooling will ensure that a RAP target platform is activated. If not, a dialog will appear that offers to install and activate a RAP target. :

Generate RAP Hello World

RAP application is an Eclipse Plugin. To create a RAP Application we need to create Eclipse Plugin. To do that, go to the File/New/Other… menu :

Select Plug-in Development/Plug-in Project node :

Click on Next button, the wizard page which gives the choice to create OSGi Bundle or Eclipse Plugin is displayed :

  • fill Project name field with org.akrogen.dynaresume.raphelloworld.
  • select the radio button Eclipse version because we would like to develop RAP application which is an Eclipse Plugin.

Click on Next button, the wizard page which configure the Eclipse Plugin is displayed :

  • ID field is the Bundle identifier (Bundle-SymbolicName: org.akrogen.dynaresume.raphelloworld).
  • Version field is the Bundle version (Bundle-Version: 1.0.0.qualifier).
  • Name field is the Bundle name (Bundle-Name: RAP Hello World).
  • Execution Environment set the minimal version of the JRE in order to execute the bundle (Bundle-RequiredExecutionEnvironment: JavaSE-1.6).
  • you can unselect generate an activator, a Java class that controls the plug-in’s life cycle to avoid generating a Bundle Activator
  • select This plug-in will make contributions to the UI because we want to generate RAP application
  • select no for Would you like create a rich client application? because we want generate a RAP application and not RCP application.

Click on Next button, the wizard page which show several PDE templates is displayed :

Select RAP Hello World template to generate RAP application, Hello World. When you select this template, you can notice on the right view a description of this PDE template « This code will need the RAP target to compile. At this step RAP target is not installed and we will see compilation problems when project will be generated.

Click on Next button, the wizard page which give you the capability to customize package names, class names of the RAP project to generate is displayed :

Don’t change default values and click on Finish Button to generate the RAP application. When generation is done, your workspace looks like this :

New Eclipse Plugin project org.akrogen.dynaresume.raphelloworld is added to your workspace :

You can notice that there are compilation problems (see generated Java classes). If you open MANIFEST.MF you will see the main problem :

Bundle 'org.eclipse.rap.ui' cannot be resolved.

This error means that the Eclipse Plugin org.eclipse.rap.ui cannot be found in the current Target Platform.

RCP Target Platform

RAP compilation problems come from the current Target Platform which is not configured for RAP. To resolve compilation problems we need configure Target Platform for RAP. Before doing that, we can edit the current Target Platform used. Go to the menu Window/Preferences :

Select Plug-in Development/Target Platform node to see the (only) current Target Platform configured :

Target Platform configure the whole Plugins that you can use in your Eclipse Workspace. It is also used to know which Plugins must be started when the application is started. To see plugins which compose Target Platform, click on Edit button. The « Edit Target Definition » dialog display :

The Locations tab display the folders (by default your ECLIPSE_HOME/plugins) which contains plugins. To see plugins coming from folders declared in the Locations tab, go to the Content tab :

You can notice that org.eclipse.rap.ui plugin is missing, so there is compilation problem.

Install RAP Target Platform

In this section we will install RAP Target Platform which will contain for instance org.eclipse.rap.ui plugins. To do that go to Help/Welcome :

This menu opens the Welcome view :

Click on Overview icon to open the Overview section :

Click on Rich Ajax Platform (RAP) icon to open the Rich Ajax Platform (RAP) section :

Click on Install Target Platform icon to install RAP Target Platform to open Target Platform Installation dialog :

Click on OK button to install RAP Target Platform. When RAP Target Platform is installed, your workspace will be recompiled (automaticly) with no errors :

RAP Target Platform

Now we can start to generate RAP application but before doing that, we can edit the RAP Target Platform which was installed. Go to the menu Window/Preferences and select Plug-in Development/Target Platform node. You will see that there are 2 Target Platform. The Rich Ajax Platform (1.3) is active : :

Click on Edit button to open the « Edit Target Definition » dialog :

You can see the folder which contains (RAP and another) plugins. If you click on Content tab, you will see the plugins :

You can check that org.eclipse.rap.ui exists (it explains that we have no compilation problem).

Launch RAP Hello World

In this section we can start to generate RAP Application. To do that open MANIFEST.MF and click on Overview tab.

Click on Launch a RAP Application link on Testing section. This action start the RAP WEB application by starting Jetty server and open Browser view with the first home page of the WEB Application :

Fix Jetty Port

In this screen, RAP application is available with the URL :

http://127.0.0.1:2358/rap?startup=hello but each time you will restart your RAP application, port will change (ex : http://127.0.0.1:3342/rap?startup=hello). To fix a port go to the Run/Run Configurations… menu :

Select the RAP Application launch, go to the Main tab and fix the port value to 8080 in the Runtime Settings/Manual Port configuration :

Now your RAP application will be available every time with the URL http://127.0.0.1:8080/rap?startup=hello. Next articles will use this URL.

Conclusion

In this article, we have installed RAP Target Platform, generate our first RAP Application, and started it. PDE Tooling is a great help to start quickly a RAP Application. Before explaining generated code of « RAP Hello World » Application and RAP Architecture, you need understand OSGi. I will explain in the [step2] what is an OSGi bundle with PDE.

Catégories :Eclipse RAP
  1. Mai 10, 2011 à 4:55

    I’m really glad and happy with your decision to go with Eclipse RAP!

    I think you’ll be happy with your decision and it will only get better as more great stuff is coming into RAP! 🙂

    • Mai 10, 2011 à 4:59

      Hi Hendy,

      Thank a lot for your post.
      I hope I will explain well the RAP features with my articles and as soon as we will have XDocReport application with RAP, I will contact RAP Team.

      Regards Angelo

  2. Mai 10, 2011 à 10:35

    Thanks for this fine-grained tutorial, Angelo!

    I would like to add that this story becomes easier with RAP 1.4. As soon as you’ve created a plug-in project from a RAP template, the new tooling checks your target and pops up a dialog asking you to install a RAP target. So in your setup, there’s no need to click though the welcome page anymore.

    Cheers, Ralf

    • Mai 11, 2011 à 12:00

      Hi Ralf,

      I’m happy that you post in my blog:) Thank a lot for your information about RAP 1.4. The popup is a cool feature.
      I have notice that RAP 1.4 will be available with Indigo in June 2011 (I can download too but I prefer waiting official release).
      I continue my articles with RAP 1.3 but I will study RAP 1.4 as soon as Indigo will be available.

      Hope you will like my next articles. Don’t hesitate to comment my articles if I don’t explain correctly RAP.

      Thank a lot.

      Regards Angelo

    • Mai 12, 2011 à 6:39

      Hi Ralf,

      I have modified the article to speak about RAP 1.4 Tooling with popup. Thanks for this information.

      Regards Angelo

  3. Mai 11, 2011 à 10:09

    Hi Angelo,

    Good job for this tutorial. I plan to make announcements on my blog for these posts.

    You are the french Lars Vogel 😉

    Cheers

    Mickael

    • Mai 11, 2011 à 10:38

      Hi Mickael,

      Thank a lot for your comment. I love Lars Vogel tutoriel and I’m very flattered with your comparison.

      Regards Angelo

  4. Mai 21, 2011 à 5:05

    @Good tutorial Angelo!

    • Mai 21, 2011 à 8:53

      Hi Luis,

      Many thank’s! I hope my next articles will please you.

      Regards Angelo

  5. Reza
    décembre 4, 2011 à 12:56

    Hi Angelo,

    Good job, simple and useful.

    Cheers, Reza

  6. Sukh
    février 14, 2012 à 5:20

    Hi, I am getting an error while launching an RAP application. I did follow the steps described in this tutorial and refresh the page every one minute. Still I am getting following error.

    osgi> !SESSION 2012-02-14 11:14:48.457 ———————————————–
    eclipse.buildId=unknown
    java.version=1.6.0_27
    java.vendor=Sun Microsystems Inc.
    BootLoader constants: OS=win32, ARCH=x86, WS=win32, NL=en_US
    Command-line arguments: -dev file:D:/documents and settings/sxsing6/workspace/.metadata/.plugins/org.eclipse.pde.core/HelloRap/dev.properties -os win32 -ws win32 -arch x86 -console -consolelog -data D:\documents and settings\sxsing6\workspace/.metadata/.plugins/org.eclipse.rap.ui.launch/HelloRap

    !ENTRY org.eclipse.rap.ui 4 0 2012-02-14 11:14:49.473
    !MESSAGE FrameworkEvent ERROR
    !STACK 0
    org.osgi.framework.BundleException: The bundle « org.eclipse.rap.ui_1.5.0.20110926-1702 [3] » could not be resolved. Reason: Missing Constraint: Require-Bundle: org.eclipse.rap.ui.workbench; bundle-version= »[1.3.0,2.0.0) »
    at org.eclipse.osgi.framework.internal.core.AbstractBundle.getResolverError(AbstractBundle.java:1328)
    at org.eclipse.osgi.framework.internal.core.AbstractBundle.getResolutionFailureException(AbstractBundle.java:1312)
    at org.eclipse.osgi.framework.internal.core.BundleHost.startWorker(BundleHost.java:323)
    at org.eclipse.osgi.framework.internal.core.AbstractBundle.resume(AbstractBundle.java:390)
    at org.eclipse.osgi.framework.internal.core.Framework.resumeBundle(Framework.java:1177)
    at org.eclipse.osgi.framework.internal.core.StartLevelManager.resumeBundles(StartLevelManager.java:559)
    at org.eclipse.osgi.framework.internal.core.StartLevelManager.resumeBundles(StartLevelManager.java:544)
    at org.eclipse.osgi.framework.internal.core.StartLevelManager.incFWSL(StartLevelManager.java:457)
    at org.eclipse.osgi.framework.internal.core.StartLevelManager.doSetStartLevel(StartLevelManager.java:243)
    at org.eclipse.osgi.framework.internal.core.StartLevelManager.dispatchEvent(StartLevelManager.java:438)
    at org.eclipse.osgi.framework.internal.core.StartLevelManager.dispatchEvent(StartLevelManager.java:1)
    at org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(EventManager.java:230)
    at org.eclipse.osgi.framework.eventmgr.EventManager$EventThread.run(EventManager.java:340)

    !ENTRY org.eclipse.rap.design.example 4 0 2012-02-14 11:14:49.473
    !MESSAGE FrameworkEvent ERROR
    !STACK 0
    org.osgi.framework.BundleException: The bundle « org.eclipse.rap.design.example_1.5.0.20110926-1702 [4] » could not be resolved. Reason: Missing Constraint: Require-Bundle: org.eclipse.rap.ui; bundle-version= »1.2.0″
    at org.eclipse.osgi.framework.internal.core.AbstractBundle.getResolverError(AbstractBundle.java:1328)
    at org.eclipse.osgi.framework.internal.core.AbstractBundle.getResolutionFailureException(AbstractBundle.java:1312)
    at org.eclipse.osgi.framework.internal.core.BundleHost.startWorker(BundleHost.java:323)
    at org.eclipse.osgi.framework.internal.core.AbstractBundle.resume(AbstractBundle.java:390)
    at org.eclipse.osgi.framework.internal.core.Framework.resumeBundle(Framework.java:1177)
    at org.eclipse.osgi.framework.internal.core.StartLevelManager.resumeBundles(StartLevelManager.java:559)
    at org.eclipse.osgi.framework.internal.core.StartLevelManager.resumeBundles(StartLevelManager.java:544)
    at org.eclipse.osgi.framework.internal.core.StartLevelManager.incFWSL(StartLevelManager.java:457)
    at org.eclipse.osgi.framework.internal.core.StartLevelManager.doSetStartLevel(StartLevelManager.java:243)
    at org.eclipse.osgi.framework.internal.core.StartLevelManager.dispatchEvent(StartLevelManager.java:438)
    at org.eclipse.osgi.framework.internal.core.StartLevelManager.dispatchEvent(StartLevelManager.java:1)
    at org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(EventManager.java:230)
    at org.eclipse.osgi.framework.eventmgr.EventManager$EventThread.run(EventManager.java:340)

    !ENTRY org.eclipse.rap.ui.workbench 4 0 2012-02-14 11:14:49.567
    !MESSAGE FrameworkEvent ERROR
    !STACK 0
    org.osgi.framework.BundleException: The bundle « org.eclipse.rap.ui.workbench_1.5.0.20110926-1702 [12] » could not be resolved. Reason: Missing Constraint: Import-Package: org.eclipse.rap.rwt.osgi; version= »[1.0.0,2.0.0) »
    at org.eclipse.osgi.framework.internal.core.AbstractBundle.getResolverError(AbstractBundle.java:1328)
    at org.eclipse.osgi.framework.internal.core.AbstractBundle.getResolutionFailureException(AbstractBundle.java:1312)
    at org.eclipse.osgi.framework.internal.core.BundleHost.startWorker(BundleHost.java:323)
    at org.eclipse.osgi.framework.internal.core.AbstractBundle.resume(AbstractBundle.java:390)
    at org.eclipse.osgi.framework.internal.core.Framework.resumeBundle(Framework.java:1177)
    at org.eclipse.osgi.framework.internal.core.StartLevelManager.resumeBundles(StartLevelManager.java:559)
    at org.eclipse.osgi.framework.internal.core.StartLevelManager.resumeBundles(StartLevelManager.java:544)
    at org.eclipse.osgi.framework.internal.core.StartLevelManager.incFWSL(StartLevelManager.java:457)
    at org.eclipse.osgi.framework.internal.core.StartLevelManager.doSetStartLevel(StartLevelManager.java:243)
    at org.eclipse.osgi.framework.internal.core.StartLevelManager.dispatchEvent(StartLevelManager.java:438)
    at org.eclipse.osgi.framework.internal.core.StartLevelManager.dispatchEvent(StartLevelManager.java:1)
    at org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(EventManager.java:230)
    at org.eclipse.osgi.framework.eventmgr.EventManager$EventThread.run(EventManager.java:340)

    !ENTRY HelloRap 4 0 2012-02-14 11:14:49.582
    !MESSAGE FrameworkEvent ERROR
    !STACK 0
    org.osgi.framework.BundleException: The bundle « HelloRap_1.0.0.qualifier [18] » could not be resolved. Reason: Missing Constraint: Require-Bundle: org.eclipse.rap.ui; bundle-version= »0.0.0″
    at org.eclipse.osgi.framework.internal.core.AbstractBundle.getResolverError(AbstractBundle.java:1328)
    at org.eclipse.osgi.framework.internal.core.AbstractBundle.getResolutionFailureException(AbstractBundle.java:1312)
    at org.eclipse.osgi.framework.internal.core.BundleHost.startWorker(BundleHost.java:323)
    at org.eclipse.osgi.framework.internal.core.AbstractBundle.resume(AbstractBundle.java:390)
    at org.eclipse.osgi.framework.internal.core.Framework.resumeBundle(Framework.java:1177)
    at org.eclipse.osgi.framework.internal.core.StartLevelManager.resumeBundles(StartLevelManager.java:559)
    at org.eclipse.osgi.framework.internal.core.StartLevelManager.resumeBundles(StartLevelManager.java:544)
    at org.eclipse.osgi.framework.internal.core.StartLevelManager.incFWSL(StartLevelManager.java:457)
    at org.eclipse.osgi.framework.internal.core.StartLevelManager.doSetStartLevel(StartLevelManager.java:243)
    at org.eclipse.osgi.framework.internal.core.StartLevelManager.dispatchEvent(StartLevelManager.java:438)
    at org.eclipse.osgi.framework.internal.core.StartLevelManager.dispatchEvent(StartLevelManager.java:1)
    at org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(EventManager.java:230)
    at org.eclipse.osgi.framework.eventmgr.EventManager$EventThread.run(EventManager.java:340)
    2012-02-14 11:14:49.614:INFO:org.mortbay.log:Logging to STDERRorg.mortbay.log via org.mortbay.log.Slf4jLog
    2012-02-14 11:14:49.692:INFO::jetty-6.1.x
    2012-02-14 11:14:49.754:INFO::Started SelectChannelConnector@0.0.0.0:3685

    !ENTRY org.eclipse.rap.ui.views 4 0 2012-02-14 11:14:49.770
    !MESSAGE FrameworkEvent ERROR
    !STACK 0
    org.osgi.framework.BundleException: The bundle « org.eclipse.rap.ui.views_1.5.0.20110926-1702 [25] » could not be resolved. Reason: Missing Constraint: Require-Bundle: org.eclipse.rap.ui; bundle-version= »[1.2.0,4.0.0) »
    at org.eclipse.osgi.framework.internal.core.AbstractBundle.getResolverError(AbstractBundle.java:1328)
    at org.eclipse.osgi.framework.internal.core.AbstractBundle.getResolutionFailureException(AbstractBundle.java:1312)
    at org.eclipse.osgi.framework.internal.core.BundleHost.startWorker(BundleHost.java:323)
    at org.eclipse.osgi.framework.internal.core.AbstractBundle.resume(AbstractBundle.java:390)
    at org.eclipse.osgi.framework.internal.core.Framework.resumeBundle(Framework.java:1177)
    at org.eclipse.osgi.framework.internal.core.StartLevelManager.resumeBundles(StartLevelManager.java:559)
    at org.eclipse.osgi.framework.internal.core.StartLevelManager.resumeBundles(StartLevelManager.java:544)
    at org.eclipse.osgi.framework.internal.core.StartLevelManager.incFWSL(StartLevelManager.java:457)
    at org.eclipse.osgi.framework.internal.core.StartLevelManager.doSetStartLevel(StartLevelManager.java:243)
    at org.eclipse.osgi.framework.internal.core.StartLevelManager.dispatchEvent(StartLevelManager.java:438)
    at org.eclipse.osgi.framework.internal.core.StartLevelManager.dispatchEvent(StartLevelManager.java:1)
    at org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(EventManager.java:230)
    at org.eclipse.osgi.framework.eventmgr.EventManager$EventThread.run(EventManager.java:340)

    !ENTRY org.eclipse.osgi 4 0 2012-02-14 11:14:49.770
    !MESSAGE Bundle initial@reference:file:plugins/org.eclipse.rap.ui_1.5.0.20110926-1702.jar/ was not resolved.

    !ENTRY org.eclipse.osgi 4 0 2012-02-14 11:14:49.770
    !MESSAGE Bundle initial@reference:file:plugins/org.eclipse.rap.design.example_1.5.0.20110926-1702.jar/ was not resolved.

    !ENTRY org.eclipse.osgi 4 0 2012-02-14 11:14:49.770
    !MESSAGE Bundle initial@reference:file:plugins/org.eclipse.rap.ui.workbench_1.5.0.20110926-1702.jar/ was not resolved.

    !ENTRY org.eclipse.osgi 4 0 2012-02-14 11:14:49.770
    !MESSAGE Bundle initial@reference:file:../../../../HelloRap/ was not resolved.

    !ENTRY org.eclipse.osgi 4 0 2012-02-14 11:14:49.770
    !MESSAGE Bundle initial@reference:file:plugins/org.eclipse.rap.ui.views_1.5.0.20110926-1702.jar/ was not resolved.

    Any comments will be appreciated.

    thanks

    • février 16, 2012 à 8:24

      Hi,

      Please post your question on Eclipse RAP forum.
      I have not time to investigate your problem.

      Good luck.

      Regards Angelo

    • Harald
      février 16, 2012 à 7:35

      The org.eclipse.rap.rwt.osgi is missing within your run configuration. Right-click the MANIFEST.MF -> Run As -> Run Configurations … and select the tab « Bundles » scroll down until you see the entry of « org.eclipse.rap.rwt.osgi » which is unchecked. Check it, press Apply and run the application.

      Regards,
      #arald

  7. nilriri
    Mai 24, 2013 à 5:01

    very very thank you!!!!

  1. Mai 10, 2011 à 2:03
  2. Mai 10, 2011 à 7:58
  3. Mai 16, 2011 à 9:43
  4. Mai 20, 2011 à 8:47
  5. Mai 24, 2011 à 9:44
  6. Mai 31, 2011 à 1:52
  7. août 8, 2011 à 3:43

Laisser un commentaire