jersey-spring3 instantiating Spring-managed bean (null!)

后端 未结 3 1668
情歌与酒
情歌与酒 2020-12-06 02:26

I first want to point out that this is by and large the biggest problem in terms of time wasted that I have ever dealt with in my career. (Over two days straight now with e

3条回答
  •  死守一世寂寞
    2020-12-06 02:38

    This is the message that is key to understanding the issue. It indicates that Spring is failing to initialise correctly:

    SEVERE: Spring context lookup failed, skipping spring component provider initialization.
    

    (On a side note: because Spring is failing to initialise, the only JSR-330 implementation to try and resolve the @Inject is HK2 - which is why you're seeing the other issue).

    Anyway, the problem is likely that your container isn't performing a scan for the annotations that make all the jersey-spring3 magic happen.

    This behaviour is part of the Servlet 3.0 Specification (JSR-33, Section 1.6.2), so you should double check that your container supports this.

    In the case of Tomcat - unless you're running Tomcat 7.0.29 or newer, you'll actually need to make sure that the Servlet version is specified in your web.xml.

    http://tomcat.apache.org/tomcat-7.0-doc/changelog.html#Tomcat_7.0.29_(markt)

    I hit this problem recently and it drove me nuts, and fixing the web.xml was easier than upgrading from Ubuntu/Precise!

    Hope this helps!

提交回复
热议问题