You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Benson Margulies <be...@basistech.com> on 2012/09/14 17:56:22 UTC

Can't seem to get metadata-complete turned on

I'm using tomcat 7.0.29, embedded.

My web.xml web-app element looks like:

<web-app xmlns="http://java.sun.com/xml/ns/javaee"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
         version="3.0"
         metadata-complete="true"
        >

Yet, in ContextConfig.webConfig, isMetadataComplete() returns false, and
annotation processing happens. And, to make my day, it runs out of memory.

Re: Can't seem to get metadata-complete turned on

Posted by Mark Thomas <ma...@apache.org>.
On 14/09/2012 17:31, Benson Margulies wrote:
> On Fri, Sep 14, 2012 at 12:27 PM, Mark Thomas <ma...@apache.org> wrote:
>> Benson Margulies <be...@basistech.com> wrote:
>>
>>> Apologies for the accidental use of HTML.
>>>
>>> The problem below is triggered by the facts that:
>>>
>>> a) spring-web contains a ServletContainerInitializer
>>> b) even with metadata-complete, tomcat does annotation scanning once
>>> it sees one of those
>>
>> Yes, this is a mandatory requirement of the servlet spec. Yes, it is a PITA. Your best bet is to add the spring jar to jarsToSkip which should stop it being scanned for the SCI in the first place. If you need features provided by the SCI, then you can add the other jars to the skip list.
> 
> Mark, does the OOM suggest something worth trying to track down? I
> gave it 0.5G of memory and it still filled it up whilst looking for
> annotations. Making you a test case of this is not impossible but not
> trivial.

An upgrade to 7.0.30 should fix that.

> Also, I was surprised to note that tomcat seems to do annotation
> scanning even for a version 2.4 webapp, which has no metadata-complete
> option in the schema.

Yes. Again, a mandatory requirement of the servlet spec. Again, a PITA.
I (and others) have tried and failed to argue against this behaviour.

Mark


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


Re: Can't seem to get metadata-complete turned on

Posted by Benson Margulies <be...@basistech.com>.
On Fri, Sep 14, 2012 at 12:27 PM, Mark Thomas <ma...@apache.org> wrote:
> Benson Margulies <be...@basistech.com> wrote:
>
>>Apologies for the accidental use of HTML.
>>
>>The problem below is triggered by the facts that:
>>
>>a) spring-web contains a ServletContainerInitializer
>>b) even with metadata-complete, tomcat does annotation scanning once
>>it sees one of those
>
> Yes, this is a mandatory requirement of the servlet spec. Yes, it is a PITA. Your best bet is to add the spring jar to jarsToSkip which should stop it being scanned for the SCI in the first place. If you need features provided by the SCI, then you can add the other jars to the skip list.

Mark, does the OOM suggest something worth trying to track down? I
gave it 0.5G of memory and it still filled it up whilst looking for
annotations. Making you a test case of this is not impossible but not
trivial.


Also, I was surprised to note that tomcat seems to do annotation
scanning even for a version 2.4 webapp, which has no metadata-complete
option in the schema.

>
> Mark
>
>>c) In my embedded environment, there's a lot of real estate to
>>potentially scan in the classpath.
>>
>>Is (b) really correct?
>>
>>Unfortunately, I need spring-web in order to get the log4j support,
>>even though I don't want any of that other stuff in there.
>>
>>
>>
>>
>>On Fri, Sep 14, 2012 at 11:56 AM, Benson Margulies
>><be...@basistech.com> wrote:
>>>
>>> I'm using tomcat 7.0.29, embedded.
>>>
>>> My web.xml web-app element looks like:
>>>
>>> <web-app xmlns="http://java.sun.com/xml/ns/javaee"
>>>          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>>>          xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
>>> http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
>>>          version="3.0"
>>>          metadata-complete="true"
>>>         >
>>>
>>> Yet, in ContextConfig.webConfig, isMetadataComplete() returns false,
>>and
>>> annotation processing happens. And, to make my day, it runs out of
>>memory.
>>>
>>>
>>
>>---------------------------------------------------------------------
>>To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>>For additional commands, e-mail: users-help@tomcat.apache.org
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>

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


Re: Can't seem to get metadata-complete turned on

Posted by Benson Margulies <be...@basistech.com>.
On Fri, Sep 14, 2012 at 1:06 PM, Mark Thomas <ma...@apache.org> wrote:
> On 14/09/2012 17:36, Benson Margulies wrote:
>> On Fri, Sep 14, 2012 at 12:27 PM, Mark Thomas <ma...@apache.org> wrote:
>>> Benson Margulies <be...@basistech.com> wrote:
>>>
>>>> Apologies for the accidental use of HTML.
>>>>
>>>> The problem below is triggered by the facts that:
>>>>
>>>> a) spring-web contains a ServletContainerInitializer
>>>> b) even with metadata-complete, tomcat does annotation scanning once
>>>> it sees one of those
>>>
>>> Yes, this is a mandatory requirement of the servlet spec. Yes, it is a PITA. Your best bet is to add the spring jar to jarsToSkip which should stop it being scanned for the SCI in the first place. If you need features provided by the SCI, then you can add the other jars to the skip list.
>>
>> Mark, this leads me to a related question. If I'm launching tomcat
>> embedded, I have no catalina.properties, right? So I don't even have
>> the lengthy normal list of jarsToSkip. Would you recommend settings
>> that Tld-scan-limiting property by just calling System.setProperty for
>> my embedded application?
>
> See how you get on with 7.0.30. If you still see issues, then yes.

all better with 7.0.30.


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

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


Re: Can't seem to get metadata-complete turned on

Posted by Mark Thomas <ma...@apache.org>.
On 14/09/2012 17:36, Benson Margulies wrote:
> On Fri, Sep 14, 2012 at 12:27 PM, Mark Thomas <ma...@apache.org> wrote:
>> Benson Margulies <be...@basistech.com> wrote:
>>
>>> Apologies for the accidental use of HTML.
>>>
>>> The problem below is triggered by the facts that:
>>>
>>> a) spring-web contains a ServletContainerInitializer
>>> b) even with metadata-complete, tomcat does annotation scanning once
>>> it sees one of those
>>
>> Yes, this is a mandatory requirement of the servlet spec. Yes, it is a PITA. Your best bet is to add the spring jar to jarsToSkip which should stop it being scanned for the SCI in the first place. If you need features provided by the SCI, then you can add the other jars to the skip list.
> 
> Mark, this leads me to a related question. If I'm launching tomcat
> embedded, I have no catalina.properties, right? So I don't even have
> the lengthy normal list of jarsToSkip. Would you recommend settings
> that Tld-scan-limiting property by just calling System.setProperty for
> my embedded application?

See how you get on with 7.0.30. If you still see issues, then yes.

Mark


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


Re: Can't seem to get metadata-complete turned on

Posted by Benson Margulies <be...@basistech.com>.
On Fri, Sep 14, 2012 at 12:27 PM, Mark Thomas <ma...@apache.org> wrote:
> Benson Margulies <be...@basistech.com> wrote:
>
>>Apologies for the accidental use of HTML.
>>
>>The problem below is triggered by the facts that:
>>
>>a) spring-web contains a ServletContainerInitializer
>>b) even with metadata-complete, tomcat does annotation scanning once
>>it sees one of those
>
> Yes, this is a mandatory requirement of the servlet spec. Yes, it is a PITA. Your best bet is to add the spring jar to jarsToSkip which should stop it being scanned for the SCI in the first place. If you need features provided by the SCI, then you can add the other jars to the skip list.

Mark, this leads me to a related question. If I'm launching tomcat
embedded, I have no catalina.properties, right? So I don't even have
the lengthy normal list of jarsToSkip. Would you recommend settings
that Tld-scan-limiting property by just calling System.setProperty for
my embedded application?


>
> Mark
>
>>c) In my embedded environment, there's a lot of real estate to
>>potentially scan in the classpath.
>>
>>Is (b) really correct?
>>
>>Unfortunately, I need spring-web in order to get the log4j support,
>>even though I don't want any of that other stuff in there.
>>
>>
>>
>>
>>On Fri, Sep 14, 2012 at 11:56 AM, Benson Margulies
>><be...@basistech.com> wrote:
>>>
>>> I'm using tomcat 7.0.29, embedded.
>>>
>>> My web.xml web-app element looks like:
>>>
>>> <web-app xmlns="http://java.sun.com/xml/ns/javaee"
>>>          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>>>          xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
>>> http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
>>>          version="3.0"
>>>          metadata-complete="true"
>>>         >
>>>
>>> Yet, in ContextConfig.webConfig, isMetadataComplete() returns false,
>>and
>>> annotation processing happens. And, to make my day, it runs out of
>>memory.
>>>
>>>
>>
>>---------------------------------------------------------------------
>>To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>>For additional commands, e-mail: users-help@tomcat.apache.org
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>

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


