OSGi:无法解析 javax.servlet

时间:2021-06-22 08:50:29

标签: java osgi osgi-bundle equinox

我有一个服务器端 OSGi 应用程序,它在一个 equinox 容器中运行。此应用程序使用 org.apache.felix.webconsole (4.6.2) 和其他包。这些其他包需要 javax.http > 4.0.0,我随 jakarta.servlet-api (4.0.0) 一起提供。 org.apache.felix.webconsole 需要 javax.servlet=[2.4.0,4.0.0),我随包 javax.servlet-api (3.1.0) 一起提供。

当我启动应用程序时,OSGi 运行时会抱怨 BundleExceptionCould not resolve module: org.apache.felix.webconsole / Unresolved requirement: Import-Package: javax.servlet; version="[2.4.0,4.0.0)"

我该怎么做才能解决这个问题?

1 个答案:

答案 0 :(得分:0)

从我可以了解到的错误中,OGSI 期望 javax-servlet 版本大于 2.4.0 所以你可以在你的 pom.xml 中检查这个依赖

<dependency>
   <groupId>javax.servlet</groupId>
    <artifactId>javax.servlet-api</artifactId>
    <version>3.1.0</version>
 </dependency>