小编gro*_*ker的帖子

GlassFish 4.0 w/Jersey毫无例外地返回500内部服务器错误

我正在使用GlassFish 4.0服务器和服务器端JPA类,我想通过JAX-RS提供.到目前为止,这对于简单实体来说很好.但是,如果我有一个@OneToMany关系例如并且存在链接实体,则服务器返回500内部服务器错误.在这种情况下,服务器日志中不会记录任何内容.为了找到错误,我创建了一个小的自定义JSP页面,以获取有关所发生事件的更多信息.代码就是这样:

Status: <%= pageContext.getErrorData().getStatusCode() %>
Throwable: <%= pageContext.getErrorData().getThrowable() %>
Run Code Online (Sandbox Code Playgroud)

不幸的是,输出只是"状态:500 Throwable:null"

我自己的服务器端代码似乎运行正常(做了一些调试输出),但是,出现了一些错误.在此示例中,除非存在链接的IssueComment实体,否则可以毫无问题地检索User和Issue类:

用户类:

package my.application.model;

import static javax.persistence.FetchType.LAZY;

import java.io.Serializable;
import java.util.List;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.xml.bind.annotation.XmlRootElement;

/**
 * The persistent class for the User database table.
 * 
 */
@XmlRootElement
@Entity(name="User")
@Table(name="User")
public class User implements Serializable {

    private static final long serialVersionUID = 1L;

    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Column(name="id")
    private int id;

    @Column(name="failedLogin")
    private short failedLogin;

    @Column(name="firstname") …
Run Code Online (Sandbox Code Playgroud)

java glassfish jersey-2.0

8
推荐指数
1
解决办法
4640
查看次数

GlassFish 4.0/Jersey 2.0 - JsonStructureBodyReader的NoClassDefFoundError

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

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

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

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

这是完整的堆栈跟踪:

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) …
Run Code Online (Sandbox Code Playgroud)

json glassfish glassfish-4 jersey-2.0

3
推荐指数
1
解决办法
9526
查看次数

标签 统计

glassfish ×2

jersey-2.0 ×2

glassfish-4 ×1

java ×1

json ×1