You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Lucas Pouzac <lu...@gmail.com> on 2012/02/20 10:16:30 UTC

distributable mode does not work with Servlet 3.0

Hi,

I have a concern about replication sessions when using the standard Servlet
3.0.

Do you have an idea for this to work?


https://issues.apache.org/bugzilla/show_bug.cgi?id=52685

*If in web.xml, I declare:

<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" version="2.5">
...
<distributable />
...
</web-app>

the session replication works
(org.apache.catalina.ha.session.BackupManager).

But, if I declare:

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

the session replication doesn't work
(org.apache.catalina.session.StandardManager).*


(with 7.0.14 and 7.0.25 tomcat version).


Best Regards

Re: distributable mode does not work with Servlet 3.0

Posted by Pid <pi...@pidster.com>.
On 27/02/2012 14:45, Mark Thomas wrote:
> On 27/02/2012 14:33, Pid wrote:
>> On 27/02/2012 13:16, Christopher Schultz wrote:
>>> Lucas,
>>>
>>> On 2/27/12 5:36 AM, Lucas Pouzac wrote:
>>>> a library (prettyfaces) uses a web-tag fragment without 
>>>> <distributable />
>>>
>>>> With metadata-complete="true", It works correctly.
>>>
>>> Interesting.
> 
>> +1  That seems surprising.  I don't see why the fragment would
>> impact this.
> 
> Not at all surprising. Servlet 3.0, section 8.2.3, 5.g.ix
> <quote>
> The web.xml resulting from the merge is considered <distributable>
> only if all its web fragments are marked as <distributable> as well.
> </quote>

Ever the spec. :)


>>> We should probably issue a warning if a web fragment disagrees
>>> with a definite value for the "distributable" flag in the 
>>> webapp's web.xml.
> 
>> How would it do that?  There's no such tag as
>> <not-distributable/>.
> 
> It could be done easily on the merge but I'd be strongly against it.
> There are lots of rules for merging web fragments and I don't think we
> should be logging very decision that gets made.
> 
>> Shouldn't the web.xml value override the fragment value(s), in this
>> case?

So fragment authors will have to explicitly state that their components
should be distributable, or the app isn't.  That's a new one to look out
for. </learned-a-new-one>


p

-- 

[key:62590808]


Re: distributable mode does not work with Servlet 3.0

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

Mark,

On 2/27/12 9:45 AM, Mark Thomas wrote:
> It could be done easily on the merge but I'd be strongly against
> it. There are lots of rules for merging web fragments and I don't
> think we should be logging very decision that gets made.

If there's a place where the webapp is definitely set to
<distributable> but then it gets un-set, that could be captured in a
single place, and logged, right?

Certainly, I wouldn't suggest that all the merging code be audited for
this kind of thing and explicit checks added.

Is there a class that represents the configuration of the webapp
before it becomes an instance of a Context (or even the Context
itself) that could be rigged to detect this state-change in one single
location?

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

iEYEARECAAYFAk9LvBEACgkQ9CaO5/Lv0PBM8ACfdQAK4QS416z+pXuVzewdnZbz
EhYAn2sEC8sh7nbVfnlRkm5q085ACLpm
=ZY+h
-----END PGP SIGNATURE-----

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


Re: distributable mode does not work with Servlet 3.0

Posted by Mark Thomas <ma...@apache.org>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 27/02/2012 14:33, Pid wrote:
> On 27/02/2012 13:16, Christopher Schultz wrote:
>> Lucas,
>> 
>> On 2/27/12 5:36 AM, Lucas Pouzac wrote:
>>> a library (prettyfaces) uses a web-tag fragment without 
>>> <distributable />
>> 
>>> With metadata-complete="true", It works correctly.
>> 
>> Interesting.
> 
> +1  That seems surprising.  I don't see why the fragment would
> impact this.

Not at all surprising. Servlet 3.0, section 8.2.3, 5.g.ix
<quote>
The web.xml resulting from the merge is considered <distributable>
only if all its web fragments are marked as <distributable> as well.
</quote>

>> We should probably issue a warning if a web fragment disagrees
>> with a definite value for the "distributable" flag in the 
>> webapp's web.xml.
> 
> How would it do that?  There's no such tag as
> <not-distributable/>.

It could be done easily on the merge but I'd be strongly against it.
There are lots of rules for merging web fragments and I don't think we
should be logging very decision that gets made.

> Shouldn't the web.xml value override the fragment value(s), in this
> case?

No. See above.

Mark
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iQIcBAEBAgAGBQJPS5cjAAoJEBDAHFovYFnn5I8P/3iKBbpuhIbVDh9XBjQakRML
G9cN5aaL5sZbLZ5kbGhtulIY5MeKrt/dbEJMwBR6hEdwyUD1AbxTUzu2CuQMNnZT
zkQokXJmUvSqV7/L1MBY+FRGKJviFbcgCQEQqloywrkPeMolLsm3M/ZUMu04jm+z
AkEH6RMPUeJqOd5m2J+0olEU51qYXRYCm5clK1Q4wM6idIfqK1/kjCEcC1CHLFCv
+Ao6XZmj71Ld1id87mO0ciuxniARJ9wKjVegby4DUK/rIhTWmDsdeWC1gSdpHSbn
bBhoc27CPIv+N7apbe3ILsD1fw3Gb3O6Q2LbQxqBMRGJZCxEwMdHZpmXDu9jyIM2
9wHvV2KjyvGiivi1bk8eqwsDnc06umBUoGdEAb8KwTY7AOqVgnyOQnkeB6IWEcwx
3SPBqHd9PMB2wnyquIb0EKLOkNCfmvbuUkYAfz9wROzfzUt/fzDNvGMjVpSEcAap
Zztf/E7aJmsjvNeseAjpf31EMEM+J0ftqoRG3ZRT5UyCy6NQmUzB72D/9mEAPirN
ayaSmahgt5yTv5eqGkNmr/AowFMNZkIekRc9xyNTGb3YwN0sNNVGnD/krQd/MbdF
yWCPP1IQlTxGa6kRXFewBvo8OzyJ0rVMquP6gtZ9JPWk9Q4gozhL/fHu4xBoY8d2
Q97nYUSY9Sl5oOwQK4BF
=NWDF
-----END PGP SIGNATURE-----

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


Re: distributable mode does not work with Servlet 3.0

Posted by Pid <pi...@pidster.com>.
On 27/02/2012 13:16, Christopher Schultz wrote:
> Lucas,
> 
> On 2/27/12 5:36 AM, Lucas Pouzac wrote:
>> a library (prettyfaces) uses a web-tag fragment without
>> <distributable />
> 
>> With metadata-complete="true", It works correctly.
> 
> Interesting.

+1  That seems surprising.  I don't see why the fragment would impact this.


> We should probably issue a warning if a web fragment
> disagrees with a definite value for the "distributable" flag in the
> webapp's web.xml.

How would it do that?  There's no such tag as <not-distributable/>.
Shouldn't the web.xml value override the fragment value(s), in this case?


p

> Did you see anything in your logs that would suggest there was a problem?
> 
> -chris
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
> 

-- 

[key:62590808]


Re: distributable mode does not work with Servlet 3.0

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

Lucas,

On 2/27/12 5:36 AM, Lucas Pouzac wrote:
> a library (prettyfaces) uses a web-tag fragment without
> <distributable />
> 
> With metadata-complete="true", It works correctly.

Interesting. We should probably issue a warning if a web fragment
disagrees with a definite value for the "distributable" flag in the
webapp's web.xml.

Did you see anything in your logs that would suggest there was a problem?

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

iEYEARECAAYFAk9LgksACgkQ9CaO5/Lv0PAZQwCgr4VzdI+KO2P3tul6eeHBVyo8
EMoAoIQnXkscbG/bviWVt9v17bGhLxbZ
=gGP8
-----END PGP SIGNATURE-----

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


Re: distributable mode does not work with Servlet 3.0

Posted by Lucas Pouzac <lu...@gmail.com>.
Thanks,

a library (prettyfaces) uses a web-tag fragment without <distributable />

With metadata-complete="true", It works correctly.

Best regards.

2012/2/22 Konstantin Kolinko <kn...@gmail.com>

> 2012/2/22 Lucas Pouzac <lu...@gmail.com>:
> > No, in two cases, the tomcat configuration is identical. Only, I observe
> via
> > JMX as the manager is not correct. There is only the declaration of the
> XSD
> > in web.xml which changes.
> >
> > server.xml : the first cluster
> >(...)
> >                                <Manager
> > className="org.apache.catalina.ha.session.BackupManager"
> > expireSessionsOnShutdown="false"
> >
>  notifyListenersOnReplication="true"
> > mapSendOptions="10" />
> >
> >                                <Valve
> > className="org.apache.catalina.ha.tcp.ReplicationValve"
> >
> >
> filter=".*\.gif;.*\.js;.*\.jpg;.*\.png;.*\.htm;.*\.html;.*\.css;.*\.txt;" />
>
> The above value for filter attribute is incorrect.
> The ';' character cannot be used to separate regexps in 7.0. It is a
> single regexp.
>
> >                                <Valve
> > className="org.apache.catalina.ha.session.JvmRouteBinderValve" />
> >
> >>
> >>
>
> 1. What exactly do you observe? Where? Why do you think that there is a
> problem?
> 2. What is in the logs?
>
> Regarding servlet 3.0:  enabling 3.0 turns on annotation and web
> fragments scanning. So maybe there are some additional components in
> your web application or its libraries that are detected.
> I do not remember how fragments that have different value of
> <distributable> are merged - you may look in the Servlet
> Specification.
>
> Try to add metadata-complete="true" to the <web-app> in your web.xml file.
>
> Best regards,
> Konstantin Kolinko
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>

Re: distributable mode does not work with Servlet 3.0

Posted by Konstantin Kolinko <kn...@gmail.com>.
2012/2/22 Lucas Pouzac <lu...@gmail.com>:
> No, in two cases, the tomcat configuration is identical. Only, I observe via
> JMX as the manager is not correct. There is only the declaration of the XSD
> in web.xml which changes.
>
> server.xml : the first cluster
>(...)
>                                <Manager
> className="org.apache.catalina.ha.session.BackupManager"
> expireSessionsOnShutdown="false"
>                                        notifyListenersOnReplication="true"
> mapSendOptions="10" />
>
>                                <Valve
> className="org.apache.catalina.ha.tcp.ReplicationValve"
>
> filter=".*\.gif;.*\.js;.*\.jpg;.*\.png;.*\.htm;.*\.html;.*\.css;.*\.txt;" />

The above value for filter attribute is incorrect.
The ';' character cannot be used to separate regexps in 7.0. It is a
single regexp.

>                                <Valve
> className="org.apache.catalina.ha.session.JvmRouteBinderValve" />
>
>>
>>

1. What exactly do you observe? Where? Why do you think that there is a problem?
2. What is in the logs?

Regarding servlet 3.0:  enabling 3.0 turns on annotation and web
fragments scanning. So maybe there are some additional components in
your web application or its libraries that are detected.
I do not remember how fragments that have different value of
<distributable> are merged - you may look in the Servlet
Specification.

Try to add metadata-complete="true" to the <web-app> in your web.xml file.

Best regards,
Konstantin Kolinko

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


Re: distributable mode does not work with Servlet 3.0

Posted by Lucas Pouzac <lu...@gmail.com>.
No, in two cases, the tomcat configuration is identical. Only, I observe via
JMX as the manager is not correct. There is only the declaration of the XSD
in web.xml which changes.

server.xml : the first cluster

<Server port="8005" shutdown="SHUTDOWN">
        <Listener className="org.apache.catalina.core.AprLifecycleListener"
SSLEngine="on" />
        <Listener className="org.apache.catalina.core.JasperListener" />
        <Listener
className="org.apache.catalina.core.JreMemoryLeakPreventionListener" />
        <Listener
className="org.apache.catalina.mbeans.GlobalResourcesLifecycleListener" />
        <Listener
className="org.apache.catalina.core.ThreadLocalLeakPreventionListener" />

        <GlobalNamingResources>
                <Resource name="UserDatabase" auth="Container"
                        type="org.apache.catalina.UserDatabase"
                        description="User database that can be updated and
saved"

factory="org.apache.catalina.users.MemoryUserDatabaseFactory"
                        pathname="conf/tomcat-users.xml" />
        </GlobalNamingResources>

        <Service name="Catalina">

                <Connector port="8080" redirectPort="8443"
protocol="HTTP/1.1" enableLookups="false"
                        acceptCount="100" maxHttpHeaderSize="8192"
connectionLinger="-1"
                        disableUploadTimeout="true"
connectionTimeout="20000"
                        keepAliveTimeout="60000" maxKeepAliveRequests="1000"
                        maxThreads="50"  processorCache="50" />

                <Connector port="8081" redirectPort="8443"
protocol="HTTP/1.1" enableLookups="false"
                        acceptCount="100" maxHttpHeaderSize="8192"
connectionLinger="-1"
                        disableUploadTimeout="true"
connectionTimeout="20000"
                        keepAliveTimeout="60000" maxKeepAliveRequests="1000"
                        maxThreads="10"  processorCache="10" />

                <Connector port="8009" redirectPort="8443"
protocol="AJP/1.3" enableLookups="false"
                        maxThreads="300"  processorCache="300" />

                <Engine name="Catalina" defaultHost="localhost"
jvmRoute="routeXX">

                        <Cluster
className="org.apache.catalina.ha.tcp.SimpleTcpCluster"
channelSendOptions="10">

                                <Manager
className="org.apache.catalina.ha.session.BackupManager"
expireSessionsOnShutdown="false"
                                        notifyListenersOnReplication="true"
