Cannot start pax-web-jetty-bundle - Package uses conflict: Import-Package: org.ops4j.pax.web.service

27 views
Skip to first unread message

Daniel Stoch

unread,
May 8, 2020, 6:00:32 AM5/8/20
to OPS4J
Hi,

I have a strange error when trying to run a couple of bundles (using Equinox) including 4 from Pax-Web 7.2.10. In some other, more complex scenario, these Pax-Web also starts properly but I cannot find why.
- pax-web-api
- pax-web-spi
- pax-web-jetty-bundle
- pax-web-extender-whiteboard

These bundles could not be resolved:
- javax.servlet is exported by pax-web-jetty-bundle and it is needed by pax-web-api
- but pax-web-api exports org.ops4j.pax.web.service which is required by pax-web-jetty-bundle

org.osgi.framework.BundleException: The bundle "org.ops4j.pax.web.pax-web-api_7.2.10 [12]" could not be resolved. Reason: Missing Constraint: Import-Package: javax.servlet; version="[2.3.0,4.0.0)"
org.osgi.framework.BundleException: The bundle "org.ops4j.pax.web.pax-web-jetty-bundle_7.2.10 [5]" could not be resolved. Reason: Package uses conflict: Import-Package: org.ops4j.pax.web.service; version="7.2.10"
org.osgi.framework.BundleException: The bundle "org.ops4j.pax.web.pax-web-extender-whiteboard_7.2.10 [9]" could not be resolved. Reason: Missing Constraint: Import-Package: org.ops4j.pax.web.service; version="7.2.10"
org.osgi.framework.BundleException: The bundle "org.ops4j.pax.web.pax-web-spi_7.2.10 [20]" could not be resolved. Reason: Missing Constraint: Import-Package: org.ops4j.pax.web.service; version="7.2.10"


How to solve this problem (what can be wrong, how to diagnose it) or what am i doing wrong?

--
Best regards,
Daniel Stoch

Jean-Baptiste Onofré

unread,
May 11, 2020, 1:34:36 AM5/11/20
to OPS4J
Hi,

If you take a look on the Jetty Karaf feature, you can see the javax.servlet is installed as bundle:


So you have to do the same. As Pax Web is "container" agnostic (meaning it can run tomcat, jetty, undertow), the API can't use package provided by impl bundle.
That's why you have to install javax.servlet bundle for pax-web-api.

Furthermore, pax-web-jetty bundle also imports javax.servlet: https://github.com/ops4j/org.ops4j.pax.web/blob/pax-web-7.2.x/pax-web-jetty/pom.xml#L68

So, if you just install javax.servlet bundle, it will just run fine.

PS: Karaf simplify a lot the installation thanks to the features.

Regards
JB

--
--
------------------
OPS4J - http://www.ops4j.org - op...@googlegroups.com

---
You received this message because you are subscribed to the Google Groups "OPS4J" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ops4j+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ops4j/05b0f11c-54c2-46b2-a30a-11bf5b8a40ea%40googlegroups.com.

Daniel Stoch

unread,
May 11, 2020, 10:12:57 AM5/11/20
to OPS4J
Hi,

Thanks for your explanation. So I must use independent javax.servlet bundle.

It is a little bit strange for me, because I have this problem in one app, but in my other more complex app it just works without such independent javax.servlet bundle.
And it looks like all bundles get javax.servlet imports from org.ops4j.pax.web.pax-web-jetty-bundle_7.2.10.

osgi> bundle 152

org.ops4j.pax.web.pax-web-api_7.2.10 [152]

...

 Imported packages

    javax.servlet; version="3.1.0"<org.ops4j.pax.web.pax-web-jetty-bundle_7.2.10 [306]>

    javax.servlet.annotation; version="3.1.0"<org.ops4j.pax.web.pax-web-jetty-bundle_7.2.10 [306]>

    javax.servlet.http; version="3.1.0"<org.ops4j.pax.web.pax-web-jetty-bundle_7.2.10 [306]>



Regards,
DS

W dniu poniedziałek, 11 maja 2020 07:34:36 UTC+2 użytkownik Jean-Baptiste Onofré napisał:
Hi,

If you take a look on the Jetty Karaf feature, you can see the javax.servlet is installed as bundle:


So you have to do the same. As Pax Web is "container" agnostic (meaning it can run tomcat, jetty, undertow), the API can't use package provided by impl bundle.
That's why you have to install javax.servlet bundle for pax-web-api.

Furthermore, pax-web-jetty bundle also imports javax.servlet: https://github.com/ops4j/org.ops4j.pax.web/blob/pax-web-7.2.x/pax-web-jetty/pom.xml#L68

So, if you just install javax.servlet bundle, it will just run fine.

PS: Karaf simplify a lot the installation thanks to the features.

Regards
JB

On Fri, May 8, 2020 at 12:00 PM Daniel Stoch <danie...@gmail.com> wrote:
Hi,

I have a strange error when trying to run a couple of bundles (using Equinox) including 4 from Pax-Web 7.2.10. In some other, more complex scenario, these Pax-Web also starts properly but I cannot find why.
- pax-web-api
- pax-web-spi
- pax-web-jetty-bundle
- pax-web-extender-whiteboard

These bundles could not be resolved:
- javax.servlet is exported by pax-web-jetty-bundle and it is needed by pax-web-api
- but pax-web-api exports org.ops4j.pax.web.service which is required by pax-web-jetty-bundle

org.osgi.framework.BundleException: The bundle "org.ops4j.pax.web.pax-web-api_7.2.10 [12]" could not be resolved. Reason: Missing Constraint: Import-Package: javax.servlet; version="[2.3.0,4.0.0)"
org.osgi.framework.BundleException: The bundle "org.ops4j.pax.web.pax-web-jetty-bundle_7.2.10 [5]" could not be resolved. Reason: Package uses conflict: Import-Package: org.ops4j.pax.web.service; version="7.2.10"
org.osgi.framework.BundleException: The bundle "org.ops4j.pax.web.pax-web-extender-whiteboard_7.2.10 [9]" could not be resolved. Reason: Missing Constraint: Import-Package: org.ops4j.pax.web.service; version="7.2.10"
org.osgi.framework.BundleException: The bundle "org.ops4j.pax.web.pax-web-spi_7.2.10 [20]" could not be resolved. Reason: Missing Constraint: Import-Package: org.ops4j.pax.web.service; version="7.2.10"


How to solve this problem (what can be wrong, how to diagnose it) or what am i doing wrong?

--
Best regards,
Daniel Stoch

--
--
------------------
OPS4J - http://www.ops4j.org - op...@googlegroups.com

---
You received this message because you are subscribed to the Google Groups "OPS4J" group.
To unsubscribe from this group and stop receiving emails from it, send an email to op...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages