You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Debraj Mallick <sr...@gmail.com> on 2011/11/30 17:31:32 UTC

Tomcat 7 + exception while adding cookies

hi all,

i am getting exception while adding cookies in response

*Stack trace*:
org.apache.catalina.connector.CoyoteAdapter service
SEVERE: An exception or error occurred in the container during the request
processing
java.lang.ArrayIndexOutOfBoundsException: 8192
at
org.apache.coyote.http11.AbstractOutputBuffer.write(AbstractOutputBuffer.java:522)
at
org.apache.coyote.http11.AbstractOutputBuffer.write(AbstractOutputBuffer.java:429)
at
org.apache.coyote.http11.AbstractOutputBuffer.sendHeader(AbstractOutputBuffer.java:395)
at
org.apache.coyote.http11.AbstractHttp11Processor.prepareResponse(AbstractHttp11Processor.java:965)
at
org.apache.coyote.http11.AbstractHttp11Processor.action(AbstractHttp11Processor.java:739)
at org.apache.coyote.Response.action(Response.java:170)
at org.apache.coyote.Response.sendHeaders(Response.java:350)
at org.apache.catalina.connector.OutputBuffer.doFlush(OutputBuffer.java:315)
at org.apache.catalina.connector.OutputBuffer.close(OutputBuffer.java:275)
at org.apache.catalina.connector.Response.finishResponse(Response.java:501)
at
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:426)
at
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:317)
at
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:204)
at
org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:311)
at
java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:662)
org.apache.coyote.http11.AbstractHttp11Processor endRequest
SEVERE: Error finishing response
java.lang.ArrayIndexOutOfBoundsException
at java.lang.System.arraycopy(Native Method)
at
org.apache.coyote.http11.AbstractOutputBuffer.write(AbstractOutputBuffer.java:491)
at
org.apache.coyote.http11.AbstractOutputBuffer.sendStatus(AbstractOutputBuffer.java:331)
at
org.apache.coyote.http11.AbstractHttp11Processor.prepareResponse(AbstractHttp11Processor.java:952)
at
org.apache.coyote.http11.AbstractHttp11Processor.action(AbstractHttp11Processor.java:739)
at org.apache.coyote.Response.action(Response.java:168)
at
org.apache.coyote.http11.AbstractOutputBuffer.endRequest(AbstractOutputBuffer.java:308)
at
org.apache.coyote.http11.InternalOutputBuffer.endRequest(InternalOutputBuffer.java:160)
at
org.apache.coyote.http11.AbstractHttp11Processor.endRequest(AbstractHttp11Processor.java:990)
at
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:350)
at
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:204)
at
org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:311)
at
java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:662)
org.apache.catalina.connector.CoyoteAdapter service
SEVERE: An exception or error occurred in the container during the request
processing
java.lang.ArrayIndexOutOfBoundsException
org.apache.coyote.http11.AbstractHttp11Processor endRequest
SEVERE: Error finishing response
java.lang.ArrayIndexOutOfBoundsException
at java.lang.System.arraycopy(Native Method)
at
org.apache.coyote.http11.AbstractOutputBuffer.write(AbstractOutputBuffer.java:491)
at
org.apache.coyote.http11.AbstractOutputBuffer.sendStatus(AbstractOutputBuffer.java:331)
at
org.apache.coyote.http11.AbstractHttp11Processor.prepareResponse(AbstractHttp11Processor.java:952)
at
org.apache.coyote.http11.AbstractHttp11Processor.action(AbstractHttp11Processor.java:739)
at org.apache.coyote.Response.action(Response.java:168)
at
org.apache.coyote.http11.AbstractOutputBuffer.endRequest(AbstractOutputBuffer.java:308)
at
org.apache.coyote.http11.InternalOutputBuffer.endRequest(InternalOutputBuffer.java:160)
at
org.apache.coyote.http11.AbstractHttp11Processor.endRequest(AbstractHttp11Processor.java:990)
at
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:350)
at
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:204)
at
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:182)
at
org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:311)
at
java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:662)

i am using Tomcat 7, Struts2.2.3.1, JDK 1.6 and STS IDE


Thanks & Regards,
Debraj Mallick

Re: Tomcat 7 + exception while adding cookies

Posted by Martin Kuen <ma...@gmail.com>.
Hi,

On Thu, Dec 1, 2011 at 5:10 PM, Mark Thomas <ma...@apache.org> wrote:

> On 01/12/2011 15:49, Martin Kuen wrote:
> > I first blamed eclipse wtp doing sth. wrong when applying the
> > configuration. Therefore, I checked the connector's jmx properties and to
> > my surprise I could no longer find a property called "maxHttpHeaderSize"
> > for the connector (comparing tc 6 to 7).
>
> The JMX properties are not the definitive list of supported properties.
> That is provided by the documentation and maxHttpHeaderSize is still
> listed.
>

> > Was it dropped by intention? I skimmed through the changelogs but
> couldn't
> > find an explanation . . .
>
> It was dropped from JMX as part of the GSOC attribute clean-up since
> that attribute is implemented in the ProtocolHandler (where it is
> available via JMX).
>

thanks for the info.


> > Afaik as I know this is a configurable setting for (at least most)
> > webservers
>
> As it is (or should be if it is working properly) for all version of
> Tomcat.
>

Well, oc it's working. Don't know what went wrong on my side yesterday. I
just got rather confused, when I could not find aforementioned jmx property.

Things make sense again :)


Best Regards,

Martin

Re: Tomcat 7 + exception while adding cookies

Posted by Mark Thomas <ma...@apache.org>.
On 01/12/2011 15:49, Martin Kuen wrote:
> I first blamed eclipse wtp doing sth. wrong when applying the
> configuration. Therefore, I checked the connector's jmx properties and to
> my surprise I could no longer find a property called "maxHttpHeaderSize"
> for the connector (comparing tc 6 to 7).

The JMX properties are not the definitive list of supported properties.
That is provided by the documentation and maxHttpHeaderSize is still listed.

> Was it dropped by intention? I skimmed through the changelogs but couldn't
> find an explanation . . .

It was dropped from JMX as part of the GSOC attribute clean-up since
that attribute is implemented in the ProtocolHandler (where it is
available via JMX).

> Afaik as I know this is a configurable setting for (at least most)
> webservers

As it is (or should be if it is working properly) for all version of Tomcat.

Mark

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


Re: Tomcat 7 + exception while adding cookies

Posted by Martin Kuen <ma...@gmail.com>.
Hi Mallick, hi all,


To me it appears this setting is ignored by tc 7.0.x. I created a servlet:

protected void doGet(HttpServletRequest request, HttpServletResponse
response) throws ServletException, IOException {
 request.getSession().invalidate();
final int NUM_COOKIES = 500;
 for (int i = 0; i < NUM_COOKIES; i++) {
Cookie c = new Cookie("foo" + i, UUID.randomUUID().toString());
 response.addCookie(c);
}
 response.setContentType("text/html");
response.getWriter().write(
 "<html><head></head><body><h1>A ton of cookies</h1></body>"
 );
System.out.println("sent " + NUM_COOKIES);
 }

Accessing it causes the exception to be thrown. Whereas tc 6.0.33 behaviour
is changed by increasing "maxHttpHeaderSize", 7.0.0, 7.0.14, 7.0.21 ignore
the setting.
i.e.
for tc 6 setting maxHttpHeaderSize="8193" will cause OOB exception at index
8193.
for tc 7 OOB always happens at 8192.

I first blamed eclipse wtp doing sth. wrong when applying the
configuration. Therefore, I checked the connector's jmx properties and to
my surprise I could no longer find a property called "maxHttpHeaderSize"
for the connector (comparing tc 6 to 7).

Was it dropped by intention? I skimmed through the changelogs but couldn't
find an explanation . . .

Afaik as I know this is a configurable setting for (at least most)
webservers


Best Regards,

Martin

Re: Tomcat 7 + exception while adding cookies

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

Pid,

On 12/1/11 4:29 AM, Pid wrote:
> On 01/12/2011 04:38, Debraj Mallick wrote:
>> hi Christopher,
>> 
>> my tomcat version is : 7.0.14 working on Window7 with JDK 1.6
> 
> Can you try again with at least 7.0.21?

+1

There are 9 releases between your version and the current version. I'm
not going to read the changelog to see if anything in those 9 releases
could affect the OP.

But the OP could. ;)

- -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/

iEYEARECAAYFAk7YBV0ACgkQ9CaO5/Lv0PCx6QCgwmx9b8XrHcA3kocHZhHTSnkp
jzcAoL5LAsLYDHTieDFDV8tox3Mv5qHs
=LTSD
-----END PGP SIGNATURE-----

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


Re: Tomcat 7 + exception while adding cookies

Posted by Pid <pi...@pidster.com>.
On 01/12/2011 04:38, Debraj Mallick wrote:
> hi Christopher,
> 
> my tomcat version is : 7.0.14
> working on Window7 with JDK 1.6

Can you try again with at least 7.0.21?


p


