简体   繁体   中英

Caused by: java.lang.NoClassDefFoundError: org/glassfish/jersey/server/model/Parameter$Source

I'm working with a REST Api built using Gradle + Jersey and running on Tomcat-7. I noticed when I am trying to run my JUnit tests that I am getting 500 errors for any api call.

Caused by: java.lang.NoClassDefFoundError: org/glassfish/jersey/server/model/Parameter$Source
at org.glassfish.jersey.media.multipart.internal.FormDataParamValueParamProvider.<init>(FormDataParamValueParamProvider.java:371)
at org.glassfish.jersey.media.multipart.internal.FormDataParamInjectionFeature$1.configure(FormDataParamInjectionFeature.java:76)
at org.glassfish.jersey.internal.inject.AbstractBinder.invokeConfigure(AbstractBinder.java:256)
at org.glassfish.jersey.internal.inject.AbstractBinder.getBindings(AbstractBinder.java:246)
at org.glassfish.jersey.internal.inject.Bindings.getBindings(Bindings.java:44)
at org.glassfish.jersey.internal.inject.AbstractBinder.lambda$getBindings$1(AbstractBinder.java:248)
at java.util.stream.ReferencePipeline$7$1.accept(ReferencePipeline.java:269)

I have noticed in other solutions that were similar to what I am having have mentioned that my jersey version numbers are off. However my Gradle has every jersey version in Sync.

compile group: 'org.glassfish.jersey.containers', name: 'jersey-container-servlet', version: '2.26'
compile group: 'org.glassfish.jersey.core', name: 'jersey-common', version: '2.26'
compile group: 'org.glassfish.jersey.inject', name: 'jersey-hk2', version: '2.26'
compile group: 'org.glassfish.jersey.media', name: 'jersey-media-multipart', version: '2.26'

Is there something else I could be missing?

So the problem that I was having that another library that I had custom built but not listed had used a different version of jersey in its own gradle. Syncing up my other projects gradle to 2.26 worked.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM