Re: DefaultServlet subclass behavior change TC6 to 8

2018-04-26 Thread Daryl Stultz

> If you look at doGet() and follow the code you should be able to figure

out what you need to change to get things working in 8.5.x.

Thanks Mark, that did the trick, serveResource calls getRelativePath(request, 
true) now where we were overriding getRelativePath(request)

Chris, the Filter idea definitely looks like a better design, I'll keep that in 
mind if we rework the feature. Thanks.

/Daryl


DefaultServlet subclass behavior change TC6 to 8

2018-04-25 Thread Daryl Stultz
Hello,


We are upgrading from Tomcat 6 to Tomcat 8.5. We have a servlet that extends 
org.apache.catalina.servlets.DefaultServlet. We override 
getRelativePath(HttpServletRequest request), that's all.


The purpose of this servlet is to do a sort of redirect, the browser asks for a 
spreadsheet "my-site.css" which is mapped to our servlet. In getRelativePath we 
return "my-site-prod.css" or "my-site-test.css" for example depending on the 
environment the application is running in.


If I override doGet (calling super) I can see that doGet is called but 
getRelativePath is never called and the browser gets a 404 error for 
"my-site.css".


Anyone know what I need to change to restore the behavior as it was in Tomcat 
6? I'm afraid I inherited this code so it's hard to say why it was done this 
way.


Thanks.


--

Daryl Stultz
Principal Software Developer
_
OpenTempo, Inc
http://www.opentempo.com<http://www.opentempo.com/>
mailto:daryl.stu...@opentempo.com<mailto:daryl.stu...@opentempo.com>



Re: Proper hot deploy technique

2018-04-18 Thread Daryl Stultz


I can't repeat this problem. If you can find a way to recreate it with a
clean Tomcat install, I'd be happy to look at it further.

Thanks for looking at it, Mark. The auto deploy technique seems to be working. 
We've burned a lot of time on this upgrade so I don't see us trying to solve 
the original technique.




--

Daryl Stultz
Principal Software Developer
_
OpenTempo, Inc
http://www.opentempo.com<http://www.opentempo.com/>
mailto:daryl.stu...@opentempo.com<mailto:daryl.stu...@opentempo.com>



Proper hot deploy technique

2018-04-17 Thread Daryl Stultz
Hello,


We have a dev environment where we regularly deploy and undeploy applications 
while Tomcat is running. We are on Tomcat 8.5. We stage the application in a 
temporary directory, we are not using war files. We then deploy with a call to 
the manager app like this:


http://tomcat:PASSWORD@localhost:8080/manager/text/deploy?path=/myapp=file:/temp/myapp


Somehow Tomcat is failing to take in all the files. The set of files do not 
appear to be related but the all-important classes and web.xml files are 
missing, so the application does not start.


We've decided to change our process a bit by turning on auto deploy and moving 
the temporary directory into the webapps directory. That seems to be working 
but I'm wondering if anyone has seen this problem and what we might be doing 
wrong.


Thanks.


--

Daryl Stultz
Principal Software Developer
_
OpenTempo, Inc
http://www.opentempo.com<http://www.opentempo.com/>
mailto:daryl.stu...@opentempo.com<mailto:daryl.stu...@opentempo.com>



Re: Manager app text mode refuses to deploy

2018-04-06 Thread Daryl Stultz


> As per the docs[1], this only works for a previously-deployed
> application. Deploying a new application requires additional parameters.

It's not super clear in the docs, the section "Deploy a previously deployed 
webapp" is the first item under the header "Deploy A New Application from a 
Local Path". We weren't doing anything different from Tomcat 6 so it seems a 
fair misunderstanding.

> I think you actually want this:
> https://tomcat.apache.org/tomcat-8.5-doc/manager-howto.html#Deploy_a_Directory_or_War_from_the_Host_appBase

> No slashes necessary.

Yes, that's true, we are now staging to an intermediate directory and it seems 
to be happier now. The slash was a misdirection, we had to double quote the 
full URL, I think wget was mangling it.


> Tomcat crashes?

> Did you make this request once or twice?

I don't know, things might have been in a bad state prior to the undeploy 
attempt.

> Same application path? You've been using /my-app above, but probably in
> an attempt to anonymize your application. Always helps to double-check
> the speling.

Yeah, my-app was a cover for the real name das-qa-java8.


>Seems like it can't find the application.

> I'm guessing something else is going wrong,

Probably true. After working out the correct manager app calls, cleaning out 
deploys and the work directory everything seems to be working now. We'll see 
how stable it is.

Thanks for your help.

/Daryl


Manager app text mode refuses to deploy

2018-04-05 Thread Daryl Stultz
ng.Thread.run<http://java.lang.thread.run/>(Thread.java:748)

Apache Tomcat 8 (8.5.29) - Manager App 
HOW-TO<https://tomcat.apache.org/tomcat-8.5-doc/manager-howto.html#Deploy_a_Directory_or_WAR_by_URL>
tomcat.apache.org
If you have Tomcat configured to support multiple virtual hosts (websites) you 
would need to configure a Manager for each. There are three ways to use the 
Manager web application.





--

Daryl Stultz
Principal Software Developer
_
OpenTempo, Inc
http://www.opentempo.com<http://www.opentempo.com/>
mailto:daryl.stu...@opentempo.com<mailto:daryl.stu...@opentempo.com>



Re: Apache Tomcat 503 errors

2009-05-01 Thread Daryl Stultz
On Tue, Apr 21, 2009 at 6:49 PM, Christopher Schultz 
ch...@christopherschultz.net wrote:

 
  Is there a preferred alternative to connecting Apache and Tomcat? Or is
  mod_proxy the best?

 mod_proxy_ajp is included in httpd, and there have been /lots/ of
 improvements since 2.2.2. Since you can't upgrade, would you consider
 switching to using mod_jk, which is available 
 independently?users-h...@tomcat.apache.org


I switched to mod_jk-1.2.23 and I am pleased to say the 503 errors have gone
away! Thanks for the suggestion.

-- 
Daryl Stultz
_
6 Degrees Software and Consulting, Inc.
http://www.6degrees.com
mailto:da...@6degrees.com


Re: Apache Tomcat 503 errors

2009-04-22 Thread Daryl Stultz
On Tue, Apr 21, 2009 at 6:49 PM, Christopher Schultz 
ch...@christopherschultz.net wrote:

 -BEGIN PGP SIGNED MESSAGE-

 mod_proxy_ajp is included in httpd, and there have been /lots/ of
 improvements since 2.2.2. Since you can't upgrade, would you consider
 switching to using mod_jk, which is available independently? The
 configuration is a bit more involved, but you may get better results.


Thanks Chris, I'll look into it.

-- 
Daryl Stultz
_
6 Degrees Software and Consulting, Inc.
http://www.6degrees.com
mailto:da...@6degrees.com


Apache Tomcat 503 errors

2009-04-21 Thread Daryl Stultz
Hello,

I posted this on the Apache list a while back and didn't get any response.

I'm running Fedora Core 5, httpd-2.2.2-1.2 (worker MPM), Tomcat 5.5.17, Java
jdk1.5.0_07. I have about 40 connections/apps from Apache to Tomcat like so:

ProxyPass /foo ajp://localhost:8009/foo/

I am getting a fair amount of 503 errors. Logs look like this:

Tomcat catalina.out
Mar 29, 2009 1:35:23 PM org.apache.jk.core.MsgContext action
WARNING: Error sending end packet
java.net.SocketException: Broken pipe

Apache ssl_access
xxx.xxx.xxx.102 - - [29/Mar/2009:13:35:18 -0400] POST /foo/bar HTTP/1.1
503 40920

Apache ssl_error
[Sun Mar 29 13:35:22 2009] [error] [client xxx.xxx.xxx.102] proxy: error
processing body, referer: https://foo.bar.com/foo/bar
[Sun Mar 29 13:35:22 2009] [error] proxy: got bad response (5) from
127.0.0.1:8009 (localhost)

The times are not exact matches but the pattern is consistent. I don't know
if this is a Tomcat problem or Apache/mod_proxy. Many requests are GET - not
all POST. The client hasn't complained about specifically seeing the 503
error, it could be hidden or messing things up in some other way (like my
AJAX backend).

Can anyone give me some guidance here? Googling the log entries does't
amount to much. The feedback on java.net.SocketException: Broken pipe
seems to be that it's harmless, but it does coincide with Apache errors and
ultimately 503, so I don't think it's a simple case of the user hitting the
stop button.

Is there a preferred alternative to connecting Apache and Tomcat? Or is
mod_proxy the best?

Thanks for the help.

P.S. I know the system is old, and you might be inclined to tell me to
upgrade but I don't have that option at the moment. Any ideas on what to
explore would be helpful.

-- 
Daryl Stultz
_
6 Degrees Software and Consulting, Inc.
http://www.6degrees.com
mailto:da...@6degrees.com


Re: Apache - Tomcat connection problem

2009-02-26 Thread Daryl Stultz
On Tue, Feb 24, 2009 at 7:40 PM, Rainer Jung rainer.j...@kippdata.dewrote:


 smaxEither 0 or 1. I would say 0 in order to get rid of idle
 connections.


This is ignored for 2.2.2 (see
https://issues.apache.org/bugzilla/show_bug.cgi?id=43371).


 connectiontimeout E.g. 5 or 10


This produces an error: ProxyPass unknown Worker parameter.

Unfortunately, I'm not in a position to upgrade httpd as you recommend.
Should I try the worker MPM? I found this which suggests a bug has been
fixed for worker MPM:

https://issues.apache.org/bugzilla/show_bug.cgi?id=38227#c9

This is a link right to James Robinson's description of his problem which
seems pretty consistent with mine. Odd, though, the original poster switched
from worker to prefork as a workaround and I'm considering the opposite, so
probably not the solution for me. Comments?

This is starting to look more like an Apache issue, maybe I should move to
that list...

-- 
Daryl Stultz
_
6 Degrees Software and Consulting, Inc.
http://www.6degrees.com
mailto:da...@6degrees.com


Re: Apache - Tomcat connection problem

2009-02-26 Thread Daryl Stultz
It appears my last post didn't make it through some virus scanner (Antigen
for Exchange found Body of Message infected with Exceeded Realtime Timeout
virus.) Apologies if it made it to the list.


On Tue, Feb 24, 2009 at 7:40 PM, Rainer Jung rainer.j...@kippdata.dewrote:


 smaxEither 0 or 1. I would say 0 in order to get rid of idle
 connections.


This is ignored for 2.2.2 (see
https://issues.apache.org/bugzilla/show_bug.cgi?id=43371).


 connectiontimeout E.g. 5 or 10


This produces an error: ProxyPass unknown Worker parameter.

Unfortunately, I'm not in a position to upgrade httpd as you recommend.
Should I try the worker MPM? I found this which suggests a bug has been
fixed for worker MPM:

https://issues.apache.org/bugzilla/show_bug.cgi?id=38227#c9

This is a link right to James Robinson's description of his problem which
seems pretty consistent with mine. Odd, though, the original poster switched
from worker to prefork as a workaround and I'm considering the opposite, so
probably not the solution for me. Comments?

This is starting to look more like an Apache issue, maybe I should move to
that list...


-- 
Daryl Stultz
_
6 Degrees Software and Consulting, Inc.
http://www.6degrees.com
mailto:da...@6degrees.com


Apache - Tomcat connection problem

2009-02-24 Thread Daryl Stultz
Hello,

I don't know if this is an Apache problem, Tomcat problem, both or neither.
Hopefully someone can point me in the right direction.

I'm running Tomcat 5.5.17 behind Apache 2.2.2. I am connecting with a Tomcat
AJP connector like so:

 Connector port=8009 enableLookups=false redirectPort=8443
protocol=AJP/1.3 /

and Apache ProxyPass like so:

ProxyPass /myapp ajp://localhost:8009/myapp/

Apache has the default number of connections set - MaxClients is either 256
or 150, I don't understand the prefork/worker MPM thing. As above, the
Tomcat AJP connector defaults to 200 for maxThreads. The site has 20
applications, each with 2 ProxyPass directives for ports 80 and 443. The
general load on the site is low with 5 - 15 users on at any one time.

This command here, I believe, counts the number of connections between
Apache and Tomcat:

netstat -tn | sed -n -e '1,2p;/8009/p' | wc -l

The site has been running for a couple years, though the code changes and I
continue to add new apps, it has been running fine. Now what seems to be
happening is the number of connections between Apache and Tomcat grows at
various rates from 4 or 10 or 20 after an Apache restart to 400 and more. At
around 400 the site gets very sluggish. This seems to make some sense if
Tomcat has maxThreads of 200 and the above command counts connections in
both directions - TC is running out of connections. The question is why? I
don't have enough users to warrant the connection pool growing like this. I
currently have a cron task that does a graceful restart of Apache after 300
connections. Can anyone shed some light on this or point me to some other
resource for help?

Thanks.

-- 
Daryl Stultz
_
6 Degrees Software and Consulting, Inc.
http://www.6degrees.com
mailto:da...@6degrees.com


Re: Apache - Tomcat connection problem

2009-02-24 Thread Daryl Stultz
On Tue, Feb 24, 2009 at 4:56 PM, Rainer Jung rainer.j...@kippdata.dewrote:

 You need to understand it.
 ...
 You can check your MPM by calling httpd -V. The output will contain a
 line like

  -D APACHE_MPM_DIR=server/mpm/worker


Server version: Apache/2.2.2
Server built:   Jul 26 2006 11:12:08
Server's Module Magic Number: 20051115:2
Server loaded:  APR 1.2.2, APR-Util 1.2.7
Compiled using: APR 1.2.2, APR-Util 1.2.7
Architecture:   32-bit
Server MPM: Prefork
  threaded: no
forked: yes (variable process count)
Server compiled with
 -D APACHE_MPM_DIR=server/mpm/prefork



  Tomcat AJP connector defaults to 200 for maxThreads. The site has 20


 Defaults? I think no, and you haven't configured 200 in your abive config
 snippet.


See Christopher's response. Do you know of the implementation being
different than the docs?



  applications, each with 2 ProxyPass directives for ports 80 and 443. The


 Hmm, not sure, how ports 80 and 443 with HTTP(s) proxying come into play
 now.


Me neither, just trying to provide useful setup information. I have a total
of about 40 ProxyPass (mod_proxy_ajp) directives. I don't have any idea how
that impacts things.


 What's you platform?


Fedora Core release 5 (Bordeaux)



 The command counts LISTEN (the listening socket), the 2 header lines, all
 ESTABLISHED connections (those are the ones you are after) and e.g. also
 TIME_WAIT connections, all of them together. You need to count more
 specific.


Yes, I mentally accounted for the header lines. Leaving off the wc -l, I
have never seen anything but ESTABLISHED. I'll keep an eye on it.


 Consider upgrading httpd to 2.2.11, because mod_proxy_ajp was very new in
 2.2.2 and there have been a couple of fixes after that version.


I'll look into that.


 First check, whether it is really ESTABISHED connections. Then configure
 reasonable timeouts as described in the mod_proxy documentation and an
 additional connectionTimeout for Tomcat.


This is the part where expert advice comes in. I don't have any idea what
reasonable timeouts are and the docs don't give a decent way to calculate
it.

Thanks.

-- 
Daryl Stultz
_
6 Degrees Software and Consulting, Inc.
http://www.6degrees.com
mailto:da...@6degrees.com