使用jaxb和jakarta使用jaxb,我在做什么错?

问题描述 投票:0回答:0
i当前正在研究一个项目,以创建一个网络界面来管理和与SQL数据库进行交互,我在我的Servlet和Tomcat V10.1中使用Jakarta.servlet.jstl,我现在正在尝试使用JAXB来添加该功能要以XML格式导出和导入数据,问题是我会得到以下错误

SEVERE: Servlet.service() for servlet [Servlets.VeiculoServlet] in context with path [/ExamplePath] threw exception [Servlet execution threw an exception] with root cause java.lang.ClassNotFoundException: org.glassfish.jaxb.core.v2.model.annotation.AnnotationReader
在线

JAXBContext context = JAXBContext.newInstance(ExportVeiculo.class);
我非常有信心这与我的项目中的图书馆设置有关,在这里是

On my WEB-INF lib folder 我的项目构建Path class Pather库

enter image description here这就是我如何导入它们的方式,在抛出错误的servlet中

我还尝试将所有JAR文件添加到服务器LIB文件夹中,但这似乎没有任何效果。 thank thank thank您提前,如果需要更多信息,我很乐意提供。 enter image description here

Edit1:

评论中的一些反馈后,我添加 然后,我在同一条线上遇到了一个不同的错误

SEVERE: Servlet.service() for servlet [Servlets.VeiculoServlet] in context with path [/ExamplePath] threw exception [Servlet execution threw an exception] with root cause java.lang.ClassNotFoundException: com.sun.istack.Pool I添加了istack-commons-runtime-3.0.1.jar,我现在在同一行中遇到一个不同的错误 SEVERE: Servlet.service() for servlet [Servlets.VeiculoServlet] in context with path [/ExamplePath] threw exception [Servlet execution threw an exception] with root cause java.lang.ClassNotFoundException: jakarta.activation.DataSource

Edit2:

我安装了Jakarta激活API»2.0.1,现在一切都在起作用。
	

i通过安装Jaxb-core-3.0.1.jar及其所有依赖项来解决我的问题。


java jaxb
最新问题
© www.soinside.com 2019 - 2025. All rights reserved.