GlassFish 4.0 / Jersey 2.0 - JsonStructureBodyReader的NoClassDefFoundError [英] GlassFish 4.0 / Jersey 2.0 - NoClassDefFoundError for JsonStructureBodyReader

查看:139
本文介绍了GlassFish 4.0 / Jersey 2.0 - JsonStructureBodyReader的NoClassDefFoundError的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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



我想我可能导入了一个错误的项目,但是在对工作和非工作版本的文件进行比较之后,我意识到似乎没有什么区别可以对此负责(两台计算机上的项目差不多都是相同的)。 p>

我想GF版本可能存在问题,所以我查了一下,但是这两个安装都是R89。但是:GFs模块/目录中的jar似乎有所不同,尤其是在进行二进制比较时。



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



以下是完整的堆栈跟踪:

 线程AWT-EventQueue-0中的异常java.lang.NoClassDefFoundError:org / glassfish / json / jaxrs / JsonStructureBodyReader $ b $ org.glassfish。 jersey.jsonp.JsonProcessingFeature.configure(JsonProcessingFeature.java:69)
在org.glassfish.jersey.model.internal.CommonConfig.configureFeatures(CommonConfig.java:617)
在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)
在org.glassfish.jersey.client.ClientConfig.getRuntime(ClientConfig.java:667)
在org.glassfish.jersey.client.ClientRequest.getClientRuntime(ClientRequest.java:169)
在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(ShowIssueTrac kerAction.java:37)
at my.application.client.gui.PVAppMenu $ 2.actionPerformed(PVAppMenu.java:49)
at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
在javax.swing.AbstractButton $ Handler.actionPerformed(Unknown Source)
at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)
at javax.swing.DefaultButtonModel.setPressed(Unknown Source)
在javax.swing.AbstractButton.doClick(未知源代码)
在javax.swing.plaf.basic.BasicMenuItemUI.doClick(未知源代码)
在javax.swing.plaf.basic.BasicMenuItemUI $ Handler.mouseReleased (未知源)
在java.awt.Component.processMouseEvent(未知源)
在javax.swing.JComponent.processMouseEvent(未知源)
在java.awt.Component.processEvent(未知源)java.awt.Container.processEvent处的
(未知源)java.awt.Component.dispatchEventImpl处的
(未知源)java.awt.Container.dispatchEventImpl处的
(未知源)
在java.awt.Component.dispatchEve nt(未知源)
在java.awt.LightweightDispatcher.retargetMouseEvent(未知源)
在java.awt.LightweightDispatcher.processMouseEvent(未知源)
在java.awt.LightweightDispatcher.dispatchEvent(未知源)
在java.awt.Container.dispatchEventImpl(未知源)
在java.awt.Window.dispatchEventImpl(未知源)
在java.awt.Component.dispatchEvent(未知源)
在java.awt.EventQueue.dispatchEventImpl(未知源)
在java.awt.EventQueue.access $ 200(未知源)$ b $在java.awt.EventQueue $ 3.run(未知源)在java.awt.EventQueue处
$ 3.run(未知源)$ java.util.AccessController.doPrivileged处的
(本地方法)$ java.security.ProtectionDomain处
$ 1.doIntersectionPrivilege(Unknown Source )$ java.util.ProtectionDomain上的
$ 1.doIntersectionPrivilege(未知源)$ java.util.EventQueue上
$ 4.run(未知源)$ b $ java.awt.EventQueue $ 4.run(未知源)java.security.AccessController.doPr的
在java.security.ProtectionDomain处
$ 1.doIntersectionPrivilege(未知源)$ b $在java.awt.EventQueue.dispatchEvent(未知源)
在java.awt.EventDispatchThread.pumpOneEventForFilters (未知源)
在java.awt.EventDispatchThread.pumpEventsForFilter(未知源)
在java.awt.EventDispatchThread.pumpEventsForHierarchy(未知源)
在java.awt.EventDispatchThread.pumpEvents(未知来源)
在java.awt.EventDispatchThread.pumpEvents(未知源)
在java.awt.EventDispatchThread.run(未知源)
)。 media.html#json.json-prel =noreferrer> JSON Processing library),那么你应该从模块中移除 jersey-media-json-processing 你的客户的类路径(这似乎在GF之外)。这个模块依赖于 jsonp-jaxrs.jar (+ javax.json.jar javax .json-api.jar ),它包含 JsonStructureBodyReader 。问题是,每当 c $ c> jersey-media-json-processing 模块位于一个类路径上,Jersey试图通过 Auto-Discoverable 机制。这意味着如果缺少依赖关系,则会遇到类似于您的扩展。


I'm using GlassFish 4.0 R89 on my dev system, working with JAX-RS. Simple calls work, so I can get a serialized object, represented in XML. I had to install that on the machine of a guy who will also be involved in the coding process, and I also tried that on my notebook - and I'm getting the same result - a NoClassDefFoundError is thrown for the class JsonStructureBodyReader (although I'm not even using JSON, tried that, the server definitely returns XML with correct headers for the content-type).

I thought I might have imported a project incorrectly, but after a comparison of the files in the working and the non-working version, I realized that there doesn't seem to be a difference that could be responsible for that (the projects are more or less equal on both machines).

I thought maybe there's a problem with the GF version, so I checked that, but both installations are R89. However: The jars in the GFs modules/ directory seem to be different, especially when doing a binary comparison.

Has anyone experienced that problem before?

Here's the full stacktrace:

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)

解决方案

If you're not using JSON (JSON Processing library) then you should remove jersey-media-json-processing module from the classpath of your client (which seems to be outside of GF). This module depends on jsonp-jaxrs.jar (+ javax.json.jar, javax.json-api.jar) which contains the JsonStructureBodyReader. The thing is that everytime the jersey-media-json-processing module is on a classpath Jersey tries to register JSON Processing providers via Auto-Discoverable mechanism. This means that in case of missing dependencies one would encounter an exteption similar to yours.

这篇关于GlassFish 4.0 / Jersey 2.0 - JsonStructureBodyReader的NoClassDefFoundError的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