gpt4 book ai didi

java - 由 : java. lang.ClassNotFoundException : com. fasterxml.jackson.databind.JavaType not found 引起

转载 作者:搜寻专家 更新时间:2023-10-31 08:32:04 27 4
gpt4 key购买 nike

我在我的应用程序中使用 jackson 库,当我构建代码(使用 ant)时,构建成功。我已经尝试通过在单元测试中使用这些方法进行模拟测试,并且效果很好。但是当启动 karaf 时,它给了我这个错误:

Caused by: java.lang.ClassNotFoundException: com.fasterxml.jackson.databind.JavaType not found by com.project.test.application [224]
at org.apache.felix.framework.BundleWiringImpl.findClassOrResourceByDelegation(BundleWiringImpl.java:1532)
at org.apache.felix.framework.BundleWiringImpl.access$400(BundleWiringImpl.java:75)
at org.apache.felix.framework.BundleWiringImpl$BundleClassLoader.loadClass(BundleWiringImpl.java:1955)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)

这些是我在 ivy.xml 中下载的 jar:

<dependency org="com.fasterxml.jackson.core" name="jackson-core" rev="2.4.4" transitive="false" />
<dependency org="com.fasterxml.jackson.core" name="jackson-annotations" rev="2.4.4" transitive="false" />
<dependency org="com.fasterxml.jackson.core" name="jackson-databind" rev="2.4.4" transitive="false" />

我试过更改版本,但仍然是同样的错误。下载后我必须加载这些 jar 吗?我将默认位置保留为 ivy-lib,并且该过程适用于我正在下载的所有其他 jar。出了什么问题?这是否需要特定版本或任何其他依赖项?还是有其他方式加载这些 jar 文件?

我在 build.xml 中的类路径

<path id="compile.classpath">
<fileset dir="${ivy.lib}">
<include name="*.jar"/>
</fileset>
</path>

最佳答案

我收到此错误是因为其他类(class)的其他人正在使用 org.codehaus.jackson 包,而我正在使用 com.fasterxml.jackson 包。由于 jars 的这种冲突,它抛出了这个 ClassNotFoundException。一旦我删除了那些 fasterxml jar 并将其替换为 codehaus jar ,它就开始正常工作了。

关于java - 由 : java. lang.ClassNotFoundException : com. fasterxml.jackson.databind.JavaType not found 引起,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40317682/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com