Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Remote Application Platform (RAP) » Trouble deploying RAP application in Jetty in Equinox(Need help with correct config.ini setup)
icon5.gif  Trouble deploying RAP application in Jetty in Equinox [message #1057850] Thu, 09 May 2013 10:01 Go to next message
Matthias Basler is currently offline Matthias Basler
Messages: 4
Registered: July 2009
Junior Member
Hi all, hi RAP team,

my name is Matthias Basler. I have been programming RCP applications for years and have lately found interest in RAP. I programmed a small RAP appication skeletal (running fine in the IDE) and have been trying to get this to run outside the IDE as well.
I have been following the (very good and up-to-date!) RAP developer guide for RAP 2.0 and the (outdated but still helpful) RAP book by Fabian Lange.
The application uses the workbench, so follows the "RAP with Workbench 3.x" application setup and I want to deploy it in Jetty in Equinox, as described in the RAP book on page 131ff.

What I did
I have the typical directory layout:

deploy
+- configuration
+- features
+- plugins
+- eclipse.exe + batch file

- I placed the equinox launcher plugin+fragment and org.eclipse.update.configurator plugins into plugins
- I added all plugins and features from the RAP runtume (except source, demo and example plugins to the features resp.
- I added my own feature and the three contained plugins via the Feature export wizard
- I created a config.ini to my best knowledge (which is not much) using the information from the rap book, which unfortunately are not up-to-date and do not cover the case of a workbench-based application.

Here is my current config.ini (comments remove for compactness)
eclipse.ignoreApp=true
eclipse.exitOnError=false
osgi.noShutdown=true
org.osgi.service.http.port=7070
osgi.bundles.defaultStartLevel=4
osgi.bundles=org.eclipse.equinox.common@2:start,org.eclipse.update.configurator@3:start,org.eclipse.rap.ui.workbench@start,<MYOWNPLUGIN>@start,<MYOWNPLUGIN2>@start, ...,org.eclipse.equinox.http.jetty@start,org.eclipse.equinox.http.registry@start


Results
Whenever I add a feature (not a plugin) to the "osgi.bundles=..." list like "org.eclipse.rap.feature@4:start", I get following messages in a log file, although the feature jars are certainly there and contain the feature.xml files:
Quote:

!ENTRY org.eclipse.osgi 4 0 2013-05-09 11:46:18.704
!MESSAGE Bundle org.eclipse.rap.feature@4:start not found.

!ENTRY org.eclipse.update.configurator 4 0 2013-05-09 11:46:18.938
!MESSAGE Unable to find feature.xml in directory: E:\Java_Eclipse\deploy\features\org.eclipse.rap.equinox.juno.target.feature_2.0.0.20130205-1849.jar

!ENTRY org.eclipse.update.configurator 4 0 2013-05-09 11:46:18.938
!MESSAGE Unable to find feature.xml in directory: E:\Java_Eclipse\deploy\features\org.eclipse.rap.feature_2.0.0.20130205-1849.jar

!ENTRY org.eclipse.update.configurator 4 0 2013-05-09 11:46:18.938
!MESSAGE Unable to find feature.xml in directory: E:\Java_Eclipse\deploy\features\org.myapp._feature_1.0.0.M01.jar


As a workaround I tried specifying plugins only.

Starting the OSGi-Console using "eclipse.exe -console" brings up the OSGi-Console with just "osgi >" on it. Using "ss" lists my own plugins as ACTIVE and the workbench (with its dependencies) as ACTIVE or STARTING as well. I have attached the OSGi console at the end of the post.

However, trying to access the application via "http: //localhost:7070/myapp" results in Quote:

HTTP ERROR: 404

Problem accessing /myapp. Reason:

ProxyServlet: /myapp

Powered by Jetty://


I already tried starting all other plugins manually via the console, but ended up just with another error:
Quote:

HTTP ERROR: 500

Problem accessing /myapp. Reason:

org/eclipse/jface/action/IAction

Powered by Jetty://

and a stack trace on the OSGi console caused by
java.lang.ClassNotFoundException: org.eclipse.jface.action.IAction
although the SWT and JFace bundles are all active. Huh?

I should note that one single time I had my application running in the browser after enabling all plugins on the OSGi console, but I am not able to reproduce this. I did not change my plugins since then.

Since I could not find any help on the web concerning these issues I am now lost without help.

Questions
Question 1
Could the RAP team please cover this case in their developer's guide? Currently the guide only covers RWT Standalone deployment with web.xml file for an RWT application without workbench and WAR deployment for Tomcat etc. but not the case of a full workbench application and Equinox.

Question 2
What is the correct way of defining the "osgi.bundles" entry in config.ini for the case of a workbench-based application with resp. without own features?

Question 3
Is the startup order relevant for the bundles? If so, which bundles have to be started first in which order before the RAP and my application bundles can be started?

Question 4
Why do I have the problem of not being able to specify a feature to be loaded in the "osgi.bundles" entry in config.ini. Why does OSGi not find my features.xml in the feature JAR files?

Question 5
What can i do to get a consistent, reproducable startup situation. I tried using the "-clean" eclipse command line argument but I don't have the feeling this changed anything.

Additional information
Win7 64 Bit, RAP 2.0.0, RAP-Tools 2.0.0, Eclipse Juno Service Release 2

Current OSGi console after startup with "org.myapp" denoting my own bundles.
osgi> ss
"Framework is launched."

id      State       Bundle
0       ACTIVE      org.eclipse.osgi_3.8.1.v20120830-144521
                    Fragments=39
1       ACTIVE      org.eclipse.equinox.common_3.6.100.v20120522-1841
2       ACTIVE      org.eclipse.update.configurator_3.3.200.v20120912-144026
3       ACTIVE      org.eclipse.rap.ui.workbench_2.0.0.20130107-1035
4       ACTIVE      org.myapp_3.1.0
5       ACTIVE      org.myapp.db_0.1.0
6       ACTIVE      org.myapp.swt_rwt_0.2.0
7       ACTIVE      org.myapp.config_1.0.0.M01
8       ACTIVE      org.myapp.workbench_1.0.0.M01
9       ACTIVE      org.myapp.launcher.rwt_1.0.0.M01
10      ACTIVE      org.eclipse.equinox.http.jetty_3.0.0.v20120522-1841
11      ACTIVE      org.eclipse.equinox.http.registry_1.1.200.v20120522-2049
12      STARTING    com.ibm.icu.base_4.4.2.v20110831
13      RESOLVED    javax.servlet_3.0.0.v201112011016
14      RESOLVED    javax.xml_1.3.4.v201005080400
15      ACTIVE      org.apache.felix.gogo.command_0.8.0.v201108120515
16      ACTIVE      org.apache.felix.gogo.runtime_0.8.0.v201108120515
17      ACTIVE      org.apache.felix.gogo.shell_0.8.0.v201110170705
18      RESOLVED    org.eclipse.core.commands_3.6.1.v20120814-150512
19      ACTIVE      org.eclipse.core.contenttype_3.4.200.v20120523-2004
20      RESOLVED    org.eclipse.core.databinding.beans_1.2.200.v20120523-1955
21      STARTING    org.eclipse.core.databinding.observable_1.4.1.v20120521-2329
22      STARTING    org.eclipse.core.databinding.property_1.4.100.v20120523-1955
23      STARTING    org.eclipse.core.databinding_1.4.1.v20120521-2329
24      STARTING    org.eclipse.core.expressions_3.4.401.v20120627-124442
25      ACTIVE      org.eclipse.core.jobs_3.5.300.v20120622-204750
26      ACTIVE      org.eclipse.core.runtime_3.8.0.v20120521-2346
27      ACTIVE      org.eclipse.equinox.app_1.3.100.v20120522-1841
29      ACTIVE      org.eclipse.equinox.console_1.0.0.v20120522-1841
30      RESOLVED    org.eclipse.equinox.ds_1.4.0.v20120522-1841
33      RESOLVED    org.eclipse.equinox.http.servletbridge_1.0.300.v20120522-2049
34      ACTIVE      org.eclipse.equinox.http.servlet_1.1.300.v20120522-1841
35      RESOLVED    org.eclipse.equinox.launcher.win32.win32.x86_64_1.1.200.v20120913-144807
                    Master=36
36      RESOLVED    org.eclipse.equinox.launcher_1.3.0.v20120522-1813
                    Fragments=35
37      ACTIVE      org.eclipse.equinox.preferences_3.5.0.v20120522-1841
38      ACTIVE      org.eclipse.equinox.registry_3.5.200.v20120522-1841
39      RESOLVED    org.eclipse.equinox.servletbridge.extensionbundle_1.2.100.v20120522-2049
                    Master=0
40      RESOLVED    org.eclipse.equinox.servletbridge_1.2.200.v20120522-2049
41      STARTING    org.eclipse.equinox.util_1.0.400.v20120522-2049
42      STARTING    org.eclipse.help_3.6.0.v20120521-2344
43      RESOLVED    org.eclipse.jdt.junit.runtime_3.4.300.v20120523-1257
44      RESOLVED    org.eclipse.jetty.continuation_8.1.3.v20120522
45      RESOLVED    org.eclipse.jetty.http_8.1.3.v20120522
46      RESOLVED    org.eclipse.jetty.io_8.1.3.v20120522
47      RESOLVED    org.eclipse.jetty.security_8.1.3.v20120522
48      RESOLVED    org.eclipse.jetty.server_8.1.3.v20120522
49      RESOLVED    org.eclipse.jetty.servlet_8.1.3.v20120522
50      RESOLVED    org.eclipse.jetty.util_8.1.3.v20120522
51      RESOLVED    org.eclipse.osgi.services_3.3.100.v20120522-1822
53      RESOLVED    org.eclipse.rap.jface.databinding_2.0.0.20121031-1050
54      ACTIVE      org.eclipse.rap.jface_2.0.0.20130107-0921
55      RESOLVED    org.eclipse.rap.junit.runtime_2.0.0.20130111-1348
56      RESOLVED    org.eclipse.rap.junit_2.0.0.20130111-1348
57      RESOLVED    org.eclipse.rap.rwt.osgi_2.0.0.20130110-2216
58      RESOLVED    org.eclipse.rap.rwt.testfixture_2.0.0.20130115-1305
59      RESOLVED    org.eclipse.rap.rwt_2.0.0.20130205-1612
60      STARTING    org.eclipse.rap.ui.cheatsheets_2.0.0.20130111-1314
61      STARTING    org.eclipse.rap.ui.forms_2.0.0.20130111-1314
62      STARTING    org.eclipse.rap.ui.views_2.0.0.20130111-1314
64      ACTIVE      org.eclipse.rap.ui_2.0.0.20121230-1109
66      RESOLVED    org.json_1.0.0.v201011060100
67      RESOLVED    org.junit_3.8.2.v3_8_2_v20100427-1100
69      INSTALLED   org.myapp.swt_rwt.rwt_0.2.0 [a fragment]
osgi>
Re: Trouble deploying RAP application in Jetty in Equinox [message #1057977 is a reply to message #1057850] Fri, 10 May 2013 09:54 Go to previous messageGo to next message
Ralf Sternberg is currently offline Ralf Sternberg
Messages: 1291
Registered: July 2009
Senior Member

Hi Matthias,

welcome to RAP. You got the OSGi platform up and running, good. But most
of your bundles are not active, that's not good. Without the jetty
bundles for example, there's no servlet container. RAP will not work
unless rwt is running...

You should try to get all your bundles into the ACTIVE state (except
fragements, they remain RESOLVED). Use the `start <bundle id>` command
in the OSGi console to start bundles with aren't active. This will
either start the bundle or tell you why it can't be started. Make sure
you start the platform with -consolelog to see exceptions that prevent
bundles from starting.

Please understand that we can't answer "catalogues of questions". Let's
first try to resolve your specific problem.

BTW, you included some test bundles that are needless at runtime:
* org.eclipse.rap.rwt.testfixture
* org.eclipse.jdt.junit.runtime
* org.junit

Regards, Ralf

--
Ralf Sternberg

Twitter: @EclipseRAP
Blog: http://eclipsesource.com/blogs/

Professional services for RAP and RCP?
http://eclipsesource.com/services/rap/
Re: Trouble deploying RAP application in Jetty in Equinox [message #1058074 is a reply to message #1057977] Fri, 10 May 2013 19:38 Go to previous messageGo to next message
Matthias Basler is currently offline Matthias Basler
Messages: 4
Registered: July 2009
Junior Member
Hi Ralf,

thank you for your assistence.
I followed your advice, but unfortunately it has not yet brought me any further than I have been before. Details below:

Quote:

You should try to get all your bundles into the ACTIVE state (except
fragements, they remain RESOLVED). Use the `start <bundle id>` command [...]

As I wrote in my original email, I already tried exactly this.

I now added all the plugins in their suspected order of dependency to config.ini, so when the console starts there are only the fragments left "RESOLVED" (and two more JUNIT bundles I have removed afterwards).
Here is the config.ini bundles string:

osgi.bundles=org.eclipse.equinox.common@2:start,org.eclipse.update.configurator@3:start,javax.xml@start,org.json@start,javax.servlet@start,org.eclipse.jetty.util@start,org.eclipse.jetty.continuation@start,org.eclipse.jetty.io@start,org.eclipse.jetty.http@start,org.eclipse.jetty.security@start,org.eclipse.jetty.server@start,org.eclipse.jetty.servlet@start,org.eclipse.equinox.util@start,org.eclipse.equinox.launcher@start,org.eclipse.equinox.servletbridge@start,org.eclipse.osgi.services@start,org.eclipse.rap.rwt@start,org.eclipse.rap.rwt.osgi@start,org.eclipse.rap.jface.databinding@start,org.eclipse.core.commands@start,org.eclipse.core.databinding.beans@start,org.eclipse.rap.ui.workbench@start,org.myapp@start,org.myapp.db@start,org.myapp.swt_rwt@start,org.myapp.config@start,org.myapp.workbench@start,org.myapp.launcher.rwt@start,org.eclipse.equinox.http.jetty@start,org.eclipse.equinox.http.servlet@start,org.eclipse.equinox.http.servletbridge@start,org.eclipse.equinox.http.registry@start


I really think it cannot be right that the programmer has to add *all* these bundles manually to the config.ini. There must be some better solution, some rules, or tooling ... whatever.

Anyway, the result of this run is attached in a file (too long to paste here). Basically the same error messages as previously. This:
!ENTRY org.eclipse.update.configurator 4 0 2013-05-10 20:57:42.655
!MESSAGE Unable to find feature.xml in directory: E:\Java_Eclipse\deploy\myapp\features\org.myapp._feature_1.0.0.M01.j
ar

and this:
java.lang.NoClassDefFoundError: org/eclipse/jface/action/IAction

... and this, although there are "No unsresolved constraints". Doesn't make sense to me...

Quote:

Make sure you start the platform with -consolelog to see exceptions that prevent
bundles from starting.


No plugins seem to have any problem, "diag" always returns that there are no unresolved constraints. (I tried several different plugins.)

Quote:

BTW, you included some test bundles that are needless at runtime:


OK. I had them removed earlier and added them back "just in case" they were the source of my problems. I have now again removed every bundle with "junit" in its name. There are a few more unused bundles currently but I reckon I better leave them in because I probably will need them later ... that is, if I ever get this to run.

Matthias Basler
  • Attachment: console.txt
    (Size: 12.61KB, Downloaded 69 times)
Re: Trouble deploying RAP application in Jetty in Equinox [message #1058213 is a reply to message #1058074] Mon, 13 May 2013 08:55 Go to previous messageGo to next message
Ralf Sternberg is currently offline Ralf Sternberg
Messages: 1291
Registered: July 2009
Senior Member

Hi Matthias,

I don't know why this JFace class cannot be loaded, but it's likely a
follow-up error.

Could you first try to leave out the bundle o.e.update.configurator?
This is a bundle that tries to install everything it finds in the
plugins directory. It seems to try to load a zipped feature which will
not work.

You also have to remove servletbridge and servletbridge.extensionbundle.
These are used to run Equinox in a WAR deployment. The extensionbundle
exports the servlet container's javax.servlet implementation to OSGi.
These bundles are not needed and will interfere with a plain
Equinox/Jetty deployment.

I agree that you should not write your config.ini manually. Usually you
will have your build create it for you. For experimentation, you can
export a product from an OSGi launch configuration. There are
ready-to-run containers such as Virgo Nano [1] that simplify the deployment.

Regards,
Ralf

[1] http://www.eclipse.org/virgo/deliverables/

--
Ralf Sternberg

Twitter: @EclipseRAP
Blog: http://eclipsesource.com/blogs/

Professional services for RAP and RCP?
http://eclipsesource.com/services/rap/
Re: Trouble deploying RAP application in Jetty in Equinox [message #1058381 is a reply to message #1058213] Mon, 13 May 2013 19:26 Go to previous messageGo to next message
Matthias Basler is currently offline Matthias Basler
Messages: 4
Registered: July 2009
Junior Member
Hi Ralf,

thanks to you I am a big step further today. Surprised
I got my application running on Jetty. But my findings are interesting:


  • As you said the servletbridge and servletbridge.extensionbundle bundles had to be removed from the plugins directory. I believe this did the actual trick of making the RAP application work without the problem of "missing dependencies" that were actually there.
  • The org.eclipse.update.configurator plugin is an interesting one, and a valuable one that should not be removed imho. Without this plugin in the beginning of the "osgi.bundles=..." list, I have to add every plugin manually and in the correct order of dependency into config.ini. I did this and ended up with a list of 46 bundles after dozens of try-and-error runs.
    However, with the org.eclipse.update.configurator plugin OSGi finds all dependencies itself within the plugins directory, which means that the list shrinks down to a fraction!

I ended up with following generic, working config.ini:
eclipse.ignoreApp=true
eclipse.exitOnError=false
osgi.noShutdown=true
org.osgi.service.http.port=7070
osgi.bundles.defaultStartLevel=4
osgi.bundles=org.eclipse.equinox.common@2:start,org.eclipse.update.configurator@3:start,org.eclipse.jetty.servlet@start,org.eclipse.rap.rwt.osgi@start,org.eclipse.equinox.http.jetty@start,org.eclipse.equinox.http.registry@start


Of course I still get the warnings about not "finding feature.xml", but can live with that, because to my surprise in the above configuration I don't even need any specific plugins for either RWT, JFace or the workbench, neither for my own application! They are all found automagically by the update.configurator plugin, it seems.

As the RAP book said:
Quote:

org.eclipse.update.configurator [...] takes care of installing all available plug-ins into OSGi.


The only strange thing is that Fabian Lange in his book combined this with the use of loading (jarred) features via the "osgi.bundles=" list. This clearly doesn't work for me. Maybe he also got errors concerning the features and didn't realize that the features were not actually loaded, because they didn't need to and the application did run anyway just as for me now. I'm just guessing.

Not sure I understood everything, but a configuration as simple as the above one is at least a good starting point for application development.

Quote:

For experimentation, you can export a product from an OSGi launch configuration.


Sounds good, but I cannot find this export option anywhere, neither in the package explorer on the .launch file, nor in the run or debug dialog which use this launch configuration.

P.S. Thanks for the tip with Virgo Nano. I will have a look at it when I have some time.

Matthias
Re: Trouble deploying RAP application in Jetty in Equinox [message #1059262 is a reply to message #1058381] Wed, 15 May 2013 09:49 Go to previous message
Ralf Sternberg is currently offline Ralf Sternberg
Messages: 1291
Registered: July 2009
Senior Member

Hi Matthias,

good to hear that you got it working. If the update configurator works
for you, that's fine. I remember that it was once causing errors because
it installs everything it can find, and so we stopped using it long ago.
A common alternative is the simple configurator [1] which reads a list
of bundles from a file.

>> For experimentation, you can export a product from an OSGi launch
>> configuration.
>
>
> Sounds good, but I cannot find this export option anywhere, neither in
> the package explorer on the .launch file, nor in the run or debug dialog
> which use this launch configuration.

You can create a product configuration using New > Product Configuration
and choose an existing launch configuration on the first page of the
wizard. Unfortunately, it doesn't consider RAP launch configs, only
plain OSGi ones.

I know that some folks used this approach, but I'm currently unable to
export from such a product. Not sure if there's a problem with PDE or if
I miss something...

Regards,
Ralf


[1] http://wiki.eclipse.org/Configurator

--
Ralf Sternberg

Twitter: @EclipseRAP
Blog: http://eclipsesource.com/blogs/

Professional services for RAP and RCP?
http://eclipsesource.com/services/rap/
Previous Topic:RAP-2.0 - UnsupportedOperationException in SimpleLifeCycle.sleep() Using JDialog.open().
Next Topic:Set style on Browser widget iframe
Goto Forum:
  


Current Time: Fri Oct 31 11:33:25 GMT 2014

Powered by FUDForum. Page generated in 0.02685 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software