You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Brian Toal <br...@gmail.com> on 2017/10/04 07:53:27 UTC

Embedded tomcat does not find web-fragment in jars outside web-inf\lib continued...

The chain [1] left of with:
"The relevant language is in section 8.2.1

<quote>
If a framework wants its META-INF/web-fragment.xml honored in such a way
that it augments a web application's web.xml, the framework must be bundled
within the web application's WEB-INF/lib directory
</quote>

Therefore, Tomcat 8.0 looks to be doing the right thing."

Which I think is fine for the case where the container is augmenting a
existing web.xml.

However the spec also says "If a framework is packaged as a jar file and
has metadata information in the form of deployment descriptor then the
web-fragment.xml descriptor must be in the META-INF/ directory of the jar
file."

I'm not interested in augmenting a existing web.xml, nor my embedded app is
using WEB-INF/lib, which seems not to meet the eligibility critieria for
adding the jar to WEB-INF/lib , tomcat should honor
META-INF/web-fragment.xml in jars in the absence of web.xml, to determine
if the Servlet 3.0 annotations are going to be scanned.  This is the
problem I'm having after fixing the classloading issues in [2].

Thoughts?


[1] - https://marc.info/?l=tomcat-user&m=149443917508077&w=2
[2] - https://marc.info/?l=tomcat-user&m=150701409822162&w=2

Re: Embedded tomcat does not find web-fragment in jars outside web-inf\lib continued...

Posted by Brian Toal <br...@gmail.com>.
Jetty also makes it very easy to scan jar for @WebServlet, @WebFilter,
@WebListener via AnnotationConfiguration.

http://www.eclipse.org/jetty/documentation/9.4.x/configuring-webapps.html

On Wed, Oct 4, 2017 at 12:53 AM, Brian Toal <br...@gmail.com> wrote:

> The chain [1] left of with:
> "The relevant language is in section 8.2.1
>
> <quote>
> If a framework wants its META-INF/web-fragment.xml honored in such a way
> that it augments a web application's web.xml, the framework must be bundled
> within the web application's WEB-INF/lib directory
> </quote>
>
> Therefore, Tomcat 8.0 looks to be doing the right thing."
>
> Which I think is fine for the case where the container is augmenting a
> existing web.xml.
>
> However the spec also says "If a framework is packaged as a jar file and
> has metadata information in the form of deployment descriptor then the
> web-fragment.xml descriptor must be in the META-INF/ directory of the jar
> file."
>
> I'm not interested in augmenting a existing web.xml, nor my embedded app
> is using WEB-INF/lib, which seems not to meet the eligibility critieria for
> adding the jar to WEB-INF/lib , tomcat should honor
> META-INF/web-fragment.xml in jars in the absence of web.xml, to determine
> if the Servlet 3.0 annotations are going to be scanned.  This is the
> problem I'm having after fixing the classloading issues in [2].
>
> Thoughts?
>
>
> [1] - https://marc.info/?l=tomcat-user&m=149443917508077&w=2
> [2] - https://marc.info/?l=tomcat-user&m=150701409822162&w=2
>
>
>

Re: Embedded tomcat does not find web-fragment in jars outside web-inf\lib continued...

Posted by Mark Thomas <ma...@apache.org>.
On 04/10/17 08:53, Brian Toal wrote:
> The chain [1] left of with:
> "The relevant language is in section 8.2.1
> 
> <quote>
> If a framework wants its META-INF/web-fragment.xml honored in such a way
> that it augments a web application's web.xml, the framework must be bundled
> within the web application's WEB-INF/lib directory
> </quote>
> 
> Therefore, Tomcat 8.0 looks to be doing the right thing."
> 
> Which I think is fine for the case where the container is augmenting a
> existing web.xml.
> 
> However the spec also says "If a framework is packaged as a jar file and
> has metadata information in the form of deployment descriptor then the
> web-fragment.xml descriptor must be in the META-INF/ directory of the jar
> file."
> 
> I'm not interested in augmenting a existing web.xml, nor my embedded app is
> using WEB-INF/lib, which seems not to meet the eligibility critieria for
> adding the jar to WEB-INF/lib , tomcat should honor
> META-INF/web-fragment.xml in jars in the absence of web.xml, to determine
> if the Servlet 3.0 annotations are going to be scanned.  This is the
> problem I'm having after fixing the classloading issues in [2].
> 
> Thoughts?

If you use addContext() the expectation is that you also take on
responsibility for performing all of the configuration.

If you want all the standard Servlet spec behaviour out of the box, you
need to use addWebapp().

If you take the addContext() route then you can make use of the same
code Tomcat uses to perform the configuration. Suggestions on how to
make that more extensible / flexible / etc. welcome.

Mark


> [1] - https://marc.info/?l=tomcat-user&m=149443917508077&w=2
> [2] - https://marc.info/?l=tomcat-user&m=150701409822162&w=2
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org