mapSendOptions="10" />

                                <Channel
className="org.apache.catalina.tribes.group.GroupChannel">
                                        <Membership
className="org.apache.catalina.tribes.membership.McastService"
                                                address="ip" port="port"
frequency="500" dropTime="3000" />
                                        <Receiver
className="org.apache.catalina.tribes.transport.nio.NioReceiver"
                                                address="ip" port="port"
autoBind="100" selectorTimeout="5000" minThreads="2" maxThreads="6" />
                                        <Sender
className="org.apache.catalina.tribes.transport.ReplicationTransmitter">
                                                <Transport
className="org.apache.catalina.tribes.transport.nio.PooledParallelSender"

keepAliveCount="100000" keepAliveTime="600000" maxRetryAttempts="3" />
                                        </Sender>
                                        <Interceptor
className="org.apache.catalina.tribes.group.interceptors.TcpFailureDetector"
/>
                                        <Interceptor
className="org.apache.catalina.tribes.group.interceptors.MessageDispatch15Interceptor"
/>
                                </Channel>

                                <Valve
className="org.apache.catalina.ha.tcp.ReplicationValve"

filter=".*\.gif;.*\.js;.*\.jpg;.*\.png;.*\.htm;.*\.html;.*\.css;.*\.txt;" />
                                <Valve
className="org.apache.catalina.ha.session.JvmRouteBinderValve" />

                                <Deployer
className="org.apache.catalina.ha.deploy.FarmWarDeployer"
watchEnabled="false"
                                        tempDir="/tmp/war-temp/"
deployDir="/tmp/war-deploy/" watchDir="/tmp/war-listen/" />

                                <ClusterListener
className="org.apache.catalina.ha.session.JvmRouteSessionIDBinderListener"
/>
                                <ClusterListener
className="org.apache.catalina.ha.session.ClusterSessionListener" />
                        </Cluster>

                        <Realm
className="org.apache.catalina.realm.LockOutRealm">
                                <Realm
className="org.apache.catalina.realm.UserDatabaseRealm"
resourceName="UserDatabase" />
                        </Realm>

                        <Host name="localhost"  appBase="webapps"
unpackWARs="true" autoDeploy="true"/>
                </Engine>
        </Service>
</Server>


2012/2/21 Pid <pi...@pidster.com>

> On 20/02/2012 09:16, Lucas Pouzac wrote:
> > Hi,
> >
> > I have a concern about replication sessions when using the standard
> Servlet
> > 3.0.
> >
> > Do you have an idea for this to work?
> >
> >
> > https://issues.apache.org/bugzilla/show_bug.cgi?id=52685
> >
> > *If in web.xml, I declare:
> >
> > <web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> > xmlns="http://java.sun.com/xml/ns/javaee"
> > xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
> > xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
> > http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" version="2.5">
> > ...
> > <distributable />
> > ...
> > </web-app>
> >
> > the session replication works
> > (org.apache.catalina.ha.session.BackupManager).
> >
> > But, if I declare:
> >
> > <web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> > xmlns="http://java.sun.com/xml/ns/javaee"
> > xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
> > http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" version="3.0">
> > ...
> > <distributable />
> > ...
> > </web-app>
> >
> > the session replication doesn't work
> > (org.apache.catalina.session.StandardManager).*
>
> I think from the above, that you're saying that session replication
> doesn't work if you use a manager that doesn't replicate sessions.
>
> Is this correct?
>
>
> p
>
>
> --
>
> [key:62590808]
>
>

Re: distributable mode does not work with Servlet 3.0

Posted by Pid <pi...@pidster.com>.
On 20/02/2012 09:16, Lucas Pouzac wrote:
> Hi,
> 
> I have a concern about replication sessions when using the standard Servlet
> 3.0.
> 
> Do you have an idea for this to work?
> 
> 
> https://issues.apache.org/bugzilla/show_bug.cgi?id=52685
> 
> *If in web.xml, I declare:
> 
> <web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> xmlns="http://java.sun.com/xml/ns/javaee"
> xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
> xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
> http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" version="2.5">
> ...
> <distributable />
> ...
> </web-app>
> 
> the session replication works
> (org.apache.catalina.ha.session.BackupManager).
> 
> But, if I declare:
> 
> <web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> xmlns="http://java.sun.com/xml/ns/javaee"
> xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
> http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" version="3.0">
> ...
> <distributable />
> ...
> </web-app>
> 
> the session replication doesn't work
> (org.apache.catalina.session.StandardManager).*

I think from the above, that you're saying that session replication
doesn't work if you use a manager that doesn't replicate sessions.

Is this correct?


p


-- 

[key:62590808]