> On Thu, Dec 1, 2011 at 4:45 AM, Christopher Schultz <
> chris@christopherschultz.net> wrote:
> 
> Debraj,
> 
> On 11/30/11 1:16 PM, Debraj Mallick wrote:
>>>> i have set maxHttpHeaderSize=81920 but still i am getting
>>>> exception *Stack trace:* 30 Nov, 2011 11:38:48 PM
>>>> org.apache.catalina.connector.CoyoteAdapter service SEVERE: An
>>>> exception or error occurred in the container during the request
>>>> processing java.lang.ArrayIndexOutOfBoundsException: 8192 at
>>>>
> org.apache.coyote.http11.AbstractOutputBuffer.write(AbstractOutputBuffer.java:522)
> 
> What
>>>>
> is the exact Tomcat version? 7.0.what?
> 
> -chris
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>> For additional commands, e-mail: users-help@tomcat.apache.org
>>
>>
> 
> 

-- 

[key:62590808]


Re: Tomcat 7 + exception while adding cookies

Posted by Debraj Mallick <sr...@gmail.com>.
hi Christopher,

my tomcat version is : 7.0.14
working on Window7 with JDK 1.6

On Thu, Dec 1, 2011 at 4:45 AM, Christopher Schultz <
chris@christopherschultz.net> wrote:

> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> Debraj,
>
> On 11/30/11 1:16 PM, Debraj Mallick wrote:
> > i have set maxHttpHeaderSize=81920 but still i am getting
> > exception *Stack trace:* 30 Nov, 2011 11:38:48 PM
> > org.apache.catalina.connector.CoyoteAdapter service SEVERE: An
> > exception or error occurred in the container during the request
> > processing java.lang.ArrayIndexOutOfBoundsException: 8192 at
> >
> org.apache.coyote.http11.AbstractOutputBuffer.write(AbstractOutputBuffer.java:522)
>
> What
> >
> is the exact Tomcat version? 7.0.what?
>
> - -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/
>
> iEYEARECAAYFAk7WuSUACgkQ9CaO5/Lv0PA/2QCcDp5xTeWSRbH237kS/hnvymEw
> mCkAnix/CYtwTv2reVljqHJfo0ka7RG8
> =VDsQ
> -----END PGP SIGNATURE-----
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>


-- 
Thanks & Regards,
Debraj Mallick
9674247281

Re: Tomcat 7 + exception while adding cookies

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

Debraj,

On 11/30/11 1:16 PM, Debraj Mallick wrote:
> i have set maxHttpHeaderSize=81920 but still i am getting
> exception *Stack trace:* 30 Nov, 2011 11:38:48 PM
> org.apache.catalina.connector.CoyoteAdapter service SEVERE: An
> exception or error occurred in the container during the request 
> processing java.lang.ArrayIndexOutOfBoundsException: 8192 at 
> org.apache.coyote.http11.AbstractOutputBuffer.write(AbstractOutputBuffer.java:522)

What
> 
is the exact Tomcat version? 7.0.what?

- -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/

iEYEARECAAYFAk7WuSUACgkQ9CaO5/Lv0PA/2QCcDp5xTeWSRbH237kS/hnvymEw
mCkAnix/CYtwTv2reVljqHJfo0ka7RG8
=VDsQ
-----END PGP SIGNATURE-----

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


Re: Tomcat 7 + exception while adding cookies

Posted by Debraj Mallick <sr...@gmail.com>.
Hi Martin,

i have set maxHttpHeaderSize=81920 but still i am getting exception
*Stack trace:*
30 Nov, 2011 11:38:48 PM org.apache.catalina.connector.CoyoteAdapter service
SEVERE: An exception or error occurred in the container during the request
processing
java.lang.ArrayIndexOutOfBoundsException: 8192
    at
org.apache.coyote.http11.AbstractOutputBuffer.write(AbstractOutputBuffer.java:522)
    at
org.apache.coyote.http11.AbstractOutputBuffer.write(AbstractOutputBuffer.java:429)
    at
org.apache.coyote.http11.AbstractOutputBuffer.sendHeader(AbstractOutputBuffer.java:395)
    at
org.apache.coyote.http11.AbstractHttp11Processor.prepareResponse(AbstractHttp11Processor.java:965)
    at
org.apache.coyote.http11.AbstractHttp11Processor.action(AbstractHttp11Processor.java:739)
    at org.apache.coyote.Response.action(Response.java:170)
    at org.apache.coyote.Response.sendHeaders(Response.java:350)
    at
org.apache.catalina.connector.OutputBuffer.doFlush(OutputBuffer.java:315)
    at
org.apache.catalina.connector.OutputBuffer.close(OutputBuffer.java:275)
    at
