apache-karaf - apache karaf 中的 ClassNotFoundException 错误
问题描述
我在文件中添加了contect-param
选项卡web.xml
<context-param>
<param-name>blueprintLocation</param-name>
<param-value>OSGI-INF/blueprint/blueprint.xml</param-value>
</context-param>
也在文件listner
中类web.xml
<listener>
<listener-class>org.apache.aries.blueprint.web.BlueprintContextListener</listener-class>
</listener>
加载到 karaf 后,我收到以下错误:
java.lang.ClassNotFoundException:com.test.test.core.jsonstore-http-api 找不到 org.apache.aries.blueprint.web.BlueprintContextListener
如何解决这个问题?
解决方案
该错误表明您的包可能没有在他的 MANIFEST.MF 文件中导入包org.apache.aries.blueprint.web 。
有几种方法可以解决这个问题,如果您使用的是maven-bundle-plugin,您可以手动将包添加到Import-Package指令中,就像这样:
<plugins>
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<extensions>true</extensions>
<configuration>
<instructions>
<Import-Package>
org.apache.aries.blueprint.web,
*
</Import-Package>
</instructions>
</configuration>
</plugin>
</plugins>
如果您使用其他工具来生成清单,它应该与此类似。
推荐阅读
- c++ - 无法弄清楚为什么我的 if 语句不起作用:( if array[i] << average)
- python-3.x - 如何对具有相同大小的连续数字进行分组
- javascript - 从其他可观察对象切换 Rxjs 流
- java - Java 代码(按预期)适用于除一个输入之外的众多输入:500,000
- javascript - 动态图像数量时在html中水平分布
- package - Tidyverse 和 Magrittr 函数中的错误
- reactjs - 开玩笑模拟 window.scrollTo
- java - 如何使用 AWS Java SDK 以 s3api 查询获取对象列表?
- sql-server - 连接来自子查询的字符串
- javascript - 编译代码后如何使用nodemon?