Skip to content
This repository has been archived by the owner on May 28, 2018. It is now read-only.

Features are initialized before the SpringComponentProvider #3795

Open
xavier-b opened this issue Mar 30, 2018 · 0 comments
Open

Features are initialized before the SpringComponentProvider #3795

xavier-b opened this issue Mar 30, 2018 · 0 comments

Comments

@xavier-b
Copy link

Hello,

With Spring boot 2 (use Jersey 2.26), there is a problem : Features are initialized before the org.glassfish.jersey.server.spring.SpringComponentProvider. So, when you want use a bean, there is an exception. This problem is only from Jersey 2.26 (no problem with jersey 2.25.1)

My example :

import javax.inject.Inject;
import javax.ws.rs.core.Feature;
import javax.ws.rs.core.FeatureContext;

public class FeatureExample implements Feature {
    
    @Inject
    private BeanExample beanExample;
    
    @Override
    public boolean configure(FeatureContext context) {

        
        return true;
    }
}

And the Exception :

org.glassfish.hk2.api.MultiException: A MultiException has 1 exceptions.  They are:
1. org.glassfish.hk2.api.UnsatisfiedDependencyException: There was no object available for injection at SystemInjecteeImpl(requiredType=BeanExample,parent=FeatureExample,qualifiers={},position=-1,optional=false,self=false,unqualified=null,1027281488)

	at org.jvnet.hk2.internal.ThreeThirtyResolver.resolve(ThreeThirtyResolver.java:75) ~[hk2-locator-2.5.0-b42.jar:?]
	at org.jvnet.hk2.internal.Utilities.justInject(Utilities.java:1012) ~[hk2-locator-2.5.0-b42.jar:?]
	at org.jvnet.hk2.internal.ServiceLocatorImpl.inject(ServiceLocatorImpl.java:1008) ~[hk2-locator-2.5.0-b42.jar:?]
	at org.jvnet.hk2.internal.ServiceLocatorImpl.createAndInitialize(ServiceLocatorImpl.java:1083) ~[hk2-locator-2.5.0-b42.jar:?]
	at org.jvnet.hk2.internal.ServiceLocatorImpl.createAndInitialize(ServiceLocatorImpl.java:1074) ~[hk2-locator-2.5.0-b42.jar:?]
	at org.glassfish.jersey.inject.hk2.AbstractHk2InjectionManager.createAndInitialize(AbstractHk2InjectionManager.java:213) ~[jersey-hk2-2.26.jar:?]
	at org.glassfish.jersey.inject.hk2.ImmediateHk2InjectionManager.createAndInitialize(ImmediateHk2InjectionManager.java:54) ~[jersey-hk2-2.26.jar:?]
	at org.glassfish.jersey.model.internal.CommonConfig.configureFeatures(CommonConfig.java:682) ~[jersey-common-2.26.jar:?]
	at org.glassfish.jersey.model.internal.CommonConfig.configureMetaProviders(CommonConfig.java:635) ~[jersey-common-2.26.jar:?]
	at org.glassfish.jersey.server.ResourceConfig.configureMetaProviders(ResourceConfig.java:823) ~[jersey-server-2.26.jar:?]
	at org.glassfish.jersey.server.ApplicationHandler.initialize(ApplicationHandler.java:351) ~[jersey-server-2.26.jar:?]
	at org.glassfish.jersey.server.ApplicationHandler.lambda$initialize$1(ApplicationHandler.java:316) ~[jersey-server-2.26.jar:?]
	at org.glassfish.jersey.internal.Errors.process(Errors.java:316) ~[jersey-common-2.26.jar:?]
	at org.glassfish.jersey.internal.Errors.process(Errors.java:298) ~[jersey-common-2.26.jar:?]
	at org.glassfish.jersey.internal.Errors.processWithException(Errors.java:256) ~[jersey-common-2.26.jar:?]
	at org.glassfish.jersey.server.ApplicationHandler.initialize(ApplicationHandler.java:315) ~[jersey-server-2.26.jar:?]
	at org.glassfish.jersey.server.ApplicationHandler.<init>(ApplicationHandler.java:282) ~[jersey-server-2.26.jar:?]
	at org.glassfish.jersey.servlet.WebComponent.<init>(WebComponent.java:335) ~[jersey-container-servlet-core-2.26.jar:?]
	at org.glassfish.jersey.servlet.ServletContainer.init(ServletContainer.java:178) ~[jersey-container-servlet-core-2.26.jar:?]
	at org.glassfish.jersey.servlet.ServletContainer.init(ServletContainer.java:370) ~[jersey-container-servlet-core-2.26.jar:?]
	at javax.servlet.GenericServlet.init(GenericServlet.java:158) ~[tomcat-embed-core-8.5.28.jar:8.5.28]
	at org.apache.catalina.core.StandardWrapper.initServlet(StandardWrapper.java:1144) [tomcat-embed-core-8.5.28.jar:8.5.28]
	at org.apache.catalina.core.StandardWrapper.allocate(StandardWrapper.java:789) [tomcat-embed-core-8.5.28.jar:8.5.28]
	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:133) [tomcat-embed-core-8.5.28.jar:8.5.28]
	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:96) [tomcat-embed-core-8.5.28.jar:8.5.28]
	at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:496) [tomcat-embed-core-8.5.28.jar:8.5.28]
	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:140) [tomcat-embed-core-8.5.28.jar:8.5.28]
	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:81) [tomcat-embed-core-8.5.28.jar:8.5.28]
	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:87) [tomcat-embed-core-8.5.28.jar:8.5.28]
	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:342) [tomcat-embed-core-8.5.28.jar:8.5.28]
	at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:803) [tomcat-embed-core-8.5.28.jar:8.5.28]
	at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66) [tomcat-embed-core-8.5.28.jar:8.5.28]
	at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:790) [tomcat-embed-core-8.5.28.jar:8.5.28]
	at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1459) [tomcat-embed-core-8.5.28.jar:8.5.28]
	at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49) [tomcat-embed-core-8.5.28.jar:8.5.28]
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) [?:1.8.0_121]
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) [?:1.8.0_121]
	at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) [tomcat-embed-core-8.5.28.jar:8.5.28]
	at java.lang.Thread.run(Thread.java:745) [?:1.8.0_121]
Caused by: org.glassfish.hk2.api.UnsatisfiedDependencyException: There was no object available for injection at SystemInjecteeImpl(requiredType=BeanExample,parent=FeatureExample,qualifiers={},position=-1,optional=false,self=false,unqualified=null,1027281488)
	... 39 more
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant