Tomcat - won't load my META-INF\services\javax.servlet.ServletContainerInitializer file?

后端 未结 4 1560
佛祖请我去吃肉
佛祖请我去吃肉 2021-01-02 07:32

I have a web project that has a \\META-INF\\services\\javax.servlet.ServletContainerInitializer file with its content pointing to the fully qualified name of a

4条回答
  •  遥遥无期
    2021-01-02 07:56

    I would like to quote some good explanation from Mark Thomas given on the user mailing list of Tomcat:

    Service files are loaded by class loaders from the META-INF/services directory.

    *.jar!/META-INF/services and *.war/WEB-INF/classes/META-INF/services are visible to class loaders

    *.war!/META-INF/services is not.

    The servlet expert group recently discussed WAR vs JAR in the context of Java 9 and mutli-version JARs. The conclusion was (I'm paraphrasing) that WARs are not a specialised form of JAR and while they share a common format a feature that is available to a JAR is NOT automatically available to a WAR unless the Servlet spec (of Java EE spec) explicitly states otherwise.

    Containers are free to add container specific extensions if they wish but they come with the usual (lack of) interoperability warnings.

    http://mail-archives.apache.org/mod_mbox/tomcat-users/201808.mbox/

提交回复
热议问题