org.apache.catalina.connector.Response.finishResponse(Response.java:501)
    at
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:426)
    at
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:317)
    at
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:204)
    at
org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:311)
    at
java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
    at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
    at java.lang.Thread.run(Thread.java:662)
30 Nov, 2011 11:38:48 PM org.apache.coyote.http11.AbstractHttp11Processor
endRequest
SEVERE: Error finishing response
java.lang.ArrayIndexOutOfBoundsException
    at java.lang.System.arraycopy(Native Method)
    at
org.apache.coyote.http11.AbstractOutputBuffer.write(AbstractOutputBuffer.java:491)
    at
org.apache.coyote.http11.AbstractOutputBuffer.sendStatus(AbstractOutputBuffer.java:331)
    at
org.apache.coyote.http11.AbstractHttp11Processor.prepareResponse(AbstractHttp11Processor.java:952)
    at
org.apache.coyote.http11.AbstractHttp11Processor.action(AbstractHttp11Processor.java:739)
    at org.apache.coyote.Response.action(Response.java:168)
    at
org.apache.coyote.http11.AbstractOutputBuffer.endRequest(AbstractOutputBuffer.java:308)
    at
org.apache.coyote.http11.InternalOutputBuffer.endRequest(InternalOutputBuffer.java:160)
    at
org.apache.coyote.http11.AbstractHttp11Processor.endRequest(AbstractHttp11Processor.java:990)
    at
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:350)
    at
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:204)
    at
org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:311)
    at
java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
    at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
    at java.lang.Thread.run(Thread.java:662)
30 Nov, 2011 11:38:48 PM org.apache.catalina.connector.CoyoteAdapter service
SEVERE: An exception or error occurred in the container during the request
processing
java.lang.ArrayIndexOutOfBoundsException
30 Nov, 2011 11:38:48 PM org.apache.coyote.http11.AbstractHttp11Processor
endRequest
SEVERE: Error finishing response
java.lang.ArrayIndexOutOfBoundsException
    at java.lang.System.arraycopy(Native Method)
    at
org.apache.coyote.http11.AbstractOutputBuffer.write(AbstractOutputBuffer.java:491)
    at
org.apache.coyote.http11.AbstractOutputBuffer.sendStatus(AbstractOutputBuffer.java:331)
    at
org.apache.coyote.http11.AbstractHttp11Processor.prepareResponse(AbstractHttp11Processor.java:952)
    at
org.apache.coyote.http11.AbstractHttp11Processor.action(AbstractHttp11Processor.java:739)
    at org.apache.coyote.Response.action(Response.java:168)
    at
org.apache.coyote.http11.AbstractOutputBuffer.endRequest(AbstractOutputBuffer.java:308)
    at
org.apache.coyote.http11.InternalOutputBuffer.endRequest(InternalOutputBuffer.java:160)
    at
org.apache.coyote.http11.AbstractHttp11Processor.endRequest(AbstractHttp11Processor.java:990)
    at
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:350)
    at
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:204)
    at
org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:311)
    at
java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
    at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
    at java.lang.Thread.run(Thread.java:662)
30 Nov, 2011 11:38:48 PM org.apache.catalina.connector.CoyoteAdapter service
SEVERE: An exception or error occurred in the container during the request
processing
java.lang.ArrayIndexOutOfBoundsException
30 Nov, 2011 11:38:48 PM org.apache.coyote.http11.AbstractHttp11Processor
endRequest
SEVERE: Error finishing response
java.lang.ArrayIndexOutOfBoundsException
    at java.lang.System.arraycopy(Native Method)
    at
org.apache.coyote.http11.AbstractOutputBuffer.write(AbstractOutputBuffer.java:491)
    at
org.apache.coyote.http11.AbstractOutputBuffer.sendStatus(AbstractOutputBuffer.java:331)
    at
org.apache.coyote.http11.AbstractHttp11Processor.prepareResponse(AbstractHttp11Processor.java:952)
    at
org.apache.coyote.http11.AbstractHttp11Processor.action(AbstractHttp11Processor.java:739)
    at org.apache.coyote.Response.action(Response.java:168)
    at
org.apache.coyote.http11.AbstractOutputBuffer.endRequest(AbstractOutputBuffer.java:308)
    at
org.apache.coyote.http11.InternalOutputBuffer.endRequest(InternalOutputBuffer.java:160)
    at
org.apache.coyote.http11.AbstractHttp11Processor.endRequest(AbstractHttp11Processor.java:990)
    at
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:350)
    at
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:204)
    at
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:182)
    at
org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:311)
    at
java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
    at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
    at java.lang.Thread.run(Thread.java:662)






