Re: Populating init parameters

2016-12-14 Thread Mark Thomas
On 14/12/2016 03:13, John D. Ament wrote:
> Hi,
> 
> I'm using Tomcat embedded to start a container.  I need to set some
> initParameters in that embedded runtime.  However, when I try to set the
> parameters I get the follow:
> 
> java.lang.IllegalStateException: Initialization parameters cannot be set
> after the context has been initialized
> 
> at
> org.apache.catalina.core.ApplicationContext.setInitParameter(ApplicationContext.java:1003)
> at
> org.apache.catalina.core.ApplicationContextFacade.setInitParameter(ApplicationContextFacade.java:624)
> 
> I'm using the following to set the init parameter:
> 
> Context ctx = tomcat.addContext("",base.getAbsolutePath());
> ServletContext servletContext = ctx.getServletContext();
> servletContext.setInitParameter("key","value");
> 
> When i look, the tomcat instance is in the new state.  So it hasn't been
> initialized yet.  I was wondering if this was an error?  I'm using Tomcat
> 8.5.9.

The error message might need a tweak for the embedded case but it is
telling you the ServletContext is in the wrong state for editing the
parameters.

You want to add addParameter() on the Context object.

Mark


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



Re: Issue with tomcat 8.0.39 and Jasper reports

2016-12-14 Thread RAVIRAJ SHAH
   1. Request Method:
  POST
  2. Status Code:
  200 OK
  3.
  1. Response Headersview source
  1. Cache-Control:
  no-cache, no-store, max-age=0, must-revalidate
  2. Content-Language:
  en
  3. Content-Transfer-Encoding:
  binary
  4. Content-Type:
  application/pdf;charset=ISO-8859-1
  5. Date:
  Wed, 14 Dec 2016 10:00:40 GMT
  6. Expires:
  0
  7. Pragma:
  no-cache
  8. Server:
  9. Set-Cookie:
  serverTime=1481709636121; Expires=Wed, 14-Dec-2016 10:00:52 GMT;
  Path=/
  10. Set-Cookie:
  downloadStop=stop; Expires=Wed, 14-Dec-2016 10:00:43 GMT; Path=/
  11. Strict-Transport-Security:
  max-age=31536000 ; includeSubDomains
  12. Transfer-Encoding:
  chunked
  13. X-Content-Type-Options:
  nosniff
  14. X-Frame-Options:
  DENY
  15. X-XSS-Protection:
  1; mode=block
  2. Request Headersview source
  1. Accept:

  text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8
  2. Accept-Encoding:
  gzip, deflate, br
  3. Accept-Language:
  en-US,en;q=0.8
  4. Cache-Control:
  max-age=0
  5. Connection:
  keep-alive
  6. Content-Length:
  79
  7. Content-Type:
  application/x-www-form-urlencoded
  8. Cookie:
  SESSIONTIME=D2EEFC60F45BD577E2CCD97CE71EA4D8
  9. Host:
  www.thevgr.com
  10. Upgrade-Insecure-Requests:
  1
  11. User-Agent:
  Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko)
  Chrome/54.0.2840.99 Safari/537.36
  3. Form Dataview sourceview URL encoded
  1. action:
  openVGR
  2. _csrf:
  a7b0617b-9207-4696-aaae-cbd5954d2190


Thanks & Regards,
Raviraj Shah


On 13 December 2016 at 20:28, Christopher Schultz <
ch...@christopherschultz.net> wrote:

> -BEGIN PGP SIGNED MESSAGE-
> Hash: SHA256
>
> Raviraj,
>
> On 12/12/16 11:50 PM, RAVIRAJ SHAH wrote:
> > Do you mean logs at the time of pdf download request
>
> I mean the HTTP protocol trace. Something like this:
>
> Request:
> GET /path/to/pdf/download
> Host: myserver.example.com
> Accept: application/pdf
> Connection: keep-alive
>
>
> Response:
> 200 Ok
> Content-Type: application/pdf
> Content-Length: 234554
>
> [the contents of the file]
>
> > Or anything else like protocol trace method
>
> If you use FireBug, Chrome dev tools, etc. then copy/paste will be
> fine too.
>
> > Can you sharechow to have tht
>
> I'm not sure what you mean, here.
>
> - -chris
>
> > On Tue, Dec 13, 2016, 03:34 Christopher Schultz <
> > ch...@christopherschultz.net> wrote:
> >
> > Raviraj,
> >
> > On 12/10/16 12:21 AM, RAVIRAJ SHAH wrote:
>  We develop jrxml file using jasper Studio  and then use java
>  code to display that jrxml file which opens in new browser
>  tab and by right  click on that file we are able to download
>  this as pdf file in tomacat 8.0.14 but  some how in Tomcat
>  8.0.39 the same code doesn't  works,  it does  not allows
>  files to download as pdf from browser.  Instead it shows pdf
>  file type as all files and on downloading it shows failed
>  network error.
> >
> > Please take a protocol-trace of the HTTP response when you request
> > the PDF and post it here.
> >
> > -chris
> >
>  On Fri, Dec 9, 2016, 23:23 Christopher Schultz
>   wrote:
> 
>  Raviraj,
> 
>  On 12/9/16 11:24 AM, RAVIRAJ SHAH wrote:
> >>> I am using jasper reports the library using jasper
> >>> report development studio
> 
>  No, you're not. The development studio is a GUI for building
>  reports.
> 
>  - From the Tomcat perspective, you are just using
>  JasperReports library.
> 
> >>> I mean to say i can see pdf file on browser but when i
> >>> try to save that pdf
> 
>  So the PDF displays correctly in the browser? That sounds
>  like it's working as expected.
> 
> >>> i dont see file type as adobe acrobat file and saving
> >>> pdf giving error
> 
>  What does the "file type" show up as instead of PDF?
> 
>  When you "save" (how?) what error do you get?
> 
> >>> I am generating pdf file on runtime i am not storing
> >>> file physically
> 
>  So are you streaming the file back to the client? That's not
>  a feature of JasperReports, so you must have written a
>  servlet wrapper that does this for you. What does the code
>  look like?
> 
> >>> One more thing same functionality working very fine
> >>> with tomcat 8.0.14
> 
>  Understood. I suspect the problem is with your code; the
>  Tomcat upgrade has merely revealed the problem.
> 
>  -chris
> >
> > --
> - ---
> >
> >
> >
> >
> To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
> > For additional commands, e-mail:
> > users-h...@

ExtendedAccessLogValve.class overloaded timezone and set it to GMT

2016-12-14 Thread Farhan Tariq
Hello team,

I am not sure why the timezone is explicitly set to GMT in
ExtendedAccessLogValve class?
To capture URL encoded parameters I looking to use this class but need help
to get time in GMT+5. I am using tomcat 7 on redhat.
Any suggestions?

Thanks
Farhan


Re: [OT] Tomcat listener not coming up - no stuck threads

2016-12-14 Thread Christopher Schultz
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA256

Mark,

On 12/8/16 4:19 AM, Mark Thomas wrote:
> On 07/12/2016 15:21, Christopher Schultz wrote:
>> 
>> Hmm... there is the "startStopThreads" setting on the Engine,
>> but unfortunately there is not (currently available) setting that
>> says "don't use multiple threads at all". It looks like Tomcat is
>> always going to use at least one (separate) thread to launch the
>> various Hosts (and webapps).
> 
> It wouldn't be too hard to change that to not use an executor if
> the default of startStopThreads="1" was being used.

+1 to running start on the main thread if startStopThreads="1".

Where would I look to start working on a proposed patch? The Tomcat
Lifecycle isn't my strong suit.

> However...

Even if this doesn't solve John's problem, I think it's worth doing.

Comments?

