我该如何解决 XMLStreamException

发布于 2025-01-05 04:31:18 字数 1817 浏览 1 评论 0原文

我正在使用 REST Web 服务,并且需要解析使用 jaxb 构建的 XML。我得到以下异常。请帮我解决这个问题,提前致谢

java.lang.NoClassDefFoundError: javax/xml/stream/XMLStreamException
com.sun.xml.bind.v2.runtime.JAXBContextImpl.createMarshaller(JAXBContextImpl.java:686)
com.sun.xml.bind.v2.runtime.JAXBContextImpl.createMarshaller(JAXBContextImpl.java:116)
com.sun.jersey.core.provider.jaxb.AbstractJAXBProvider.getMarshaller(AbstractJAXBProvider.java:167)
com.sun.jersey.core.provider.jaxb.AbstractJAXBProvider.getMarshaller(AbstractJAXBProvider.java:140)
com.sun.jersey.core.provider.jaxb.AbstractRootElementProvider.writeTo(AbstractRootElementProvider.java:138)
com.sun.jersey.api.client.TerminatingClientHandler.writeRequestEntity(TerminatingClientHandler.java:317)
com.sun.jersey.client.urlconnection.URLConnectionClientHandler._invoke(URLConnectionClientHandler.java:179)
com.sun.jersey.client.urlconnection.URLConnectionClientHandler.handle(URLConnectionClientHandler.java:126)
com.sun.jersey.api.client.Client.handle(Client.java:435)
com.sun.jersey.api.client.WebResource.handle(WebResource.java:557)
com.sun.jersey.api.client.WebResource.access$300(WebResource.java:69)
com.sun.jersey.api.client.WebResource$Builder.put(WebResource.java:475)
np.com.ntech.dto.EtopupClient.purchasePin(EtopupClient.java:54)
np.com.ntech.dto.App.pinRequest(App.java:264)
org.apache.jsp.fundtransfer.card_jsp._jspService(card_jsp.java:371)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:94)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:324)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)

I am using REST web service and i need to parse the XML that is build using the jaxb. I get the following exception. Please help me solve this issue thank in advance

java.lang.NoClassDefFoundError: javax/xml/stream/XMLStreamException
com.sun.xml.bind.v2.runtime.JAXBContextImpl.createMarshaller(JAXBContextImpl.java:686)
com.sun.xml.bind.v2.runtime.JAXBContextImpl.createMarshaller(JAXBContextImpl.java:116)
com.sun.jersey.core.provider.jaxb.AbstractJAXBProvider.getMarshaller(AbstractJAXBProvider.java:167)
com.sun.jersey.core.provider.jaxb.AbstractJAXBProvider.getMarshaller(AbstractJAXBProvider.java:140)
com.sun.jersey.core.provider.jaxb.AbstractRootElementProvider.writeTo(AbstractRootElementProvider.java:138)
com.sun.jersey.api.client.TerminatingClientHandler.writeRequestEntity(TerminatingClientHandler.java:317)
com.sun.jersey.client.urlconnection.URLConnectionClientHandler._invoke(URLConnectionClientHandler.java:179)
com.sun.jersey.client.urlconnection.URLConnectionClientHandler.handle(URLConnectionClientHandler.java:126)
com.sun.jersey.api.client.Client.handle(Client.java:435)
com.sun.jersey.api.client.WebResource.handle(WebResource.java:557)
com.sun.jersey.api.client.WebResource.access$300(WebResource.java:69)
com.sun.jersey.api.client.WebResource$Builder.put(WebResource.java:475)
np.com.ntech.dto.EtopupClient.purchasePin(EtopupClient.java:54)
np.com.ntech.dto.App.pinRequest(App.java:264)
org.apache.jsp.fundtransfer.card_jsp._jspService(card_jsp.java:371)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:94)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:324)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

吾性傲以野 2025-01-12 04:31:18

该类是在 Java 1.6 中引入的,因此您可能不小心在 Java 1.5 或类似的东西上运行应用程序服务器。

That class was introduced in Java 1.6 so you're probably accidentally running your application server on Java 1.5 or something like that.

若水般的淡然安静女子 2025-01-12 04:31:18

您可以下载这个也支持 java 1.5 的 jar,并且代码将不再给出此异常。

http://www.java2s.com/Code/Jar/j/Downloadjavaxxmlstream101jar。 htm

希望有帮助

You can download this jar it supported for java 1.5 as well and the code will not give this exception anymore.

http://www.java2s.com/Code/Jar/j/Downloadjavaxxmlstream101jar.htm

Hope it helps

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文