On Wed, Nov 30, 2011 at 10:41 PM, Martin Kuen <ma...@gmail.com> wrote:

> Hi Mallick,
>
> Try setting"maxHttpHeaderSize" for the <Connector/>  in your
> server.xml. Its default value is 8192 bytes. I guess you're exceeding this
> limit.
>
> i.e.
> <Connector executor="tomcatThreadPool"
>              port="8080" protocol="HTTP/1.1"
>              connectionTimeout="20000"
>              redirectPort="8443"
>               maxHttpHeaderSize="{Something greater than 8192}"/>
>
> More details/exact info:
>
> http://tomcat.apache.org/tomcat-7.0-doc/config/http.html#Standard_Implementation
>
>
> Best Regards,
>
> Martin
>



-- 
Thanks & Regards,
Debraj Mallick
9674247281

Re: Tomcat 7 + exception while adding cookies

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

Martin,

On 11/30/11 12:11 PM, Martin Kuen wrote:
> Try setting"maxHttpHeaderSize" for the <Connector/>  in your 
> server.xml. Its default value is 8192 bytes. I guess you're
> exceeding this limit.

+1

If you have a lot of cookies or if you are sending SSL certification
chains which tend to get long, you may run into this problem.

Honestly, Tomcat should probably be doing bounds-checking and emitting
a better error message in this case.

- -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/

iEYEARECAAYFAk7WarcACgkQ9CaO5/Lv0PDYqgCdEDThHZnVWixafAzaBsBK2nj2
kKEAnigmNp+6k5xM1LlIucMAl5vM2rUh
=JFez
-----END PGP SIGNATURE-----

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


Re: Tomcat 7 + exception while adding cookies

Posted by Martin Kuen <ma...@gmail.com>.
Hi Mallick,

Try setting"maxHttpHeaderSize" for the <Connector/>  in your
server.xml. Its default value is 8192 bytes. I guess you're exceeding this
limit.

i.e.
<Connector executor="tomcatThreadPool"
              port="8080" protocol="HTTP/1.1"
              connectionTimeout="20000"
              redirectPort="8443"
              maxHttpHeaderSize="{Something greater than 8192}"/>

More details/exact info:
http://tomcat.apache.org/tomcat-7.0-doc/config/http.html#Standard_Implementation


Best Regards,

Martin

Re: Tomcat 7 + exception while adding cookies

Posted by Debraj Mallick <sr...@gmail.com>.
Thankyou Dan for your quick response my *server.xml*:

<?xml version='1.0' encoding='utf-8'?>
<!--
  Licensed to the Apache Software Foundation (ASF) under one or more
  contributor license agreements.  See the NOTICE file distributed with
  this work for additional information regarding copyright ownership.
  The ASF licenses this file to You under the Apache License, Version 2.0
  (the "License"); you may not use this file except in compliance with
  the License.  You may obtain a copy of the License at

      http://www.apache.org/licenses/LICENSE-2.0

  Unless required by applicable law or agreed to in writing, software
  distributed under the License is distributed on an "AS IS" BASIS,
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  See the License for the specific language governing permissions and
  limitations under the License.
-->
<!-- Note:  A "Server" is not itself a "Container", so you may not
     define subcomponents such as "Valves" at this level.
     Documentation at /docs/config/server.html
 -->
<Server port="8005" shutdown="SHUTDOWN">
  <!-- Security listener. Documentation at /docs/config/listeners.html
  <Listener className="org.apache.catalina.security.SecurityListener" />
  -->
  <!--APR library loader. Documentation at /docs/apr.html -->
  <Listener className="org.apache.catalina.core.AprLifecycleListener"
SSLEngine="on" />
  <!--Initialize Jasper prior to webapps are loaded. Documentation at
/docs/jasper-howto.html -->
  <Listener className="org.apache.catalina.core.JasperListener" />
  <!-- Prevent memory leaks due to use of particular java/javax APIs-->
  <Listener
className="org.apache.catalina.core.JreMemoryLeakPreventionListener" />
  <Listener
className="org.apache.catalina.mbeans.GlobalResourcesLifecycleListener" />
  <Listener
className="org.apache.catalina.core.ThreadLocalLeakPreventionListener" />

  <!-- Global JNDI resources
       Documentation at /docs/jndi-resources-howto.html
  -->
  <GlobalNamingResources>
    <!-- Editable user database that can also be used by
         UserDatabaseRealm to authenticate users
    -->
    <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>

  <!-- A "Service" is a collection of one or more "Connectors" that share
       a single "Container" Note:  A "Service" is not itself a "Container",
       so you may not define subcomponents such as "Valves" at this level.
       Documentation at /docs/config/service.html
   -->
  <Service name="Catalina">

    <!--The connectors can use a shared executor, you can define one or