- -chris
-BEGIN PGP SIGNATURE-
Comment: GPGTools - http://gpgtools.org
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iQIcBAEBCAAGBQJYUXIcAAoJEBzwKT+lPKRYuWsQAMhrAt3mFLGio4u16ZABWLyG
vPwlNRH24l9AnXu2yJ2FALS0ydIB8RTKW7BlwsdrlVAINQ8I0tWXFY4cn7jnMox3
GLyg0ABmSIYqO/Qxqd4YIILBWWycNmvWn8BBgfLvqJaVDO/VB8vrsGClBnVbuqh8
UetcFoCuIjXWpSQFBI7NhPouE4C145eMrmSmbz0Go7jtBPEfib5dgF26QepfX56M
+ds8CDJc9OLusGSCvNgzYu7HXo3fBAFr52LoykQn6IqJbfv0PduiX8ySbLceBXpa
VGlD9Fb9P/08wgANgBs7cbgkmxaEU/PnpXB/B5Mx8QbBV08Ajch3Rxedc2ikqMgi
GP0n8xYzk0GaeEl8VSEwIQCbkib8kz4cR8s+nsiDwcq1WkFrIUqqr0UapN3dyRAS
ySlfFyYN+Wbhe37lRjjQrMDsVcS8mX7t9ELKYRQ3difkmKeeme6D60tyNX/gEUPp
NqHFeOknpgNw/Orj3KM6v1b9BAeRstFelx+kAffrc0G9Gz9GG8+BY7ThBvdfrSZO
wp/ufXhmyVta57qVmmpwR7ua3b5npbCvgkIos6GTu2dKRMqRj2pBPBA3f9HyT82S
1IsYM72RhCTimrmskIb2/G6okRNa1aft5f3iypwsG6J1+ZLxgYROZVWfTbdA9WRS
2/n3/Gtg2yi9GhED0luy
=FbNM
-END PGP SIGNATURE-

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



Re: ExtendedAccessLogValve.class overloaded timezone and set it to GMT

2016-12-14 Thread tomcat

On 14.12.2016 16:48, Farhan Tariq wrote:

Hello team,

I am not sure why the timezone is explicitly set to GMT in
ExtendedAccessLogValve class?
To capture URL encoded parameters I looking to use this class but need help
to get time in GMT+5. I am using tomcat 7 on redhat.
Any suggestions?



Hi.
This is not a Tomcat answer, it is a more general answer.
I don't know if the Tomcat AccessLogValve allows to change the timestamp to anything else 
than GMT + 0.


But even if it did, in my opinion it would be a bad idea to use that.
The reason is that you may one day have several systems to monitor, and they may not all 
be in the same timezone. So how would you compare this data between different systems ?


It would be much better to pick up that timestamp as it is, knowing that it is GMT + 0, 
and then *in your application* make the adjustment, in function of a parameter *of your 
application*.
There are probably a multitude of existing Java libraries which facilitate this kind of 
calculation.




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



Chrome 55 - ERR_SPDY_COMPRESSION_ERROR

2016-12-14 Thread Durga Srinivasu Karuturi
Hi,

Recent chrome  [Mac - Sierra : Version  55.0.2883.87 (64-bit) ] we are
seeing issues in http2 sites.


Initially we have seen problem with http2 table header size limit
error and to fix this, we have upgraded tomcat 8.5.4 to 8.5.9 where
tomcat has increased the header limit from 16K to 64K.


Now with latest tomcat 8.5.9 we are seeing  ERR_SPDY_COMPRESSION_ERROR
while loading dojo libraries.

Tried couple of steps (flush SPDY sokets etc) based on google search
on this issue but nothing worked..


[image: Inline image 1]

t=10513 [st= 1] -HTTP_TRANSACTION_SEND_REQUEST

t=10513 [st= 1] +HTTP_TRANSACTION_READ_HEADERS  [dt=36]

t=10549 [st=37]HTTP2_STREAM_ERROR

   --> description = "ABANDONED (stream_id=139):
https://10.104.118.174/webacs/lib/dijit/form/_ToggleButtonMixin.js.map";

   --> status = -363

   --> stream_id = 139

t=10549 [st=37] -HTTP_TRANSACTION_READ_HEADERS

* --> net_error = -363 (ERR_SPDY_COMPRESSION_ERROR)*

t=10549 [st=37]   -URL_REQUEST_START_JOB

*   --> net_error = -363 (ERR_SPDY_COMPRESSION_ERROR)*

t=10549 [st=37]URL_REQUEST_DELEGATE  [dt=0]

t=10549 [st=37] -REQUEST_ALIVE

 --> net_error = -363 (ERR_SPDY_COMPRESSION_ERROR)


Initial content is downloaded (other JS files etc) but on some dojo
libraries alone, we are this issue which make application home page
load fails.


Firefox works!


We are having latest tomcat 8.5.9 already. Not sure where else problem
now. We have not enabled any compression server side.


https://bugs.chromium.org/p/chromium/issues/detail?id=673315 (Chrome
bugs i have raised)

My guess is that the bug is in Tomcat, in that it does not send an
HPACK dynamic table size update (so the dynamic table should be the
default 4 kB) but uses a 64 kB dynamic table.
As soon as it references entries that are in fact already emitted,
that's a compression error.
See https://www.ietf.org/mail-archive/web/httpbisa/current/msg27867.html
for a discussion on how to interpret the specs.

According to the chrome bug notes problem is with tome dynamic table
size 64k. I don't know how to confirm this is as tomcat issue as well.

Can somebody help here to trace the problem?


Re: [OT] Tomcat listener not coming up - no stuck threads

2016-12-14 Thread John D. Ament
On Wed, Dec 14, 2016 at 11:23 AM Christopher Schultz <
ch...@christopherschultz.net> wrote:

> -BEGIN PGP SIGNED MESSAGE-
> Hash: SHA256
>
> Mark,
>
> On 12/8/16 4:19 AM, Mark Thomas wrote:
> > On 07/12/2016 15:21, Christopher Schultz wrote:
> >>
> >> Hmm... there is the "startStopThreads" setting on the Engine,
> >> but unfortunately there is not (currently available) setting that
> >> says "don't use multiple threads at all". It looks like Tomcat is
> >> always going to use at least one (separate) thread to launch the
> >> various Hosts (and webapps).
> >
> > It wouldn't be too hard to change that to not use an executor if
> > the default of startStopThreads="1" was being used.
>
> +1 to running start on the main thread if startStopThreads="1".
>
> Where would I look to start working on a proposed patch? The Tomcat
> Lifecycle isn't my strong suit.
>
> > However...
>
> Even if this doesn't solve John's problem, I think it's worth doing.
>

Having an option to startStop on the main thread would fix my issue.
However would that be when startStopThreads = 1 or some other parameter (to
not break compatibility) ?

John


>
> Comments?
>
> - -chris
> -BEGIN PGP SIGNATURE-
> Comment: GPGTools - http://gpgtools.org
> Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/
>
> iQIcBAEBCAAGBQJYUXIcAAoJEBzwKT+lPKRYuWsQAMhrAt3mFLGio4u16ZABWLyG
> vPwlNRH24l9AnXu2yJ2FALS0ydIB8RTKW7BlwsdrlVAINQ8I0tWXFY4cn7jnMox3
> GLyg0ABmSIYqO/Qxqd4YIILBWWycNmvWn8BBgfLvqJaVDO/VB8vrsGClBnVbuqh8
> UetcFoCuIjXWpSQFBI7NhPouE4C145eMrmSmbz0Go7jtBPEfib5dgF26QepfX56M
> +ds8CDJc9OLusGSCvNgzYu7HXo3fBAFr52LoykQn6IqJbfv0PduiX8ySbLceBXpa
> VGlD9Fb9P/08wgANgBs7cbgkmxaEU/PnpXB/B5Mx8QbBV08Ajch3Rxedc2ikqMgi
> GP0n8xYzk0GaeEl8VSEwIQCbkib8kz4cR8s+nsiDwcq1WkFrIUqqr0UapN3dyRAS
> ySlfFyYN+Wbhe37lRjjQrMDsVcS8mX7t9ELKYRQ3difkmKeeme6D60tyNX/gEUPp
> NqHFeOknpgNw/Orj3KM6v1b9BAeRstFelx+kAffrc0G9Gz9GG8+BY7ThBvdfrSZO
> wp/ufXhmyVta57qVmmpwR7ua3b5npbCvgkIos6GTu2dKRMqRj2pBPBA3f9HyT82S
> 1IsYM72RhCTimrmskIb2/G6okRNa1aft5f3iypwsG6J1+ZLxgYROZVWfTbdA9WRS
> 2/n3/Gtg2yi9GhED0luy
> =FbNM
> -END PGP SIGNATURE-
>
> -
> To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
> For additional commands, e-mail: users-h...@tomcat.apache.org
>
>


Re: [OT] Tomcat listener not coming up - no stuck threads

2016-12-14 Thread Mark Thomas
On 14/12/2016 16:23, Christopher Schultz wrote:
> Mark,
> 
> On 12/8/16 4:19 AM, Mark Thomas wrote:
>> On 07/12/2016 15:21, Christopher Schultz wrote:
>>>
>>> Hmm... there is the "startStopThreads" setting on the Engine,
>>> but unfortunately there is not (currently available) setting that
>>> says "don't use multiple threads at all". It looks like Tomcat is
>>> always going to use at least one (separate) thread to launch the
>>> various Hosts (and webapps).
> 
>> It wouldn't be too hard to change that to not use an executor if
>> the default of startStopThreads="1" was being used.
> 
> +1 to running start on the main thread if startStopThreads="1".
> 
> Where would I look to start working on a proposed patch? The Tomcat
> Lifecycle isn't my strong suit.

ContainerBase. Look for uses of startStopThreads.#

>> However...
> 
> Even if this doesn't solve John's problem, I think it's worth doing.
> 
> Comments?

No objections. I'd thought about it previously but it wasn't an itch I
felt the urge to scratch.

Mark

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



Re: ExtendedAccessLogValve.class overloaded timezone and set it to GMT

2016-12-14 Thread Konstantin Kolinko
2016-12-14 18:48 GMT+03:00 Farhan Tariq :
> Hello team,
>
> I am not sure why the timezone is explicitly set to GMT in
> ExtendedAccessLogValve class?
> To capture URL encoded parameters I looking to use this class but need help
> to get time in GMT+5. I am using tomcat 7 on redhat.
> Any suggestions?


1. Please read the mailing list rules:
http://tomcat.apache.org/lists.html#tomcat-users

You have not mentioned what exact version of Tomcat you are using (1.)

2. Use of GMT in ExtendedAccessLogValve is by design.

That valve implements log format specified by "Extended Log File
Format" specification by W3C, and the specification dictates that the
time is in GMT.

http://tomcat.apache.org/tomcat-8.5-doc/config/valve.html#Extended_Access_Log_Valve

https://www.w3.org/TR/WD-logfile.html


It may be good to implement configurable timezone in AccessLogValve
(currently it uses TimeZone.getDefault()), but I think that
ExtendedAccessLogValve shall remain with GMT.

Best regards,
Konstantin Kolinko

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



Re: Issue with tomcat 8.0.39 and Jasper reports

2016-12-14 Thread Christopher Schultz
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA256

Raviraj,

On 12/14/16 5:04 AM, RAVIRAJ SHAH wrote:
> 1. Request Method: POST

This is weird formatting. I'm going to make some guesses and remove
some unnecessary stuff.

> 2. Status Code: 200 OK

> 3. Content-Transfer-Encoding: binary

This isn't necessary, but probably won't hurt.

> 4. Content-Type: application/pdf;charset=ISO-8859-1

application/* content-types aren't supposed to have a charset. Where
is that coming from?

> 12. Transfer-Encoding: chunked

Also, no Content-Length header, so the response is being sent in
pieces. Ok.

> 2. Request Headers view source

Nothing interesting, here.

Okay, was that a failing response or a working response? What do the
response headers look like when the response works -- in the older
version of Tomcat? (or when it doesn't, in the newer version)

You need to help us help you. I usually get paid to provide this level
of interaction...

- -chris

> On 13 December 2016 at 20:28, Christopher Schultz < 
> ch...@christopherschultz.net> wrote:
> 
> Raviraj,
> 
> On 12/12/16 11:50 PM, RAVIRAJ SHAH wrote:
 Do you mean logs at the time of pdf download request
> 
> I mean the HTTP protocol trace. Something like this:
> 
> Request: GET /path/to/pdf/download Host: myserver.example.com 
> Accept: application/pdf Connection: keep-alive
> 
> 
> Response: 200 Ok Content-Type: application/pdf Content-Length:
> 234554
> 
> [the contents of the file]
> 
 Or anything else like protocol trace method
> 
> If you use FireBug, Chrome dev tools, etc. then copy/paste will be 
> fine too.
> 
 Can you sharechow to have tht
> 
> I'm not sure what you mean, here.
> 
> -chris
> 
 On Tue, Dec 13, 2016, 03:34 Christopher Schultz < 
 ch...@christopherschultz.net> wrote:
 
 Raviraj,
 
 On 12/10/16 12:21 AM, RAVIRAJ SHAH wrote:
>>> We develop jrxml file using jasper Studio  and then use
>>> java code to display that jrxml file which opens in new
>>> browser tab and by right  click on that file we are
>>> able to download this as pdf file in tomacat 8.0.14 but
>>> some how in Tomcat 8.0.39 the same code doesn't  works,
>>> it does  not allows files to download as pdf from
>>> browser.  Instead it shows pdf file type as all files
>>> and on downloading it shows failed network error.
 
 Please take a protocol-trace of the HTTP response when you
 request the PDF and post it here.
 
 -chris
 
>>> On Fri, Dec 9, 2016, 23:23 Christopher Schultz 
>>>  wrote:
>>> 
>>> Raviraj,
>>> 
>>> On 12/9/16 11:24 AM, RAVIRAJ SHAH wrote:
>> I am using jasper reports the library using
>> jasper report development studio
>>> 
>>> No, you're not. The development studio is a GUI for
>>> building reports.
>>> 
>>> - From the Tomcat perspective, you are just using 
>>> JasperReports library.
>>> 
>> I mean to say i can see pdf file on browser but
>> when i try to save that pdf
>>> 
>>> So the PDF displays correctly in the browser? That
>>> sounds like it's working as expected.
>>> 
>> i dont see file type as adobe acrobat file and
>> saving pdf giving error
>>> 
>>> What does the "file type" show up as instead of PDF?
>>> 
>>> When you "save" (how?) what error do you get?
>>> 
>> I am generating pdf file on runtime i am not
>> storing file physically
>>> 
>>> So are you streaming the file back to the client?
>>> That's not a feature of JasperReports, so you must have
>>> written a servlet wrapper that does this for you. What
>>> does the code look like?
>>> 
>> One more thing same functionality working very
>> fine with tomcat 8.0.14
>>> 
>>> Understood. I suspect the problem is with your code;
>>> the Tomcat upgrade has merely revealed the problem.
>>> 
>>> -chris
 
 ---
- ---
>
 
- ---
 
 
 
 
> To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
 For additional commands, e-mail: 
 users-h...@tomcat.apache.org
 
 
>>> 
> 
> --
- ---
>
>
>
> 
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
> For additional commands, e-mail:
> users-h...@tomcat.apache.org
> 
> 
 
>> 
>> -
>>
>> 
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
>> For additional commands, e-mail: users-h...@tomcat.apache.org
>> 
>> 
> 
-BEGIN PGP SIGNATURE-
Comment: GPGTools - http://gpgtools.org
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iQIcBAEBCAAGBQJYUfHyAAoJEBzwKT+lPKRYYboQAIDoQvL9x2a1NGXHEK6Dfxz4
gZcNfXB67fveEDxyz7c2CQnUwQ6l215f24

Re: Populating init parameters

2016-12-14 Thread John D. Ament
Mark,

On Wed, Dec 14, 2016 at 3:10 AM Mark Thomas  wrote:

> On 14/12/2016 03:13, John D. Ament wrote:
> > Hi,
> >
> > I'm using Tomcat embedded to start a container.  I need to set some
> > initParameters in that embedded runtime.  However, when I try to set the
> > parameters I get the follow:
> >
> > java.lang.IllegalStateException: Initialization parameters cannot be set
> > after the context has been initialized
> >
> > at
> >
> org.apache.catalina.core.ApplicationContext.setInitParameter(ApplicationContext.java:1003)
> > at
> >
> org.apache.catalina.core.ApplicationContextFacade.setInitParameter(ApplicationContextFacade.java:624)
> >
> > I'm using the following to set the init parameter:
> >
> > Context ctx = tomcat.addContext("",base.getAbsolutePath());
> > ServletContext servletContext = ctx.getServletContext();
> > servletContext.setInitParameter("key","value");
> >
> > When i look, the tomcat instance is in the new state.  So it hasn't been
> > initialized yet.  I was wondering if this was an error?  I'm using Tomcat
> > 8.5.9.
>
> The error message might need a tweak for the embedded case but it is
> telling you the ServletContext is in the wrong state for editing the
> parameters.
>
> You want to add addParameter() on the Context object.
>

That worked.  Thanks.


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


Re: [OT] Tomcat listener not coming up - no stuck threads

2016-12-14 Thread John D. Ament
I was feeling ambitious so I gave this a shot.  Here's what I changed:
https://github.com/johnament/tomcat85/commit/a0281b2d4e0fea7cb0f7a9d3cd1e750b48498ff2
.
I get some failed tests, but generallys eems good (I broke it earlier, and
lots of things failed).

   [concat] Testsuites with failed tests:
   [concat]
TEST-org.apache.catalina.session.TestStandardSessionIntegration.NIO.txt
   [concat]
TEST-org.apache.catalina.session.TestStandardSessionIntegration.NIO2.txt
   [concat]
TEST-org.apache.catalina.startup.TestHostConfigAutomaticDeployment.NIO.txt
   [concat]
TEST-org.apache.catalina.startup.TestHostConfigAutomaticDeployment.NIO2.txt
   [concat]
TEST-org.apache.catalina.tribes.group.TestGroupChannelMemberArrival.NIO.txt
   [concat]
TEST-org.apache.catalina.tribes.group.TestGroupChannelMemberArrival.NIO2.txt
   [concat]
TEST-org.apache.catalina.tribes.group.TestGroupChannelStartStop.NIO.txt
   [concat]
TEST-org.apache.catalina.tribes.group.TestGroupChannelStartStop.NIO2.txt
   [concat]
TEST-org.apache.catalina.tribes.group.interceptors.TestOrderInterceptor.NIO.txt
   [concat]
TEST-org.apache.catalina.tribes.group.interceptors.TestOrderInterceptor.NIO2.txt
   [concat]
TEST-org.apache.catalina.tribes.group.interceptors.TestTcpFailureDetector.NIO.txt
   [concat]
TEST-org.apache.catalina.tribes.group.interceptors.TestTcpFailureDetector.NIO2.txt
   [concat]
TEST-org.apache.tomcat.util.net.openssl.ciphers.TestCipher.NIO.txt
   [concat]
TEST-org.apache.tomcat.util.net.openssl.ciphers.TestCipher.NIO2.txt
   [concat]
TEST-org.apache.tomcat.util.net.openssl.ciphers.TestOpenSSLCipherConfigurationParser.NIO.txt
   [concat]
TEST-org.apache.tomcat.util.net.openssl.ciphers.TestOpenSSLCipherConfigurationParser.NIO2.txt


I'm wondering, can I publish local maven artifacts using the ant build?
Would be good to see if this fixes or changes my behavior.

John

On Wed, Dec 14, 2016 at 12:22 PM Mark Thomas  wrote:

> On 14/12/2016 16:23, Christopher Schultz wrote:
> > Mark,
> >
> > On 12/8/16 4:19 AM, Mark Thomas wrote:
> >> On 07/12/2016 15:21, Christopher Schultz wrote:
> >>>
> >>> Hmm... there is the "startStopThreads" setting on the Engine,
> >>> but unfortunately there is not (currently available) setting that
> >>> says "don't use multiple threads at all". It looks like Tomcat is
> >>> always going to use at least one (separate) thread to launch the
> >>> various Hosts (and webapps).
> >
> >> It wouldn't be too hard to change that to not use an executor if
> >> the default of startStopThreads="1" was being used.
> >
> > +1 to running start on the main thread if startStopThreads="1".
> >
> > Where would I look to start working on a proposed patch? The Tomcat
> > Lifecycle isn't my strong suit.
>
> ContainerBase. Look for uses of startStopThreads.#
>
> >> However...
> >
> > Even if this doesn't solve John's problem, I think it's worth doing.
> >
> > Comments?
>
> No objections. I'd thought about it previously but it wasn't an itch I
> felt the urge to scratch.
>
> Mark
>
> -
> To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
> For additional commands, e-mail: users-h...@tomcat.apache.org
>
>