After fighting this same issue for a few hours, I found the problem is the 
@Inject annotation.
The Jersery IoC contain gets somehow hooked even when I'm using Spring for 
the wiring.

Solution: Use @Resource instead of @Inject

On Wednesday, August 31, 2016 at 4:27:47 PM UTC-5, Jacek Furmankiewicz 
wrote:
>
> We are trying to migrate our 0.7.0 app to version 1.0.0 and it fails at 
> startup after the migration.
> I suspect it is related to our usage of Spring and Jersey HK2 not liking 
> it.
>
> Any suggestions on how to get this to work?
>
> Thanks!
>
> Caused by: A MultiException has 3 exceptions.  They are:
> 1. java.lang.NullPointerException
> 2. java.lang.IllegalStateException: Unable to perform operation: method 
> inject on com.sun.jersey.core.impl.provider.entity.
> XMLRootElementProvider$App
> 3. java.lang.IllegalStateException: Unable to perform operation: create 
> on org.glassfish.jersey.message.internal.MessageBodyFactory
>
>         at org.jvnet.hk2.internal.ClazzCreator.create(ClazzCreator.java:
> 391)
>         at org.jvnet.hk2.internal.SystemDescriptor.create(SystemDescriptor
> .java:471)
>         at org.jvnet.hk2.internal.PerLookupContext.findOrCreate(
> PerLookupContext.java:70)
>         at org.jvnet.hk2.internal.Utilities.createService(Utilities.java:
> 2020)
>         at org.jvnet.hk2.internal.ServiceHandleImpl.getService(
> ServiceHandleImpl.java:114)
>         at org.jvnet.hk2.internal.ServiceHandleImpl.getService(
> ServiceHandleImpl.java:88)
>         at org.glassfish.jersey.internal.inject.ProviderToService.apply(
> ProviderToService.java:58)
>         at org.glassfish.jersey.internal.inject.ProviderToService.apply(
> ProviderToService.java:54)
>         at jersey.repackaged.com.google.common.collect.Iterators$8.
> transform(Iterators.java:799)
>         at jersey.repackaged.com.google.common.collect.TransformedIterator
> .next(TransformedIterator.java:48)
>         at java.util.AbstractCollection.addAll(AbstractCollection.java:343
> )
>         at java.util.LinkedHashSet.<init>(LinkedHashSet.java:169)
>         at jersey.repackaged.com.google.common.collect.Sets.
> newLinkedHashSet(Sets.java:325)
>         at org.glassfish.jersey.internal.inject.Providers.getClasses(
> Providers.java:392)
>         at org.glassfish.jersey.internal.inject.Providers.getProviders(
> Providers.java:188)
>         at org.glassfish.jersey.message.internal.MessageBodyFactory.<init
> >(MessageBodyFactory.java:222)
>         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:422)
>         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:
> 2020)
>         at org.jvnet.hk2.internal.ServiceLocatorImpl.internalGetService(
> ServiceLocatorImpl.java:766)
>         at org.jvnet.hk2.internal.ServiceLocatorImpl.getService(
> ServiceLocatorImpl.java:705)
>         at org.glassfish.jersey.server.model.ComponentModelValidator.<init
> >(ComponentModelValidator.java:97)
>         at org.glassfish.jersey.server.ApplicationHandler.initialize(
> ApplicationHandler.java:549)
>         at org.glassfish.jersey.server.ApplicationHandler.access$500(
> ApplicationHandler.java:184)
>         at org.glassfish.jersey.server.ApplicationHandler$3.call(
> ApplicationHandler.java:350)
>         at org.glassfish.jersey.server.ApplicationHandler$3.call(
> ApplicationHandler.java:347)
>         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:347)
>         at org.glassfish.jersey.servlet.WebComponent.<init>(WebComponent.
> java:392)
>         at org.glassfish.jersey.servlet.ServletContainer.init(
> ServletContainer.java:177)
>         at org.glassfish.jersey.servlet.ServletContainer.init(
> ServletContainer.java:369)
>         at javax.servlet.GenericServlet.init(GenericServlet.java:161)
>         at org.eclipse.jetty.servlet.ServletHolder.initServlet(
> ServletHolder.java:640)
>         ... 41 more
> Caused by: java.lang.NullPointerException
>         at com.sun.jersey.core.provider.jaxb.AbstractJAXBProvider.
> setConfiguration(AbstractJAXBProvider.java:109)
>         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:497)
>         at org.glassfish.hk2.utilities.reflection.ReflectionHelper.invoke(
> ReflectionHelper.java:1262)
>         at org.jvnet.hk2.internal.ClazzCreator.methodMe(ClazzCreator.java:
> 318)
>         at org.jvnet.hk2.internal.ClazzCreator.create(ClazzCreator.java:
> 371)
>         ... 88 more
> Enter code here...
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"dropwizard-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to