more named thread pools-->
    <!--
    <Executor name="tomcatThreadPool" namePrefix="catalina-exec-"
        maxThreads="150" minSpareThreads="4"/>
    -->


    <!-- A "Connector" represents an endpoint by which requests are received
         and responses are returned. Documentation at :
         Java HTTP Connector: /docs/config/http.html (blocking &
non-blocking)
         Java AJP  Connector: /docs/config/ajp.html
         APR (HTTP/AJP) Connector: /docs/apr.html
         Define a non-SSL HTTP/1.1 Connector on port 8080
    -->
    <Connector port="8080" protocol="HTTP/1.1"
               connectionTimeout="20000"
               redirectPort="8443" />
    <!-- A "Connector" using the shared thread pool-->
    <!--
    <Connector executor="tomcatThreadPool"
               port="8080" protocol="HTTP/1.1"
               connectionTimeout="20000"
               redirectPort="8443" />
    -->
    <!-- Define a SSL HTTP/1.1 Connector on port 8443
         This connector uses the JSSE configuration, when using APR, the
         connector should be using the OpenSSL style configuration
         described in the APR documentation -->
    <!--
    <Connector port="8443" protocol="HTTP/1.1" SSLEnabled="true"
               maxThreads="150" scheme="https" secure="true"
               clientAuth="false" sslProtocol="TLS" />
    -->

    <!-- Define an AJP 1.3 Connector on port 8009 -->
    <Connector port="8009" protocol="AJP/1.3" redirectPort="8443" />


    <!-- An Engine represents the entry point (within Catalina) that
processes
         every request.  The Engine implementation for Tomcat stand alone
         analyzes the HTTP headers included with the request, and passes
them
         on to the appropriate Host (virtual host).
         Documentation at /docs/config/engine.html -->

    <!-- You should set jvmRoute to support load-balancing via AJP ie :
    <Engine name="Catalina" defaultHost="localhost"
jvmRoute="jvm1">
    -->
    <Engine name="Catalina" defaultHost="localhost">

      <!--For clustering, please take a look at documentation at:
          /docs/cluster-howto.html  (simple how to)
          /docs/config/cluster.html (reference documentation) -->
      <!--
      <Cluster className="org.apache.catalina.ha.tcp.SimpleTcpCluster"/>
      -->

      <!-- Use the LockOutRealm to prevent attempts to guess user passwords
           via a brute-force attack -->
      <Realm className="org.apache.catalina.realm.LockOutRealm">
        <!-- This Realm uses the UserDatabase configured in the global JNDI
             resources under the key "UserDatabase".  Any edits
             that are performed against this UserDatabase are immediately
             available for use by the Realm.  -->
        <Realm className="org.apache.catalina.realm.UserDatabaseRealm"
               resourceName="UserDatabase"/>
      </Realm>

      <Host name="localhost"  appBase="webapps"
            unpackWARs="true" autoDeploy="true">

        <!-- SingleSignOn valve, share authentication between web
applications
             Documentation at: /docs/config/valve.html -->
        <!--
        <Valve className="org.apache.catalina.authenticator.SingleSignOn" />
        -->

        <!-- Access log processes all example.
             Documentation at: /docs/config/valve.html
             Note: The pattern used is equivalent to using pattern="common"
-->
        <Valve className="org.apache.catalina.valves.AccessLogValve"
directory="logs"
               prefix="localhost_access_log." suffix=".txt"
               pattern="%h %l %u %t &quot;%r&quot; %s %b"
resolveHosts="false"/>

      </Host>
    </Engine>
  </Service>
</Server>






On Wed, Nov 30, 2011 at 10:22 PM, Daniel Mikusa <dm...@vmware.com> wrote:

