Home » Eclipse Projects » Remote Application Platform (RAP) » RAP in standalone OSGi javax.servlet import constraint(Problems running RAP in standalone OSGi)
RAP in standalone OSGi javax.servlet import constraint [message #1060370] |
Fri, 24 May 2013 10:31 |
|
As a unit-test environment I was hoping to be able to configure a very simple OSGI environment to test my RAP (and TABRIS) applications. However, I'm running into a problem where javax.servlet cannot be satisfied.
I know similar issues have been posted numerous times in the past, but none of them seem to directly address the situation I'm facing, so I wonder if someone could point me in the right direction... I'm sure it is something simple to fix...
Firstly, here is the output from the OSGI console, which I'm launching from a Command Prompt in Windows:
osgi> ss
"Framework is launched."
id State Bundle
0 ACTIVE org.eclipse.osgi_3.9.0.v20130305-2200
Fragments=36
1 ACTIVE com.ibm.icu.base_50.1.0.v20121116-2
2 INSTALLED iet.co.uk.rapide.RAP_85.80.0
3 ACTIVE javax.xml_1.3.4.v201005080400
4 ACTIVE org.apache.felix.gogo.command_0.10.0.v201209301215
5 ACTIVE org.apache.felix.gogo.runtime_0.10.0.v201209301036
6 ACTIVE org.apache.felix.gogo.shell_0.10.0.v201212101605
7 ACTIVE org.eclipse.core.commands_3.6.100.v20130220-2151
8 ACTIVE org.eclipse.core.contenttype_3.4.200.v20130221-0103
9 ACTIVE org.eclipse.core.databinding_1.4.1.v20130220-2151
10 ACTIVE org.eclipse.core.databinding.beans_1.2.200.v20130220-2151
11 ACTIVE org.eclipse.core.databinding.observable_1.4.1.v20130220-2151
12 ACTIVE org.eclipse.core.databinding.property_1.4.200.v20130220-2151
13 ACTIVE org.eclipse.core.expressions_3.4.500.v20130221-0103
14 ACTIVE org.eclipse.core.jobs_3.5.300.v20130221-0103
15 ACTIVE org.eclipse.core.runtime_3.9.0.v20130221-0103
16 ACTIVE org.eclipse.equinox.app_1.3.100.v20130225-1702
17 ACTIVE org.eclipse.equinox.common_3.6.100.v20130225-1702
18 ACTIVE org.eclipse.equinox.console_1.0.100.v20130225-1702
19 INSTALLED org.eclipse.equinox.http.registry_1.1.200.v20130225-1702
20 INSTALLED org.eclipse.equinox.http.servlet_1.1.300.v20130225-1702
21 INSTALLED org.eclipse.equinox.http.servletbridge_1.0.300.v20130225-1702
22 ACTIVE org.eclipse.equinox.preferences_3.5.0.v20130225-1702
23 ACTIVE org.eclipse.equinox.registry_3.5.300.v20130225-1702
24 INSTALLED org.eclipse.equinox.servletbridge_1.2.200.v20130225-1702
25 ACTIVE org.eclipse.equinox.util_1.0.400.v20130307-2007
26 ACTIVE org.eclipse.help_3.6.0.v20130221-0120
27 ACTIVE org.eclipse.osgi.services_3.3.100.v20130225-1645
28 INSTALLED org.eclipse.rap.clientscripting_0.1.100.201305241038
29 INSTALLED org.eclipse.rap.jface_2.1.0.20130225-1108
30 INSTALLED org.eclipse.rap.jface.databinding_2.1.0.20130220-2001
31 INSTALLED org.eclipse.rap.rwt_2.1.0.20130410-0853
32 INSTALLED org.eclipse.rap.rwt.osgi_2.1.0.20130220-2001
33 INSTALLED org.eclipse.rap.ui_2.1.0.20130220-2001
34 INSTALLED org.eclipse.rap.ui.forms_2.1.0.20130306-1637
35 INSTALLED org.eclipse.rap.ui.views_2.1.0.20130220-2001
36 RESOLVED org.eclipse.equinox.servletbridge.extensionbundle_1.2.100.v20120522-2049
Master=0
37 INSTALLED org.eclipse.rap.ui.workbench_2.1.0.20130225-1531
osgi> start 31
gogo: BundleException: The bundle "org.eclipse.rap.rwt_2.1.0.20130410-0853 [31]" could not be resolved. Reason: Missing Constraint:
Import-Package: javax.servlet; version="[2.3.0,4.0.0)"
osgi>
As you can see, then explicit start of bundle 31 (rap.rwt) is failing because of javax.servlet. Various other issues, but this is the root issue I think.
Now, I've got org.eclipse.equinox.servletbridge.extensionbundle included as a Bundle, which you can see at Bundle/Fragment 36 as RESOLVED. I believe this is correct, as the extensionbundle is a Fragment, so cannot be started as such?
extensionbundle exports javax.servlet, in this case with a version of "2.5", as you can see from the manifest within it:
...
X-Deploy-Export-Package: javax.servlet;version="2.5",javax.servlet.htt
p;version ="2.5",javax.servlet.resources;version="2.5",org.eclipse.eq
uinox.servletbridge;version="1.1"
...
So, why can't I start rap.rwt's bundle? Why can it not find javax.servlet?
Final piece of information... here is the config.ini from the configuration subdirectory below where I'm starting OSGI:
#Product Runtime Configuration File
osgi.bundles.defaultStartLevel=4
osgi.console=9090
osgi.console.enable.builtin=false
osgi.bundles=com.ibm.icu.base@start,\
iet.co.uk.rapide.RAP@start,\
javax.xml@start,\
org.apache.felix.gogo.command@start,\
org.apache.felix.gogo.runtime@start,\
org.apache.felix.gogo.shell@start,\
org.eclipse.core.commands@start,\
org.eclipse.core.contenttype@start,\
org.eclipse.core.databinding@start,\
org.eclipse.core.databinding.beans@start,\
org.eclipse.core.databinding.observable@start,\
org.eclipse.core.databinding.property@start,\
org.eclipse.core.expressions@start,\
org.eclipse.core.jobs@start,\
org.eclipse.core.runtime@start,\
org.eclipse.equinox.app@start,\
org.eclipse.equinox.common@start,\
org.eclipse.equinox.console@start,\
org.eclipse.equinox.http.registry@start,\
org.eclipse.equinox.http.servlet@start,\
org.eclipse.equinox.http.servletbridge@start,\
org.eclipse.equinox.preferences@start,\
org.eclipse.equinox.registry@start,\
org.eclipse.equinox.servletbridge@start,\
org.eclipse.equinox.util@start,\
org.eclipse.help@start,\
org.eclipse.osgi.services@start,\
org.eclipse.rap.clientscripting@start,\
org.eclipse.rap.jface@start,\
org.eclipse.rap.jface.databinding@start,\
org.eclipse.rap.rwt@start,\
org.eclipse.rap.rwt.osgi@start,\
org.eclipse.rap.ui@start,\
org.eclipse.rap.ui.forms@start,\
org.eclipse.rap.ui.views@start,\
org.eclipse.equinox.servletbridge.extensionbundle,\
org.eclipse.rap.ui.workbench@start
Thanks, John
---
Just because you can doesn't mean you should
|
|
|
Re: RAP in standalone OSGi javax.servlet import constraint [message #1060426 is a reply to message #1060370] |
Fri, 24 May 2013 15:18 |
|
Hi John,
the servletbridge extension bundle is only needed in a WAR deployment.
It's purpose is to expose the servlet container's javax.servlet to the
OSGi environment. When you include the extensionbundle in a normal OSGi
environment it will lead to exactly the problem you described, because
this bundle pretends to provide javax.servlet but it doesn't (it only
does in a servletbridge environment).
BTW, the extensionbundle has been removed from the platform in Kepler.
It can be created at runtime and is not needed in the platform at all
(however in a WAR deployment, it has to be started).
Does that answer your question?
Regards,
Ralf
--
Ralf Sternberg
Twitter: @EclipseRAP
Blog: http://eclipsesource.com/blogs/
Professional services for RAP and RCP?
http://eclipsesource.com/services/rap/
|
|
|
Re: RAP in standalone OSGi javax.servlet import constraint [message #1061207 is a reply to message #1060426] |
Thu, 30 May 2013 14:19 |
|
Thanks Ralf,
So, I removed the servlet extension bundle, and added in javax.servlet, and this resolved the import problem and allowed all bundles to start up.
However, I'm not sure if my bundle is available, and if so, how do I connect to it's entry point?
By the way, I've moved on to Tabris for the time-being, but I assume the principle is the same.
Here is my latest attempt:
config.ini:
#Product Runtime Configuration File
osgi.bundles.defaultStartLevel=4
osgi.bundles=com.eclipsesource.tabris@start,\
iet.co.uk.rapide.TABRIS@start,\
org.apache.felix.gogo.command@start,\
org.apache.felix.gogo.runtime@start,\
org.apache.felix.gogo.shell@start,\
org.eclipse.core.commands@start,\
org.eclipse.equinox.common@start,\
org.eclipse.equinox.console@start,\
org.eclipse.equinox.http.servlet@start,\
org.eclipse.equinox.http.servletbridge@start,\
org.eclipse.equinox.servletbridge@start,\
org.eclipse.osgi.services@start,\
org.eclipse.rap.jface@start,\
org.eclipse.rap.rwt@start,\
org.eclipse.rap.rwt.osgi@start,\
org.eclipse.rap.clientscripting@start,\
javax.servlet@start
Console output, showing ss results (all bundles ACTIVE):
osgi> ss
"Framework is launched."
id State Bundle
0 ACTIVE org.eclipse.osgi_3.9.0.v20130513-1345
1 ACTIVE com.eclipsesource.tabris_1.1.0.201305301409
2 ACTIVE iet.co.uk.rapide.TABRIS_85.80.0
3 ACTIVE org.apache.felix.gogo.command_0.10.0.v201209301215
4 ACTIVE org.apache.felix.gogo.runtime_0.10.0.v201209301036
5 ACTIVE org.apache.felix.gogo.shell_0.10.0.v201212101605
6 ACTIVE org.eclipse.core.commands_3.6.100.v20130515-1857
7 ACTIVE org.eclipse.equinox.common_3.6.200.v20130402-1505
8 ACTIVE org.eclipse.equinox.console_1.0.100.v20130429-0953
9 ACTIVE org.eclipse.equinox.http.servlet_1.1.400.v20130418-1354
10 ACTIVE org.eclipse.equinox.http.servletbridge_1.0.300.v20130327-1442
11 ACTIVE org.eclipse.equinox.servletbridge_1.2.300.v20130508-1243
12 ACTIVE org.eclipse.osgi.services_3.3.100.v20130513-1956
13 ACTIVE org.eclipse.rap.jface_2.1.0.20130506-1748
14 ACTIVE org.eclipse.rap.rwt_2.1.0.20130520-1326
15 ACTIVE org.eclipse.rap.rwt.osgi_2.1.0.20130506-1748
16 ACTIVE org.eclipse.rap.clientscripting_0.1.100.201305301409
17 ACTIVE javax.servlet_3.0.0.v201112011016
osgi>
Log file within configuration folder:
!SESSION 2013-05-30 15:03:06.424 -----------------------------------------------
eclipse.buildId=unknown
java.version=1.6.0_22
java.vendor=Sun Microsystems Inc.
BootLoader constants: OS=win32, ARCH=x86, WS=win32, NL=en_GB
Command-line arguments: -clean -console
!ENTRY org.eclipse.osgi 4 0 2013-05-30 15:03:07.182
!MESSAGE Application error
!STACK 1
java.lang.IllegalStateException: Unable to acquire application service. Ensure that the org.eclipse.core.runtime bundle is resolved and started (see config.ini).
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:74)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:354)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:181)
at org.eclipse.core.runtime.adaptor.EclipseStarter.main(EclipseStarter.java:152)
I can see there are reported issues above, but am loathed to add the eclipse bundles in, as I cannot see why they would genuinely be required, and the knock-on chain is quite long!
In my 'rapide' bundle is my application's Entry Point, defined by its manifest with an appropriate Activator. I know the code is correct because I'm able to use this within a WAR in WebLogic (for example).
Here is my jar's manifest:
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %Bundle-Name
Bundle-SymbolicName: iet.co.uk.rapide.TABRIS;singleton:=true
Bundle-Version: 85.80.0
Bundle-Vendor: %Bundle-Vendor
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Export-Package: uk.co.iet.rapide
Bundle-ClassPath: .,WEB-INF/lib/gen80rt.jar,WEB-INF/lib/jna.jar
Import-Package: org.eclipse.jface.fieldassist,org.eclipse.jface.layout,org.eclipse.osgi.baseadaptor.bundlefile,org.eclipse.rap.clientscripting
Bundle-Activator: uk.co.iet.rapide.tabris.Activator
Require-Bundle: org.eclipse.rap.rwt;bundle-version="2.0.0",org.eclipse.osgi,com.eclipsesource.tabris;bundle-version="1.0.0",javax.servlet;bundle-version="3.0.0"
Bundle-ClassPath:
.,WEB-INF/lib/gen80rt.jar
,WEB-INF/Demo/resources.jar
,WEB-INF/Demo/rapide_strings.jar
,WEB-INF/Demo/DEMO.jar
,WEB-INF/Demo/MOBDEMO.jar
I tried the above manifest with and without the javax.servlet bundle dependency, which didn't appear to have any effect either way.
I expected to be able to access my application from a browser with url:
"http://127.0.0.1:9090/demo" where 'demo' is my Entry Point, but I'm unsure where to specify the port (which could simply be the only problem I'm left with!). If I specify "-console 9090" when starting OSGi, I get no console (so cannot use 'ss' for example), and my web browser (Chrome in this case), thinks I'm trying to download a file with the above URL.
So, all in all, I'm getting a bit confused, so would appreciate further pointers if you are able!
Many thanks, John
---
Just because you can doesn't mean you should
|
|
|
Re: RAP in standalone OSGi javax.servlet import constraint [message #1061223 is a reply to message #1061207] |
Thu, 30 May 2013 15:16 |
|
Ok, been bashing away experimenting further and have got it 'sort of' working...
Here's my config.ini with JETTY added, which I think was the primary source of my problems:
#Product Runtime Configuration File
osgi.bundles.defaultStartLevel=4
osgi.bundles=com.eclipsesource.tabris@start,\
iet.co.uk.rapide.TABRIS@start,\
org.apache.felix.gogo.command@start,\
org.apache.felix.gogo.runtime@start,\
org.apache.felix.gogo.shell@start,\
org.eclipse.core.commands@start,\
org.eclipse.equinox.common@start,\
org.eclipse.equinox.console@start,\
org.eclipse.equinox.http.servlet@start,\
org.eclipse.equinox.http.servletbridge@start,\
org.eclipse.equinox.servletbridge@start,\
org.eclipse.equinox.http.jetty@start,\
org.eclipse.jetty.http@start,\
org.eclipse.jetty.io@start,\
org.eclipse.jetty.util@start,\
org.eclipse.jetty.server@start,\
org.eclipse.jetty.continuation@start,\
org.eclipse.jetty.servlet@start,\
org.eclipse.jetty.security@start,\
org.eclipse.osgi.services@start,\
org.eclipse.rap.jface@start,\
org.eclipse.rap.rwt@start,\
org.eclipse.rap.rwt.osgi@start,\
org.eclipse.rap.clientscripting@start,\
javax.servlet@start
Now the problem I have is that Jetty is starting to listen on default port 80, which is no good for me, as I also have IIS on my workstation. I'd like to use port 9090, but where do I specify this?
Almost there!!
Thanks, John
---
Just because you can doesn't mean you should
|
|
|
Re: RAP in standalone OSGi javax.servlet import constraint [message #1061230 is a reply to message #1061223] |
Thu, 30 May 2013 15:42 |
|
Ok, so I thought this was going to be beyond my skills, but I've plugged away and (thanks to Google), just adding the following lines to the config.ini file allows me to choose the port for Jetty:
...
jetty.port=9090
org.osgi.service.http.port=9090
...
So, all is cool, and I have working OSGi stand-alone for testing my RAP and Tabris applications. Nice.
J
---
Just because you can doesn't mean you should
|
|
|
Goto Forum:
Current Time: Wed May 08 03:27:49 GMT 2024
Powered by FUDForum. Page generated in 0.04264 seconds
|