如何修复找不到Media type = text / plain的MessageBodyWriter

时间:2019-07-08 03:31:35

标签: java rest gradle glassfish

当我从Eclipse运行时,我正在实施休息服务,我的项目运行正常。但是,当我创建一个jar并尝试从cmd运行时,出现此错误。错误中提到了下面的班级歌曲。

图片:

see this

package spotify.charts.entities;

public class Song {
    private String title;
    private String artist;
    private double duration;


    public String getTitle() {
        return title;
    }
    public void setTitle(String title) {
        this.title = title;
    }

    public String getArtist() {
        return artist;
    }
    public void setArtist(String artist) {
        this.artist = artist;
    }

    public double getDuration() {
        return duration;
    }
    public void setDuration(double duration) {
        this.duration = duration;
    }
}

我已经在build.gradle文件中添加了这些依赖项:

dependencies {
    compile 'org.glassfish.jersey.core:jersey-server:2.28'
    compile 'org.glassfish.jersey.containers:jersey-container-jdk-http:2.28'
    compile 'org.glassfish.jersey.containers:jersey-container-servlet-core:2.28'
    compile 'org.glassfish.jersey.media:jersey-media-moxy:2.28'
    compile 'org.glassfish.jersey.inject:jersey-hk2:2.28'
    compile 'org.glassfish.jersey.core:jersey-client:2.28'


    compile 'se.michaelthelin.spotify:spotify-web-api-java:2.2.0'

    testCompile 'org.glassfish.jersey.test-framework.providers:jersey-test-framework-provider-inmemory:2.28'
}

0 个答案:

没有答案