gpt4 book ai didi

json - GlassFish 4.0/Jersey 2.0 - JsonStructureBodyReader 的 NoClassDefFoundError

转载 作者:行者123 更新时间:2023-12-01 08:03:51 26 4
gpt4 key购买 nike

我在我的开发系统上使用 GlassFish 4.0 R89,使用 JAX-RS。简单的调用工作,所以我可以得到一个序列化的对象,用 XML 表示。我必须将它安装在一个也将参与编码过程的人的机器上,我也在我的笔记本上尝试过 - 我得到了相同的结果 - 为类 JsonStructureBodyReader 抛出了 NoClassDefFoundError (虽然我'我什至没有使用 JSON,试过了,服务器肯定会返回带有内容类型正确 header 的 XML)。

我以为我可能错误地导入了一个项目,但是在比较了工作版本和非工作版本中的文件之后,我意识到似乎没有可能对此负责的差异(项目更多或两台机器上的相等)。

我想也许GF版本有问题,所以我检查了一下,但两个安装都是R89。但是: GFs modules/目录中的 jars 似乎有所不同,尤其是在进行二进制比较时。

有没有人遇到过这个问题?

这是完整的堆栈跟踪:

Exception in thread "AWT-EventQueue-0" java.lang.NoClassDefFoundError: org/glassfish/json/jaxrs/JsonStructureBodyReader
at org.glassfish.jersey.jsonp.JsonProcessingFeature.configure(JsonProcessingFeature.java:69)
at org.glassfish.jersey.model.internal.CommonConfig.configureFeatures(CommonConfig.java:617)
at org.glassfish.jersey.model.internal.CommonConfig.configureMetaProviders(CommonConfig.java:558)
at org.glassfish.jersey.client.ClientConfig$State.initRuntime(ClientConfig.java:361)
at org.glassfish.jersey.client.ClientConfig$State.access$000(ClientConfig.java:84)
at org.glassfish.jersey.client.ClientConfig$State$3.get(ClientConfig.java:116)
at org.glassfish.jersey.client.ClientConfig$State$3.get(ClientConfig.java:113)
at org.glassfish.jersey.internal.util.collection.Values$LazyValue.get(Values.java:275)
at org.glassfish.jersey.client.ClientConfig.getRuntime(ClientConfig.java:667)
at org.glassfish.jersey.client.ClientRequest.getClientRuntime(ClientRequest.java:169)
at org.glassfish.jersey.client.JerseyInvocation.invoke(JerseyInvocation.java:644)
at org.glassfish.jersey.client.JerseyInvocation$Builder.method(JerseyInvocation.java:375)
at org.glassfish.jersey.client.JerseyInvocation$Builder.get(JerseyInvocation.java:275)
at my.application.client.webservice.data.IssueClient.getIssues(IssueClient.java:50)
at my.application.client.webservice.data.IssueClient.getIssues(IssueClient.java:30)
at my.application.client.modules.issuetracker.IssueTracker.getTableData(IssueTracker.java:182)
at my.application.client.modules.issuetracker.IssueTracker.drawComponents(IssueTracker.java:80)
at my.application.client.modules.issuetracker.IssueTracker.<init>(IssueTracker.java:59)
at my.application.client.actions.ShowIssueTrackerAction.fire(ShowIssueTrackerAction.java:37)
at my.application.client.gui.PVAppMenu$2.actionPerformed(PVAppMenu.java:49)
at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source)
at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)
at javax.swing.DefaultButtonModel.setPressed(Unknown Source)
at javax.swing.AbstractButton.doClick(Unknown Source)
at javax.swing.plaf.basic.BasicMenuItemUI.doClick(Unknown Source)
at javax.swing.plaf.basic.BasicMenuItemUI$Handler.mouseReleased(Unknown Source)
at java.awt.Component.processMouseEvent(Unknown Source)
at javax.swing.JComponent.processMouseEvent(Unknown Source)
at java.awt.Component.processEvent(Unknown Source)
at java.awt.Container.processEvent(Unknown Source)
at java.awt.Component.dispatchEventImpl(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Window.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.EventQueue.dispatchEventImpl(Unknown Source)
at java.awt.EventQueue.access$200(Unknown Source)
at java.awt.EventQueue$3.run(Unknown Source)
at java.awt.EventQueue$3.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source)
at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source)
at java.awt.EventQueue$4.run(Unknown Source)
at java.awt.EventQueue$4.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.run(Unknown Source)

最佳答案

如果您不使用 JSON(JSON Processing 库),则应删除 jersey-media-json-processing来自客户端类路径的模块(似乎在 GF 之外)。该模块依赖于 jsonp-jaxrs.jar (+ javax.json.jar , javax.json-api.jar ) 其中包含 JsonStructureBodyReader .问题是每次jersey-media-json-processing模块位于类路径上 Jersey 尝试通过 Auto-Discoverable 注册 JSON 处理提供程序机制。这意味着在缺少依赖项的情况下,会遇到与您类似的异常。

关于json - GlassFish 4.0/Jersey 2.0 - JsonStructureBodyReader 的 NoClassDefFoundError,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18333441/

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