3

I've tried everything...can't figure out why I'm getting this exception. What's interesting is that in my IDE (Intellij) everything works without a hitch. Can't figure this out...giving up.

Do any of you have any suggestions?

dependencies {
    compile group: 'com.amazonaws', name: 'aws-java-sdk', version: '1.10.27'
    compile group: 'org.slf4j', name: 'slf4j-api', version: '1.7.7'
    compile group: 'ch.qos.logback', name: 'logback-classic', version: '1.1.2'
    compile group: 'ch.qos.logback', name: 'logback-core', version: '1.1.2'
    compile group: 'org.glassfish.jersey.media', name: 'jersey-media-json-jackson', version: '2.22.1'
    compile group: 'org.glassfish.jersey.containers', name: 'jersey-container-grizzly2-http', version: '2.22.1'
    compile group: 'org.glassfish.jersey.core', name: 'jersey-client', version: '2.22.1'
//    compile group: 'com.owlike', name: 'genson', version: '1.3'
    compile group: 'org.apache.commons', name: 'commons-lang3', version: '3.3.2'
    compile group: 'org.codehaus.groovy', name: 'groovy-all', version: '2+'
    compile group: 'commons-beanutils', name: 'commons-beanutils', version: '1.8.3'
    compile group: 'com.mashape.unirest', name: 'unirest-java', version: '1.4.7'
    compile group: 'org.elasticsearch', name: 'elasticsearch', version: '1.5.2'

    testCompile 'org.spockframework:spock-core:1.0-groovy-2.4'
    testCompile 'cglib:cglib-nodep:2.2'       // For mocking classes
    testCompile 'org.objenesis:objenesis:1.2' // For mocking final classes
    testCompile group: 'junit', name: 'junit', version: '4.9'
}

Getting the following:

Oct 21, 2015 5:18:46 AM org.glassfish.jersey.message.internal.WriterInterceptorExecutor$TerminalWriterInterceptor aroundWriteTo SEVERE: MessageBodyWriter not found for media type=application/json, type=class java.util.ArrayList, genericType=java.util.List.

HaveNoDisplayName
  • 8,291
  • 106
  • 37
  • 47
Vladimir
  • 2,481
  • 4
  • 31
  • 41
  • _"in my IDE (Intellij) everything works without a hitch"_ - So are you saying that when you run the server in your IDE it works fine, but when you run it as a jar it doesn't?. – Paul Samsotha Oct 21 '15 at 10:37
  • Without seeing any code, I can tell you that this a common problem when you return `Response.ok(ArrayList())`. This is solved by using `GenericEntity`, as mentioned [here](http://stackoverflow.com/q/33190552/2587435) – Paul Samsotha Oct 21 '15 at 10:40
  • I should probably close this ticket...I switched back to mvn from gradle and it seemed liked there was an issue bundling all of the dependencies into one jar with gradle...still not sure what was going on, but it's working when I run the fatjar that maven creates. Very weird. And It works in intellij since all of the dependencies are there. – Vladimir Oct 21 '15 at 18:07

1 Answers1

4

I was getting the same error for 2.22.1 I added the following dependency and it worked.

    <dependency>
        <groupId>org.glassfish.jersey.media</groupId>
        <artifactId>jersey-media-json-jackson</artifactId>
        <version>2.22.1</version>
    </dependency>
Sam Nunnally
  • 2,291
  • 2
  • 19
  • 30