Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

dropwizard-testing resouce test blows up when building ResourceTestRule

I have a simple ResourceTest that I am trying to set up, however When I try to build the ResourceTestRule I get the following exception:

ProfilesResourceTest,shouldGetEmptyStuff
    WARN  [2016-05-15 17:44:50,159] org.glassfish.jersey.internal.Errors: The following warnings have been detected: WARNING: HK2 service reification failed for [com.sun.jersey.core.impl.provider.entity.MimeMultipartProvider] with an exception:
    MultiException stack 1 of 2
    java.lang.NoClassDefFoundError: javax/mail/MessagingException
        at java.lang.Class.getDeclaredConstructors0(Native Method)
        at java.lang.Class.privateGetDeclaredConstructors(Class.java:2671)
        at java.lang.Class.getDeclaredConstructors(Class.java:2020)
        at org.jvnet.hk2.internal.Utilities$3.run(Utilities.java:1311)
        at org.jvnet.hk2.internal.Utilities$3.run(Utilities.java:1307)
        at java.security.AccessController.doPrivileged(Native Method)
        at org.jvnet.hk2.internal.Utilities.getAllConstructors(Utilities.java:1307)
        at org.jvnet.hk2.internal.Utilities.findProducerConstructor(Utilities.java:1250)
        at org.jvnet.hk2.internal.DefaultClassAnalyzer.getConstructor(DefaultClassAnalyzer.java:83)
        at org.glassfish.jersey.internal.inject.JerseyClassAnalyzer.getConstructor(JerseyClassAnalyzer.java:144)
        at org.jvnet.hk2.internal.Utilities.getConstructor(Utilities.java:179)
        at org.jvnet.hk2.internal.ClazzCreator.initialize(ClazzCreator.java:128)
        at org.jvnet.hk2.internal.ClazzCreator.initialize(ClazzCreator.java:179)
        at org.jvnet.hk2.internal.SystemDescriptor.internalReify(SystemDescriptor.java:723)
        at org.jvnet.hk2.internal.SystemDescriptor.reify(SystemDescriptor.java:678)
        at org.jvnet.hk2.internal.ServiceLocatorImpl.reifyDescriptor(ServiceLocatorImpl.java:463)
        at org.jvnet.hk2.internal.ServiceLocatorImpl.narrow(ServiceLocatorImpl.java:2187)
        at org.jvnet.hk2.internal.ServiceLocatorImpl.access$1200(ServiceLocatorImpl.java:121)
        at org.jvnet.hk2.internal.ServiceLocatorImpl$10.compute(ServiceLocatorImpl.java:1331)
        at org.jvnet.hk2.internal.ServiceLocatorImpl$10.compute(ServiceLocatorImpl.java:1326)
        at org.glassfish.hk2.utilities.cache.LRUHybridCache$OriginThreadAwareFuture$1.call(LRUHybridCache.java:115)
        at org.glassfish.hk2.utilities.cache.LRUHybridCache$OriginThreadAwareFuture$1.call(LRUHybridCache.java:111)
        at java.util.concurrent.FutureTask.run(FutureTask.java:266)
        at org.glassfish.hk2.utilities.cache.LRUHybridCache$OriginThreadAwareFuture.run(LRUHybridCache.java:173)
        at org.glassfish.hk2.utilities.cache.LRUHybridCache.compute(LRUHybridCache.java:292)
        at org.jvnet.hk2.internal.ServiceLocatorImpl.internalGetAllServiceHandles(ServiceLocatorImpl.java:1388)
        at org.jvnet.hk2.internal.ServiceLocatorImpl.getAllServiceHandles(ServiceLocatorImpl.java:1313)
        at org.jvnet.hk2.internal.ServiceLocatorImpl.getAllServiceHandles(ServiceLocatorImpl.java:1302)
        at org.glassfish.jersey.internal.inject.Providers.getServiceHandles(Providers.java:354)
        at org.glassfish.jersey.internal.inject.Providers.getCustomProviders(Providers.java:201)
        at org.glassfish.jersey.message.internal.MessageBodyFactory.<init>(MessageBodyFactory.java:221)
        at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
        at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
        at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
        at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
        at org.glassfish.hk2.utilities.reflection.ReflectionHelper.makeMe(ReflectionHelper.java:1350)
        at org.jvnet.hk2.internal.ClazzCreator.createMe(ClazzCreator.java:271)
        at org.jvnet.hk2.internal.ClazzCreator.create(ClazzCreator.java:365)
        at org.jvnet.hk2.internal.SystemDescriptor.create(SystemDescriptor.java:471)
        at org.jvnet.hk2.internal.SingletonContext$1.compute(SingletonContext.java:83)
        at org.jvnet.hk2.internal.SingletonContext$1.compute(SingletonContext.java:71)
        at org.glassfish.hk2.utilities.cache.Cache$OriginThreadAwareFuture$1.call(Cache.java:97)
        at java.util.concurrent.FutureTask.run(FutureTask.java:266)
        at org.glassfish.hk2.utilities.cache.Cache$OriginThreadAwareFuture.run(Cache.java:154)
        at org.glassfish.hk2.utilities.cache.Cache.compute(Cache.java:199)
        at org.jvnet.hk2.internal.SingletonContext.findOrCreate(SingletonContext.java:122)
        at org.jvnet.hk2.internal.Utilities.createService(Utilities.java:2072)
        at org.jvnet.hk2.internal.ServiceLocatorImpl.internalGetService(ServiceLocatorImpl.java:767)
        at org.jvnet.hk2.internal.ServiceLocatorImpl.getService(ServiceLocatorImpl.java:706)
        at org.glassfish.jersey.server.model.ComponentModelValidator.<init>(ComponentModelValidator.java:97)
        at org.glassfish.jersey.server.ApplicationHandler.initialize(ApplicationHandler.java:547)
        at org.glassfish.jersey.server.ApplicationHandler.access$500(ApplicationHandler.java:182)
        at org.glassfish.jersey.server.ApplicationHandler$3.call(ApplicationHandler.java:348)
        at org.glassfish.jersey.server.ApplicationHandler$3.call(ApplicationHandler.java:345)
        at org.glassfish.jersey.internal.Errors.process(Errors.java:315)
        at org.glassfish.jersey.internal.Errors.process(Errors.java:297)
        at org.glassfish.jersey.internal.Errors.processWithException(Errors.java:255)
        at org.glassfish.jersey.server.ApplicationHandler.<init>(ApplicationHandler.java:345)
        at org.glassfish.jersey.server.ApplicationHandler.<init>(ApplicationHandler.java:297)
        at org.glassfish.jersey.test.inmemory.InMemoryTestContainerFactory$InMemoryTestContainer.<init>(InMemoryTestContainerFactory.java:77)
        at org.glassfish.jersey.test.inmemory.InMemoryTestContainerFactory$InMemoryTestContainer.<init>(InMemoryTestContainerFactory.java:63)
        at org.glassfish.jersey.test.inmemory.InMemoryTestContainerFactory.create(InMemoryTestContainerFactory.java:111)
        at org.glassfish.jersey.test.JerseyTest.createTestContainer(JerseyTest.java:277)
        at org.glassfish.jersey.test.JerseyTest.setUp(JerseyTest.java:609)
        at io.dropwizard.testing.junit.ResourceTestRule$1.evaluate(ResourceTestRule.java:201)
        at org.junit.rules.RunRules.evaluate(RunRules.java:20)
        at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
        at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
        at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)
        at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
        at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
        at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
        at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
        at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
        at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
        at org.junit.runner.JUnitCore.run(JUnitCore.java:137)
        at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:119)
        at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:42)
        at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:234)
        at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:74)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at com.intellij.rt.execution.application.AppMain.main(AppMain.java:144)
    Caused by: java.lang.ClassNotFoundException: javax.mail.MessagingException
        at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
        at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
        ... 85 more
    MultiException stack 2 of 2
    java.lang.IllegalArgumentException: Errors were discovered while reifying SystemDescriptor(
        implementation=com.sun.jersey.core.impl.provider.entity.MimeMultipartProvider
        contracts={javax.ws.rs.ext.MessageBodyReader}
        scope=org.glassfish.hk2.api.PerLookup
        qualifiers={}
        descriptorType=CLASS
        descriptorVisibility=NORMAL
        metadata=
        rank=0
        loader=org.glassfish.hk2.utilities.binding.AbstractBinder$2@13cf7d52
        proxiable=null
        proxyForSameScope=null
        analysisName=null
        id=123
        locatorId=1
        identityHashCode=977160959
        reified=false)
        at org.jvnet.hk2.internal.SystemDescriptor.reify(SystemDescriptor.java:689)
        at org.jvnet.hk2.internal.ServiceLocatorImpl.reifyDescriptor(ServiceLocatorImpl.java:463)
        at org.jvnet.hk2.internal.ServiceLocatorImpl.narrow(ServiceLocatorImpl.java:2187)
        at org.jvnet.hk2.internal.ServiceLocatorImpl.access$1200(ServiceLocatorImpl.java:121)
        at org.jvnet.hk2.internal.ServiceLocatorImpl$10.compute(ServiceLocatorImpl.java:1331)
        at org.jvnet.hk2.internal.ServiceLocatorImpl$10.compute(ServiceLocatorImpl.java:1326)
        at org.glassfish.hk2.utilities.cache.LRUHybridCache$OriginThreadAwareFuture$1.call(LRUHybridCache.java:115)
        at org.glassfish.hk2.utilities.cache.LRUHybridCache$OriginThreadAwareFuture$1.call(LRUHybridCache.java:111)
        at java.util.concurrent.FutureTask.run(FutureTask.java:266)
        at org.glassfish.hk2.utilities.cache.LRUHybridCache$OriginThreadAwareFuture.run(LRUHybridCache.java:173)
        at org.glassfish.hk2.utilities.cache.LRUHybridCache.compute(LRUHybridCache.java:292)
        at org.jvnet.hk2.internal.ServiceLocatorImpl.internalGetAllServiceHandles(ServiceLocatorImpl.java:1388)
        at org.jvnet.hk2.internal.ServiceLocatorImpl.getAllServiceHandles(ServiceLocatorImpl.java:1313)
        at org.jvnet.hk2.internal.ServiceLocatorImpl.getAllServiceHandles(ServiceLocatorImpl.java:1302)
        at org.glassfish.jersey.internal.inject.Providers.getServiceHandles(Providers.java:354)
        at org.glassfish.jersey.internal.inject.Providers.getCustomProviders(Providers.java:201)
        at org.glassfish.jersey.message.internal.MessageBodyFactory.<init>(MessageBodyFactory.java:221)
        at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
        at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
        at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
        at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
        at org.glassfish.hk2.utilities.reflection.ReflectionHelper.makeMe(ReflectionHelper.java:1350)
        at org.jvnet.hk2.internal.ClazzCreator.createMe(ClazzCreator.java:271)
        at org.jvnet.hk2.internal.ClazzCreator.create(ClazzCreator.java:365)
        at org.jvnet.hk2.internal.SystemDescriptor.create(SystemDescriptor.java:471)
        at org.jvnet.hk2.internal.SingletonContext$1.compute(SingletonContext.java:83)
        at org.jvnet.hk2.internal.SingletonContext$1.compute(SingletonContext.java:71)
        at org.glassfish.hk2.utilities.cache.Cache$OriginThreadAwareFuture$1.call(Cache.java:97)
        at java.util.concurrent.FutureTask.run(FutureTask.java:266)
        at org.glassfish.hk2.utilities.cache.Cache$OriginThreadAwareFuture.run(Cache.java:154)
        at org.glassfish.hk2.utilities.cache.Cache.compute(Cache.java:199)
        at org.jvnet.hk2.internal.SingletonContext.findOrCreate(SingletonContext.java:122)
        at org.jvnet.hk2.internal.Utilities.createService(Utilities.java:2072)
        at org.jvnet.hk2.internal.ServiceLocatorImpl.internalGetService(ServiceLocatorImpl.java:767)
        at org.jvnet.hk2.internal.ServiceLocatorImpl.getService(ServiceLocatorImpl.java:706)
        at org.glassfish.jersey.server.model.ComponentModelValidator.<init>(ComponentModelValidator.java:97)
        at org.glassfish.jersey.server.ApplicationHandler.initialize(ApplicationHandler.java:547)
        at org.glassfish.jersey.server.ApplicationHandler.access$500(ApplicationHandler.java:182)
        at org.glassfish.jersey.server.ApplicationHandler$3.call(ApplicationHandler.java:348)
        at org.glassfish.jersey.server.ApplicationHandler$3.call(ApplicationHandler.java:345)
        at org.glassfish.jersey.internal.Errors.process(Errors.java:315)
        at org.glassfish.jersey.internal.Errors.process(Errors.java:297)
        at org.glassfish.jersey.internal.Errors.processWithException(Errors.java:255)
        at org.glassfish.jersey.server.ApplicationHandler.<init>(ApplicationHandler.java:345)
        at org.glassfish.jersey.server.ApplicationHandler.<init>(ApplicationHandler.java:297)
        at org.glassfish.jersey.test.inmemory.InMemoryTestContainerFactory$InMemoryTestContainer.<init>(InMemoryTestContainerFactory.java:77)
        at org.glassfish.jersey.test.inmemory.InMemoryTestContainerFactory$InMemoryTestContainer.<init>(InMemoryTestContainerFactory.java:63)
        at org.glassfish.jersey.test.inmemory.InMemoryTestContainerFactory.create(InMemoryTestContainerFactory.java:111)
        at org.glassfish.jersey.test.JerseyTest.createTestContainer(JerseyTest.java:277)
        at org.glassfish.jersey.test.JerseyTest.setUp(JerseyTest.java:609)
        at io.dropwizard.testing.junit.ResourceTestRule$1.evaluate(ResourceTestRule.java:201)
        at org.junit.rules.RunRules.evaluate(RunRules.java:20)
        at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
        at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
        at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)
        at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
        at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
        at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
        at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
        at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
        at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
        at org.junit.runner.JUnitCore.run(JUnitCore.java:137)
        at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:119)
        at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:42)
        at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:234)
        at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:74)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at com.intellij.rt.execution.application.AppMain.main(AppMain.java:144)

    WARNING: HK2 service reification failed for [com.sun.jersey.core.impl.provider.entity.MimeMultipartProvider] with an exception:
    MultiException stack 1 of 2
    java.lang.NoClassDefFoundError: javax/mail/MessagingException
        at java.lang.Class.getDeclaredConstructors0(Native Method)
        at java.lang.Class.privateGetDeclaredConstructors(Class.java:2671)
        at java.lang.Class.getDeclaredConstructors(Class.java:2020)
        at org.jvnet.hk2.internal.Utilities$3.run(Utilities.java:1311)
        at org.jvnet.hk2.internal.Utilities$3.run(Utilities.java:1307)
        at java.security.AccessController.doPrivileged(Native Method)
        at org.jvnet.hk2.internal.Utilities.getAllConstructors(Utilities.java:1307)
        at org.jvnet.hk2.internal.Utilities.findProducerConstructor(Utilities.java:1250)
        at org.jvnet.hk2.internal.DefaultClassAnalyzer.getConstructor(DefaultClassAnalyzer.java:83)
        at org.glassfish.jersey.internal.inject.JerseyClassAnalyzer.getConstructor(JerseyClassAnalyzer.java:144)
        at org.jvnet.hk2.internal.Utilities.getConstructor(Utilities.java:179)
        at org.jvnet.hk2.internal.ClazzCreator.initialize(ClazzCreator.java:128)
        at org.jvnet.hk2.internal.ClazzCreator.initialize(ClazzCreator.java:179)
        at org.jvnet.hk2.internal.SystemDescriptor.internalReify(SystemDescriptor.java:723)
        at org.jvnet.hk2.internal.SystemDescriptor.reify(SystemDescriptor.java:678)
        at org.jvnet.hk2.internal.ServiceLocatorImpl.reifyDescriptor(ServiceLocatorImpl.java:463)
        at org.jvnet.hk2.internal.ServiceLocatorImpl.narrow(ServiceLocatorImpl.java:2187)
        at org.jvnet.hk2.internal.ServiceLocatorImpl.access$1200(ServiceLocatorImpl.java:121)
        at org.jvnet.hk2.internal.ServiceLocatorImpl$10.compute(ServiceLocatorImpl.java:1331)
        at org.jvnet.hk2.internal.ServiceLocatorImpl$10.compute(ServiceLocatorImpl.java:1326)
        at org.glassfish.hk2.utilities.cache.LRUHybridCache$OriginThreadAwareFuture$1.call(LRUHybridCache.java:115)
        at org.glassfish.hk2.utilities.cache.LRUHybridCache$OriginThreadAwareFuture$1.call(LRUHybridCache.java:111)
        at java.util.concurrent.FutureTask.run(FutureTask.java:266)
        at org.glassfish.hk2.utilities.cache.LRUHybridCache$OriginThreadAwareFuture.run(LRUHybridCache.java:173)
        at org.glassfish.hk2.utilities.cache.LRUHybridCache.compute(LRUHybridCache.java:292)
        at org.jvnet.hk2.internal.ServiceLocatorImpl.internalGetAllServiceHandles(ServiceLocatorImpl.java:1388)
        at org.jvnet.hk2.internal.ServiceLocatorImpl.getAllServiceHandles(ServiceLocatorImpl.java:1313)
        at org.jvnet.hk2.internal.ServiceLocatorImpl.getAllServiceHandles(ServiceLocatorImpl.java:1302)
        at org.glassfish.jersey.internal.inject.Providers.getServiceHandles(Providers.java:354)
        at org.glassfish.jersey.internal.inject.Providers.getCustomProviders(Providers.java:201)
        at org.glassfish.jersey.message.internal.MessageBodyFactory.<init>(MessageBodyFactory.java:221)
        at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
        at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
        at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
        at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
        at org.glassfish.hk2.utilities.reflection.ReflectionHelper.makeMe(ReflectionHelper.java:1350)
        at org.jvnet.hk2.internal.ClazzCreator.createMe(ClazzCreator.java:271)
        at org.jvnet.hk2.internal.ClazzCreator.create(ClazzCreator.java:365)
        at org.jvnet.hk2.internal.SystemDescriptor.create(SystemDescriptor.java:471)
        at org.jvnet.hk2.internal.SingletonContext$1.compute(SingletonContext.java:83)
        at org.jvnet.hk2.internal.SingletonContext$1.compute(SingletonContext.java:71)
        at org.glassfish.hk2.utilities.cache.Cache$OriginThreadAwareFuture$1.call(Cache.java:97)
        at java.util.concurrent.FutureTask.run(FutureTask.java:266)
        at org.glassfish.hk2.utilities.cache.Cache$OriginThreadAwareFuture.run(Cache.java:154)
        at org.glassfish.hk2.utilities.cache.Cache.compute(Cache.java:199)
        at org.jvnet.hk2.internal.SingletonContext.findOrCreate(SingletonContext.java:122)
        at org.jvnet.hk2.internal.Utilities.createService(Utilities.java:2072)
        at org.jvnet.hk2.internal.ServiceLocatorImpl.internalGetService(ServiceLocatorImpl.java:767)
        at org.jvnet.hk2.internal.ServiceLocatorImpl.getService(ServiceLocatorImpl.java:706)
        at org.glassfish.jersey.server.model.ComponentModelValidator.<init>(ComponentModelValidator.java:97)
        at org.glassfish.jersey.server.ApplicationHandler.initialize(ApplicationHandler.java:547)
        at org.glassfish.jersey.server.ApplicationHandler.access$500(ApplicationHandler.java:182)
        at org.glassfish.jersey.server.ApplicationHandler$3.call(ApplicationHandler.java:348)
        at org.glassfish.jersey.server.ApplicationHandler$3.call(ApplicationHandler.java:345)
        at org.glassfish.jersey.internal.Errors.process(Errors.java:315)
        at org.glassfish.jersey.internal.Errors.process(Errors.java:297)
        at org.glassfish.jersey.internal.Errors.processWithException(Errors.java:255)
        at org.glassfish.jersey.server.ApplicationHandler.<init>(ApplicationHandler.java:345)
        at org.glassfish.jersey.server.ApplicationHandler.<init>(ApplicationHandler.java:297)
        at org.glassfish.jersey.test.inmemory.InMemoryTestContainerFactory$InMemoryTestContainer.<init>(InMemoryTestContainerFactory.java:77)
        at org.glassfish.jersey.test.inmemory.InMemoryTestContainerFactory$InMemoryTestContainer.<init>(InMemoryTestContainerFactory.java:63)
        at org.glassfish.jersey.test.inmemory.InMemoryTestContainerFactory.create(InMemoryTestContainerFactory.java:111)
        at org.glassfish.jersey.test.JerseyTest.createTestContainer(JerseyTest.java:277)
        at org.glassfish.jersey.test.JerseyTest.setUp(JerseyTest.java:609)
        at io.dropwizard.testing.junit.ResourceTestRule$1.evaluate(ResourceTestRule.java:201)
        at org.junit.rules.RunRules.evaluate(RunRules.java:20)
        at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
        at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
        at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)
        at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
        at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
        at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
        at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
        at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
        at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
        at org.junit.runner.JUnitCore.run(JUnitCore.java:137)
        at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:119)
        at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:42)
        at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:234)
        at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:74)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at com.intellij.rt.execution.application.AppMain.main(AppMain.java:144)
    Caused by: java.lang.ClassNotFoundException: javax.mail.MessagingException
        at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
        at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
        ... 85 more
    MultiException stack 2 of 2
    java.lang.IllegalArgumentException: Errors were discovered while reifying SystemDescriptor(
        implementation=com.sun.jersey.core.impl.provider.entity.MimeMultipartProvider
        contracts={javax.ws.rs.ext.MessageBodyReader}
        scope=org.glassfish.hk2.api.PerLookup
        qualifiers={}
        descriptorType=CLASS
        descriptorVisibility=NORMAL
        metadata=
        rank=0
        loader=org.glassfish.hk2.utilities.binding.AbstractBinder$2@13cf7d52
        proxiable=null
        proxyForSameScope=null
        analysisName=null
        id=123
        locatorId=1
        identityHashCode=977160959
        reified=false)
        at org.jvnet.hk2.internal.SystemDescriptor.reify(SystemDescriptor.java:689)
        at org.jvnet.hk2.internal.ServiceLocatorImpl.reifyDescriptor(ServiceLocatorImpl.java:463)
        at org.jvnet.hk2.internal.ServiceLocatorImpl.narrow(ServiceLocatorImpl.java:2187)
        at org.jvnet.hk2.internal.ServiceLocatorImpl.access$1200(ServiceLocatorImpl.java:121)
        at org.jvnet.hk2.internal.ServiceLocatorImpl$10.compute(ServiceLocatorImpl.java:1331)
        at org.jvnet.hk2.internal.ServiceLocatorImpl$10.compute(ServiceLocatorImpl.java:1326)
        at org.glassfish.hk2.utilities.cache.LRUHybridCache$OriginThreadAwareFuture$1.call(LRUHybridCache.java:115)
        at org.glassfish.hk2.utilities.cache.LRUHybridCache$OriginThreadAwareFuture$1.call(LRUHybridCache.java:111)
        at java.util.concurrent.FutureTask.run(FutureTask.java:266)
        at org.glassfish.hk2.utilities.cache.LRUHybridCache$OriginThreadAwareFuture.run(LRUHybridCache.java:173)
        at org.glassfish.hk2.utilities.cache.LRUHybridCache.compute(LRUHybridCache.java:292)
        at org.jvnet.hk2.internal.ServiceLocatorImpl.internalGetAllServiceHandles(ServiceLocatorImpl.java:1388)
        at org.jvnet.hk2.internal.ServiceLocatorImpl.getAllServiceHandles(ServiceLocanvoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at com.intellij.rt.execution.application.AppMain.main(AppMain.java:144)

    WARNING: HK2 service reification failed for [co

m.sun.jersey.core.impl.provider.entity.MimeMultipartProvider] with an

My Code looks like:

public class ProfilesResourceTest {

    @Rule
    public final ResourceTestRule resources = ResourceTestRule.builder().build();


    @Test
    public void shouldGetEmptyStuff() {
    }
}

Resource:

@Produces(MediaType.APPLICATION_JSON)
public class ProfilesResource  {
    @GET
    public String index() {
        return "{}";
    }
}

Pom stuff:

<properties>
    <dropwizard.version>0.9.2</dropwizard.version>
    <dropwizard.guice.version>0.8.4.0</dropwizard.guice.version>
</properties>
    <dependency>
        <groupId>io.dropwizard</groupId>
        <artifactId>dropwizard-core</artifactId>
        <version>${dropwizard.version}</version>
    </dependency>
    <dependency>
        <groupId>io.dropwizard</groupId>
        <artifactId>dropwizard-testing</artifactId>
        <version>${dropwizard.version}</version>
        <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>com.hubspot.dropwizard</groupId>
        <artifactId>dropwizard-guice</artifactId>
        <version>${dropwizard.guice.version}</version>
    </dependency>

Ben

like image 913
Ben Flowers Avatar asked May 15 '16 16:05

Ben Flowers


1 Answers

There is a conflict between Jersey libraries.

Your app server is using Jersey v1 whereas your app (using Dropwizard 0.9.2) is shipping or using Jersey v2.

As far as I see you are using Glassfish v3, which is quite old. My recommendations are:

  • use an older version of Dropwizard (version 0.7.0 uses Jersey 1.x)
  • update Glassfish (not so easy if you already have a running system)
like image 183
Esteban Avatar answered Oct 12 '22 23:10

Esteban