> On Wed, 2011-11-30 at 08:31 -0800, Debraj Mallick wrote:
> > hi all,
> >
> > i am getting exception while adding cookies in response
> >
> > *Stack trace*:
> > org.apache.catalina.connector.CoyoteAdapter service
> > SEVERE: An exception or error occurred in the container during the
> request
> > processing
> > java.lang.ArrayIndexOutOfBoundsException: 8192
> > at
> >
> org.apache.coyote.http11.AbstractOutputBuffer.write(AbstractOutputBuffer.java:522)
> > at
> >
> org.apache.coyote.http11.AbstractOutputBuffer.write(AbstractOutputBuffer.java:429)
> > at
> >
> org.apache.coyote.http11.AbstractOutputBuffer.sendHeader(AbstractOutputBuffer.java:395)
> > at
> >
> org.apache.coyote.http11.AbstractHttp11Processor.prepareResponse(AbstractHttp11Processor.java:965)
> > at
> >
> org.apache.coyote.http11.AbstractHttp11Processor.action(AbstractHttp11Processor.java:739)
> > at org.apache.coyote.Response.action(Response.java:170)
> > at org.apache.coyote.Response.sendHeaders(Response.java:350)
> > at
> org.apache.catalina.connector.OutputBuffer.doFlush(OutputBuffer.java:315)
> > at
> org.apache.catalina.connector.OutputBuffer.close(OutputBuffer.java:275)
> > at
> org.apache.catalina.connector.Response.finishResponse(Response.java:501)
> > at
> >
> org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:426)
> > at
> >
> org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:317)
> > at
> >
> org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:204)
> > at
> >
> org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:311)
> > at
> >
> java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
> > at
> >
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
> > at java.lang.Thread.run(Thread.java:662)
> > org.apache.coyote.http11.AbstractHttp11Processor endRequest
> > SEVERE: Error finishing response
> > java.lang.ArrayIndexOutOfBoundsException
> > at java.lang.System.arraycopy(Native Method)
> > at
> >
> org.apache.coyote.http11.AbstractOutputBuffer.write(AbstractOutputBuffer.java:491)
> > at
> >
> org.apache.coyote.http11.AbstractOutputBuffer.sendStatus(AbstractOutputBuffer.java:331)
> > at
> >
> org.apache.coyote.http11.AbstractHttp11Processor.prepareResponse(AbstractHttp11Processor.java:952)
> > at
> >
> org.apache.coyote.http11.AbstractHttp11Processor.action(AbstractHttp11Processor.java:739)
> > at org.apache.coyote.Response.action(Response.java:168)
> > at
> >
> org.apache.coyote.http11.AbstractOutputBuffer.endRequest(AbstractOutputBuffer.java:308)
> > at
> >
> org.apache.coyote.http11.InternalOutputBuffer.endRequest(InternalOutputBuffer.java:160)
> > at
> >
> org.apache.coyote.http11.AbstractHttp11Processor.endRequest(AbstractHttp11Processor.java:990)
> > at
> >
> org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:350)
> > at
> >
> org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:204)
> > at
> >
> org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:311)
> > at
> >
> java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
> > at
> >
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
> > at java.lang.Thread.run(Thread.java:662)
> > org.apache.catalina.connector.CoyoteAdapter service
> > SEVERE: An exception or error occurred in the container during the
> request
> > processing
> > java.lang.ArrayIndexOutOfBoundsException
> > org.apache.coyote.http11.AbstractHttp11Processor endRequest
> > SEVERE: Error finishing response
> > java.lang.ArrayIndexOutOfBoundsException
> > at java.lang.System.arraycopy(Native Method)
> > at
> >
> org.apache.coyote.http11.AbstractOutputBuffer.write(AbstractOutputBuffer.java:491)
> > at
> >
> org.apache.coyote.http11.AbstractOutputBuffer.sendStatus(AbstractOutputBuffer.java:331)
> > at
> >
> org.apache.coyote.http11.AbstractHttp11Processor.prepareResponse(AbstractHttp11Processor.java:952)
> > at
> >
> org.apache.coyote.http11.AbstractHttp11Processor.action(AbstractHttp11Processor.java:739)
> > at org.apache.coyote.Response.action(Response.java:168)
> > at
> >
> org.apache.coyote.http11.AbstractOutputBuffer.endRequest(AbstractOutputBuffer.java:308)
> > at
> >
> org.apache.coyote.http11.InternalOutputBuffer.endRequest(InternalOutputBuffer.java:160)
> > at
> >
> org.apache.coyote.http11.AbstractHttp11Processor.endRequest(AbstractHttp11Processor.java:990)
> > at
> >
> org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:350)
> > at
> >
> org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:204)
> > at
> >
> org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:182)
> > at
> >
> org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:311)
> > at
> >
> java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
> > at
> >
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
> > at java.lang.Thread.run(Thread.java:662)
> >
> > i am using Tomcat 7, Struts2.2.3.1, JDK 1.6 and STS IDE
> >
> >
> > Thanks & Regards,
> > Debraj Mallick
>
> It would be helpful to see your configuration (i.e. server.xml)?
>
> Dan
>
>
>


-- 
Thanks & Regards,
Debraj Mallick
9674247281

Re: Tomcat 7 + exception while adding cookies