Re: Can't seem to get metadata-complete turned on

Posted by Mark Thomas <ma...@apache.org>.
Benson Margulies <be...@basistech.com> wrote:

>Apologies for the accidental use of HTML.
>
>The problem below is triggered by the facts that:
>
>a) spring-web contains a ServletContainerInitializer
>b) even with metadata-complete, tomcat does annotation scanning once
>it sees one of those

Yes, this is a mandatory requirement of the servlet spec. Yes, it is a PITA. Your best bet is to add the spring jar to jarsToSkip which should stop it being scanned for the SCI in the first place. If you need features provided by the SCI, then you can add the other jars to the skip list.

Mark

>c) In my embedded environment, there's a lot of real estate to
>potentially scan in the classpath.
>
>Is (b) really correct?
>
>Unfortunately, I need spring-web in order to get the log4j support,
>even though I don't want any of that other stuff in there.
>
>
>
>
>On Fri, Sep 14, 2012 at 11:56 AM, Benson Margulies
><be...@basistech.com> wrote:
>>
>> I'm using tomcat 7.0.29, embedded.
>>
>> My web.xml web-app element looks like:
>>
>> <web-app xmlns="http://java.sun.com/xml/ns/javaee"
>>          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>>          xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
>> http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
>>          version="3.0"
>>          metadata-complete="true"
>>         >
>>
>> Yet, in ContextConfig.webConfig, isMetadataComplete() returns false,
>and
>> annotation processing happens. And, to make my day, it runs out of
>memory.
>>
>>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>For additional commands, e-mail: users-help@tomcat.apache.org



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


Re: Can't seem to get metadata-complete turned on

Posted by Christopher Schultz <ch...@christopherschultz.net>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Benson,

On 9/14/12 12:12 PM, Benson Margulies wrote:
> Apologies for the accidental use of HTML.
> 
> The problem below is triggered by the facts that:
> 
> a) spring-web contains a ServletContainerInitializer b) even with
> metadata-complete, tomcat does annotation scanning once it sees one
> of those c) In my embedded environment, there's a lot of real
> estate to potentially scan in the classpath.
> 
> Is (b) really correct?
> 
> Unfortunately, I need spring-web in order to get the log4j
> support, even though I don't want any of that other stuff in
> there.

Using Spring to get log4j support seems ... heavy-handed. Why not just
use log4j directly? Configuring the logging system is dead simple:
there is no dependency-injection or anything else like that which
Spring can provide for you.

- -chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG/MacGPG2 v2.0.17 (Darwin)
Comment: GPGTools - http://gpgtools.org
Comment: Using GnuPG with Mozilla - http://www.enigmail.net/

iEYEARECAAYFAlBXTzMACgkQ9CaO5/Lv0PCgRgCgq9tnaVcurxs9c7BCjxrPDUBm
Zw4An3MifnvCml+nkSJhFqic3un3ZB11
=ALVp
-----END PGP SIGNATURE-----

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


Re: Can't seem to get metadata-complete turned on

Posted by Benson Margulies <be...@basistech.com>.
Apologies for the accidental use of HTML.

The problem below is triggered by the facts that:

a) spring-web contains a ServletContainerInitializer
b) even with metadata-complete, tomcat does annotation scanning once
it sees one of those
c) In my embedded environment, there's a lot of real estate to
potentially scan in the classpath.

Is (b) really correct?

Unfortunately, I need spring-web in order to get the log4j support,
even though I don't want any of that other stuff in there.




On Fri, Sep 14, 2012 at 11:56 AM, Benson Margulies <be...@basistech.com> wrote:
>
> I'm using tomcat 7.0.29, embedded.
>
> My web.xml web-app element looks like:
>
> <web-app xmlns="http://java.sun.com/xml/ns/javaee"
>          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>          xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
> http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
>          version="3.0"
>          metadata-complete="true"
>         >
>
> Yet, in ContextConfig.webConfig, isMetadataComplete() returns false, and
> annotation processing happens. And, to make my day, it runs out of memory.
>
>

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