Posted by Daniel Mikusa <dm...@vmware.com>.
On Wed, 2011-11-30 at 08:31 -0800, Debraj Mallick wrote:
> hi all,
> 
> i am getting exception while adding cookies in response
> 
> *Stack trace*:
> org.apache.catalina.connector.CoyoteAdapter service
> SEVERE: An exception or error occurred in the container during the request
> processing
> java.lang.ArrayIndexOutOfBoundsException: 8192
> at
> org.apache.coyote.http11.AbstractOutputBuffer.write(AbstractOutputBuffer.java:522)
> at
> org.apache.coyote.http11.AbstractOutputBuffer.write(AbstractOutputBuffer.java:429)
> at
> org.apache.coyote.http11.AbstractOutputBuffer.sendHeader(AbstractOutputBuffer.java:395)
> at
> org.apache.coyote.http11.AbstractHttp11Processor.prepareResponse(AbstractHttp11Processor.java:965)
> at
> org.apache.coyote.http11.AbstractHttp11Processor.action(AbstractHttp11Processor.java:739)
> at org.apache.coyote.Response.action(Response.java:170)
> at org.apache.coyote.Response.sendHeaders(Response.java:350)
> at org.apache.catalina.connector.OutputBuffer.doFlush(OutputBuffer.java:315)
> at org.apache.catalina.connector.OutputBuffer.close(OutputBuffer.java:275)
> at org.apache.catalina.connector.Response.finishResponse(Response.java:501)
> at
> org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:426)
> at
> org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:317)
> at
> org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:204)
> at
> org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:311)
> at
> java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
> at
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
> at java.lang.Thread.run(Thread.java:662)
> org.apache.coyote.http11.AbstractHttp11Processor endRequest
> SEVERE: Error finishing response
> java.lang.ArrayIndexOutOfBoundsException
> at java.lang.System.arraycopy(Native Method)
> at
> org.apache.coyote.http11.AbstractOutputBuffer.write(AbstractOutputBuffer.java:491)
> at
> org.apache.coyote.http11.AbstractOutputBuffer.sendStatus(AbstractOutputBuffer.java:331)
> at
> org.apache.coyote.http11.AbstractHttp11Processor.prepareResponse(AbstractHttp11Processor.java:952)
> at
> org.apache.coyote.http11.AbstractHttp11Processor.action(AbstractHttp11Processor.java:739)
> at org.apache.coyote.Response.action(Response.java:168)
> at
> org.apache.coyote.http11.AbstractOutputBuffer.endRequest(AbstractOutputBuffer.java:308)
> at
> org.apache.coyote.http11.InternalOutputBuffer.endRequest(InternalOutputBuffer.java:160)
> at
> org.apache.coyote.http11.AbstractHttp11Processor.endRequest(AbstractHttp11Processor.java:990)
> at
> org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:350)
> at
> org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:204)
> at
> org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:311)
> at
> java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
> at
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
> at java.lang.Thread.run(Thread.java:662)
> org.apache.catalina.connector.CoyoteAdapter service
> SEVERE: An exception or error occurred in the container during the request
> processing
> java.lang.ArrayIndexOutOfBoundsException
> org.apache.coyote.http11.AbstractHttp11Processor endRequest
> SEVERE: Error finishing response
> java.lang.ArrayIndexOutOfBoundsException
> at java.lang.System.arraycopy(Native Method)
> at
> org.apache.coyote.http11.AbstractOutputBuffer.write(AbstractOutputBuffer.java:491)
> at
> org.apache.coyote.http11.AbstractOutputBuffer.sendStatus(AbstractOutputBuffer.java:331)
> at
> org.apache.coyote.http11.AbstractHttp11Processor.prepareResponse(AbstractHttp11Processor.java:952)
> at
> org.apache.coyote.http11.AbstractHttp11Processor.action(AbstractHttp11Processor.java:739)
> at org.apache.coyote.Response.action(Response.java:168)
> at
> org.apache.coyote.http11.AbstractOutputBuffer.endRequest(AbstractOutputBuffer.java:308)
> at
> org.apache.coyote.http11.InternalOutputBuffer.endRequest(InternalOutputBuffer.java:160)
> at
> org.apache.coyote.http11.AbstractHttp11Processor.endRequest(AbstractHttp11Processor.java:990)
> at
> org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:350)
> at
> org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:204)
> at
> org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:182)
> at
> org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:311)
> at
> java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
> at
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
> at java.lang.Thread.run(Thread.java:662)
> 
> i am using Tomcat 7, Struts2.2.3.1, JDK 1.6 and STS IDE
> 
> 
> Thanks & Regards,
> Debraj Mallick

It would be helpful to see your configuration (i.e. server.xml)? 

Dan