Cluster JMX objects
Does anyone have any code that shows the use of JMX to monitor the cluster objects in a Tomcat cluster (5.5.17 or later). I am interested in knowing which servers are currently connected, and if any are down. This last I guess is going to have to be done by exclusion as I am not aware of a list of expected servers anywhere. David - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Odd problem with Tomcat 5.5.9 and PhantomReferences
I have a servlet which I am trying to run under Tomcat 5.5.9 which has a background thread in it. This thread uses JDBC, and in particular the Postgresql JDBC driver. This driver uses PhantomReferences in order to tidy up the underlying C objects. But when it comes to use the PhantomReference it gets:- at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1221) at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1181) at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319) at org.postgresql.core.v3.QueryExecutorImpl.registerParsedQuery(QueryExecutorImpl.java:1092) at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:1177) at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:188) at org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:430) at org.postgresql.jdbc2.AbstractJdbc2Statement.executeWithFlags(AbstractJdbc2Statement.java:346) at org.postgresql.jdbc2.AbstractJdbc2Statement.executeQuery(AbstractJdbc2Statement.java:250) The line in registerParsedQuery that is failing is:- PhantomReference cleanupRef = new PhantomReference(query, parsedQueryCleanupQueue); This should work on any JDK since Java 1.2. I am running this with the Sun 1.5 SDK. Is this a sandbox problem? If so what do I need to set in order to allow this to work? Anyone got any idea why this might be failing? David - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Odd problem with Tomcat 5.5.9 and PhantomReferences
On Wednesday 08 March 2006 15:54, Caldarale, Charles R wrote: > > From: David Goodenough [mailto:[EMAIL PROTECTED] > > Subject: Odd problem with Tomcat 5.5.9 and PhantomReferences > > > > But when it comes to use the PhantomReference it gets:- > > > > at > > org.apache.catalina.loader.WebappClassLoader.loadClass(WebappC > > lassLoader.java:1221) > > Seem to have lost a critical piece of information - which exception? > Sorry, what I get is a ThreadDeath. Which I take to mean that the class loader is throwing a fit. David > - Chuck > > > THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY > MATERIAL and is thus for use only by the intended recipient. If you > received this in error, please contact the sender and delete the e-mail > and its attachments from all computers. > > - > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Odd problem with Tomcat 5.5.9 and PhantomReferences
On Wednesday 08 March 2006 16:33, David Goodenough wrote: > On Wednesday 08 March 2006 15:54, Caldarale, Charles R wrote: > > > From: David Goodenough [mailto:[EMAIL PROTECTED] > > > Subject: Odd problem with Tomcat 5.5.9 and PhantomReferences > > > > > > But when it comes to use the PhantomReference it gets:- > > > > > > at > > > org.apache.catalina.loader.WebappClassLoader.loadClass(WebappC > > > lassLoader.java:1221) > > > > Seem to have lost a critical piece of information - which exception? > > Sorry, what I get is a ThreadDeath. Which I take to mean that the class > loader is throwing a fit. > > David > > > - Chuck It would appear that the problem is that the WebappClassLoader is not started. There are two functions (start and stop) which appear to initialise things and tidy them up, and an internal variable which says whether start has been called (and stop not). This should throw a state exception, but somehow this is becoming a ThreadDeath. Now this loader works perfectly well if I do things in servlet methods, but as soon as I try to use the loader in the background thread, or rather as soon the system trys to use it under the covers to load PhantomReference, it fails. The upshot of this problem is that the Postgresql Jdbc3 driver is unusable on a background thread in Tomcat 5.5.9. David - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Enabling JMX and jconsole in Tomcat 5.5
I am trying to get jconsole to talk to Tomcat 5.5, and failing dismally. My first attempt was to enable the local access to JMX, using just -Dcom.sun.management.jmxremote but when I then start jconsole there are NO local services shown. So then I tried remote access, by setting -Dc.s.m.j.port=9000 and .authenticate=false and .ssl=false, but when I try to connect I just get a connection failed reply. I am obviously failing to do something really basic, but I can not see it. All the howtos just assume it works. Anyone got any clues? David - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Enabling JMX and jconsole in Tomcat 5.5 - SOLVED
I could not get this to work at all on Tomcat 5.5.9, so I installed 5.5.17, copied across the changes I had made to 5.5.9, and it worked first time. Bizaar. David. On Monday 08 May 2006 12:02, Tim Lucia wrote: > I have the following settings in my (Windows) service configuration on the > Java tab (ONE PER LINE!) > > -Dcom.sun.management.jmxremote > -Dcom.sun.management.jmxremote.port=8086 > -Dcom.sun.management.jmxremote.ssl=false > -Dcom.sun.management.jmxremote.authenticate=false > > I have similar settings in $CATALINA_HOME/bin/setenv.sh. > > Then I run JConsole, and on the remote tab, enter the host and port (8086) > and away I go. > > HTH, > Tim > > > -Original Message- > From: David Goodenough [mailto:[EMAIL PROTECTED] > Sent: Monday, May 08, 2006 6:54 AM > To: tomcat-user@jakarta.apache.org > Subject: Enabling JMX and jconsole in Tomcat 5.5 > > I am trying to get jconsole to talk to Tomcat 5.5, and failing dismally. > > My first attempt was to enable the local access to JMX, using just > -Dcom.sun.management.jmxremote but when I then start jconsole > there are NO local services shown. > > So then I tried remote access, by setting -Dc.s.m.j.port=9000 and > .authenticate=false and .ssl=false, but when I try to connect > I just get a connection failed reply. > > I am obviously failing to do something really basic, but I can not > see it. All the howtos just assume it works. > > Anyone got any clues? > > David > > - > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > > - > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Enabling JMX and jconsole in Tomcat 5.5
On Monday 08 May 2006 14:51, Gustavo Noronha wrote: > 2006/5/8, Tim Lucia <[EMAIL PROTECTED]>: > > I have the following settings in my (Windows) service configuration on > > the Java tab (ONE PER LINE!) > > > > -Dcom.sun.management.jmxremote > > -Dcom.sun.management.jmxremote.port=8086 > > -Dcom.sun.management.jmxremote.ssl=false > > -Dcom.sun.management.jmxremote.authenticate=false > > > > I have similar settings in $CATALINA_HOME/bin/setenv.sh. > > Is this supposed to work on Tomcat 5.0? I searched the docs and only found > stuff related to JMX on the 5.5 docs. Who mentioned 5.0, the subject and all subsequent replies say 5.5? David > > Thanks, > > -- > Gustavo Noronha Silva > Coordenação de Segurança e Sustentação > Ministério do Desenvolvimento Social - Brasil - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Is anyone here using ha-jdbc with database clusters?
I am trying to set up ha-jdbc, and tried asking quesions on their mailing list but it seems to be a dead list, no traffic for >24 hours apart from my questions. I have it talking from one tomcat to multiple DBs, but I need to set it up using the tag to have these same DBs access from across a Tomcat Cluster. My problem comes when I bring up the second tomcat and it complains that the resource (the cluster) already exists, which of course it does on the first tomcat, but as the cluster is distibutable it should join the existing set rather than trying to create a new one. Regards David - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
How to embed server hostname in JSP page on clustered Tomcat
I have a cluster of (currently) two Tomcat 5.5.17 instances. I want to put a hidden field on the pages which tells me which machine I am currently connected to. Reading the spec it appeared that using:- should work, but it would appear that all this does is take the server portion of the URL. Anyone know how to do this (short of writing some Java code that is, I would rather use simple JSP and JSTL). David - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
filtering tomcat logging using default logging configuration
I have a web application which is using a library which is generating too many messages. These are routed to catalina.out and all come from a particular producer (org.jgroups. is the prefix). I do not want to rework the logging to use log4j or the like, but I would like to suppress these WARN messages for this prefix. I guess I need to modify $TOMCAT_HOME/conf/logging.properties, but what do I need to add? I have read the Tomcat 5.5 logging page, but I am none the wiser as that does not seem to give any examples of filtering non-Tomcat messages. Thanks David - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Is there any documentation of JULI anywhere?
I am trying to work out how to tailor the log entries going into the Catalina log files, and am having no luck at all. I am using Tomcat 5.5.17. I have looked around for documentation of JULI, but I can find nothing which makes sense. There is a comment at the end of the logging,properties file which says there should be a example of exactly the type I want. It says:- # For example, set the com.xyz.foo logger to only log SEVERE # messages: #org.apache.catalina.startup.ContextConfig.level = FINE #org.apache.catalina.startup.HostConfig.level = FINE #org.apache.catalina.session.ManagerBase.level = FINE but as you can see this never mentions SEVERE in the sample lines, only FINE. Also it does not mention com.xyz.foo in the sample lines. There was a mention that Google found that said that there was some documentation in the JULI source, but I do not know where in the Tomcat source tree JULI is to be found, and there is an awful lot to search. Please, does anyone know how to do this, it is causing me real grief. Thanks David - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Is there any documentation of JULI anywhere?
On Tuesday 30 May 2006 13:32, David Goodenough wrote: > I am trying to work out how to tailor the log entries going into the > Catalina log files, and am having no luck at all. > > I am using Tomcat 5.5.17. > > I have looked around for documentation of JULI, but I can find nothing > which makes sense. There is a comment at the end of the logging,properties > file which says there should be a example of exactly the type I want. It > says:- > > # For example, set the com.xyz.foo logger to only log SEVERE > # messages: > #org.apache.catalina.startup.ContextConfig.level = FINE > #org.apache.catalina.startup.HostConfig.level = FINE > #org.apache.catalina.session.ManagerBase.level = FINE > > but as you can see this never mentions SEVERE in the sample > lines, only FINE. Also it does not mention com.xyz.foo in the > sample lines. > > There was a mention that Google found that said that there was > some documentation in the JULI source, but I do not know where > in the Tomcat source tree JULI is to be found, and there is an > awful lot to search. > > Please, does anyone know how to do this, it is causing me > real grief. > > Thanks > > David Well I have made a little progress, but I do not understand what it going on. Putting the lines:- org.jgroups.level = ERROR org.jgroups.handlers = 1catalina.org.apache.juli.FileHandler into logging.properties (you need both) has the effect of stopping the messages going onto the Console (which is redirected to Catalina.out) but does NOT change what goes to the catalina.{date}.log files. As I said the handler was the file handler (which is what generates catalina.{date}.log) and not to the ConsoleHandler (which sends the output to catalina.out) I am completely confused. How is it that something as important as the logging for Tomcat is so badly documented? David - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Location for libraries need for resources in Context.xml
With Tomcat 5.5 you can now define things like JDBC DataSources in META-INF/context.xml in your war files. JDBC DataSources need drivers, and obviously they can still be stored in common/lib, but given that they are defined, or rather their use is requested, through the war file, can the drivers also be put in the war file? The same question would then apply to other resources like beans etc. Putting the files in the war would have the effect of making the application self contained, so would there be any downsides to allowing this if it is currently not allowed? David - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
How to tune JSP performance?
I have a system with two identical machines running Tomcat 5.5.17 running identical applications. There are some extra things running on one of the machines, but these problems occur even when they are turned off. The application consists of two parts. There is a JSP layer, and a servlet (handling XML requests). The JSP lay talks to the XML Servlet layer for all requests, the XML servlet layer talks to a Postgresql DB on another machine. The XML portions of this app are running almost identically (i.e. within measurement tolerance) at the same speed, if I send a null request to the XML servlet they respond quickly (including loading and executing the sending routing both response within .20x seconds (the x varies from test run to test run). But using wget to invoke the JSP code gets back the logon page almost instantly on one machine, and takes an age on the other. Actually to find out that it needs to go to the logon page the JSP does not need to use the XML servlet. On the slow machine it takes 30 seconds to send back the 302 rewriting the URL so that it has a jsessionid, and then 16 seconds to serve the HTML for the logon page. On the fast machine it takes less than a second to do the same sequence. Both machines seem to be using <10% of the machine CPU. There is more than enough memory and no shortage of disk space. Both machines are connected to the postgresql machine by TCP/IP and actually the slower machine has a slightly better ping time than the fast machine, but like the XML servlet transactions the difference is within the margin of error. Until this morning both machines were behaving the same, one was probably slightly slower than the other due to the extra things running on it, but you had to be watching quite closely to notice the difference. There does not seem to have been any changes to the system that correspond with this change. Although slightly more traffic seems to be going through it that yesterday, although less than before Christmas when this slowdown was not noticable. The two machines sit behind a load balancer, which is run by the hosting organisation, they deny any changes and this effect is measured on each machine sending the requests to localhost so it does not seem likely to be part of the problem. The machines are running linux 2.6.16. They are behind a solid firewall, and there is nothing that would appear to be doing anything odd on either system, no connected sockets to strange places, no strange binaries or processes. Only the required services are open to the outside world. Also the fact that the XML Servlet seems to be running as normal suggests that the problem is localised to the JSP processing. There are no messages either in the tomcat logs or the system logs that talk of errors at either the hardware or software level. The JSPs are precompiled (by Eclipse) and the WAR files have not changed recently (they are both identical). Anyone got any good ideas as to how I might go about diagnosing this? Are there any good values available anywhere which would tell me where the tomcat system is hitting a bottleneck. David - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: How to tune JSP performance?
On Tuesday 23 January 2007 15:51, Mikolaj Rydzewski wrote: > David Goodenough wrote: > > On the slow machine it takes 30 seconds to send back the 302 > > rewriting the URL so that it has a jsessionid, and then 16 > > seconds to serve the HTML for the logon page. > > Looks like a DNS timeout value. Is the DNS system properly configured on > both machines? DNS configs are the same on both machines, and on both machines if I type ping bbc.co.uk I get a header line with the IP address back instantly on both machines. Currently it looks to me as though the problem is with the multicast messages for the clustering. I found a timeout message which is suggesting that for some reason although the slow machine can send messages to the fast, the slow machine never gets a reply. David - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: How to tune JSP performance?
On Tuesday 23 January 2007 18:14, Christopher Schultz wrote: > David, > > David Goodenough wrote: > > Currently it looks to me as though the problem is with the multicast > > messages for the clustering. I found a timeout message which is > > suggesting that for some reason although the slow machine can send > > messages to the fast, the slow machine never gets a reply. > > Check the routing tables (and iptables rules) on both machines. If you > use routing tricks to send your clustering messages through a secondary > interface, then you might be running into something weird there. no, we have only one active interface on each machine. David > > -chris > > - > To start a new topic, e-mail: users@tomcat.apache.org > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
mixed html and jsp site using ProxyPass
I have a site which is a mixture of html (and a bunch of images and flash and other such stuff which came in from the web designer) and a couple of JSPs. I have implemented this with Apache 2.2 and Tomcat 5.5, using ProxyPass statements with ajp in the Location tag. My location block looks like: # it is the root application ProxyPass ajp://127.0.0.1:8009/jsp ProxyPassReverse http://...domain... SetOutputFilter proxy-html ProxyHTMLURLMap http://127.0.0.1:8180 http://...domain... ProxyHTMLURLMAP / http://...domain... So the base stuff is at the root, and the jsp stuff is all under the jsp path element, so index.jsp is at jsp/index.jsp when referenced in a URL. There are some bits of the the Apache managed stuff (css files etc) that I need to reference in the JSP, so those are referenced as /style.css rather than style.css in the jsp pages. It would however be easier if I have the jsp code at the same level (from a URL path point of view) as the html etc files. Is there a way to divert just the .jsp files? I tried but that did not seem to work - maybe I got something else wrong. I have tried looking around with Google, but obviously I asked the wrong question as I did not find a useful answer. Any help gratefullly received. David - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: mixed html and jsp site using ProxyPass
The reason was that Tomcat did not serve the Flash correctly, never did manage to get to the bottom of why but the browser did not complain - it just left big blank spaces. With this setup at least that bit works. David On Wednesday 03 December 2008, Peter Crowther wrote: > > From: David Goodenough [mailto:[EMAIL PROTECTED] > > I have a site which is a mixture of html (and a bunch of images and > > flash and other such stuff which came in from the web designer) and > > a couple of JSPs. I have implemented this with Apache 2.2 and Tomcat > > 5.5, using ProxyPass statements with ajp in the Location tag. > > Is there any reason for such a complex setup? Tomcat will quite happily > serve the static content itself. You could: > > 1) Put all the content in the same directory for Tomcat to serve, keep > Apache httpd, but all your content goes through Tomcat->httpd->user; > > 2) Put all the content in the same directory for Tomcat to serve, remove > Apache httpd, serve the content directly through a http Connector in > Tomcat. > > - Peter > > - > To start a new topic, e-mail: users@tomcat.apache.org > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Which is right, the comment or the docs?
In the file tomcat-users.xml (at least the one shipped with the 6.0.23 Debian package) the sample users have the attribute username= in the user tag. But in the manager-howto.html (again shipped with the Debian package) the examples all say the attribute should be name=. Which is right? David - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: Which is right, the comment or the docs?
On Tuesday 25 January 2011, Konstantin Kolinko wrote: > 2011/1/25 David Goodenough : > > In the file tomcat-users.xml (at least the one shipped with the 6.0.23 > > Debian package) the sample users have the attribute username= in the > > user tag. But in the manager-howto.html (again shipped with the Debian > > package) the examples all say the attribute should be name=. Which is > > right? > > Either one works. > > o.a.c.users..MemoryUserCreationFactory#createObject(Attributes attributes): > > String username = attributes.getValue("username"); > if (username == null) { > username = attributes.getValue("name"); > } > > Best regards, > Konstantin Kolinko > > - > To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org > For additional commands, e-mail: users-h...@tomcat.apache.org Might it not be an idea to document this in both the manager-howto and the sample config file? Otherwise its just confusing. David - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
problem with JSP/JSTL and Tomcat 6
I have some old JSP pages which used to run on Tomcat 5.5. I tried to move to Tomcat 6 and the current JSTL but I am getting some odd errors. When I include the <%@ taglib directives inline in the source, say:- ... <%@ taglib uri="http://java.sun.com/jsp/jstl/core"; prefix="c" %> ... I get an error saying:- The content of elements must consist of well-formed character data or markup. If I put the taglib directives in an include file, I get an error saying that the is not bound. I have the jstl and el files from dev.java.net, and I have tomcat 6 as installed by Debian. Eclipse (Helios with its validation) seems to think everything is OK, but when I used jasper2 to compile it under ant, or simply run the page, I get the errors. Anyone got any good pointers as to how to fix this? Are there any good JSP/JSTL migration guides? David - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: problem with JSP/JSTL and Tomcat 6
On Wednesday 18 August 2010, Hassan Schroeder wrote: > On Wed, Aug 18, 2010 at 2:23 AM, David Goodenough > > wrote: > > I have some old JSP pages which used to run on Tomcat 5.5. I tried to > > move to Tomcat 6 and the current JSTL but I am getting some odd errors. > > I don't remember any similar problems moving from 5.5 to 6 but that > was seriously long ago, so ... > > > <%@ taglib uri="http://java.sun.com/jsp/jstl/core"; prefix="c" %> > > > > The content of elements must consist of well-formed character data or > > markup. > > Sounds like your page is being evaluated as a .jspx (XML-format) file. That was the problem. Eclipse had set the new jsp file up with all manner of XMLness at the start (which I had ignored). Getting rid of it and going back to the old HTMLness fixed the problem. Thanks > > > I have the jstl and el files from dev.java.net, and I have tomcat 6 as > > installed by Debian. > > Joy. Uninstall the Debian-hacked version and install a real one from > the Tomcat site. The list archives are full of issues with these funky > repackaged versions. > > Alternately, post a WAR somewhere with a simple test case showing > the failure. - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
trouble with url-pattern in a filter-mapping (tomcat 6)
I am trying to configure a filter to handle just requests to a single page which for the simplicity I will call page.htm (at the root of my application). So I created a url-pattern which read:- page.htm and put it inside my tag. But when I start tomcat6 it throws an exception complaining that this url-pattern is invalid. I tried with a leading /, I tried *ge.htm in case it wanted a wildcard in there somwhere, but none of them work. This is in a
logging from a filter
How do I write log entries from a Filter. In a servlet there is a log method but as a filter only implements Filter that is obviously not an option. David - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: logging from a filter
On Friday 20 August 2010, Rainer Jung wrote: > On 20.08.2010 11:43, David Goodenough wrote: > > How do I write log entries from a Filter. In a servlet there is a log > > method but as a filter only implements Filter that is obviously not an > > option. > > The init() of the filter is called with a FilterConfig argument, from > which you get a ServletContext via getServletContext(), which you can > store locally. The ServletContext then has the log methods you want. thanks. Exactly what I needed. David > > Regards, > > Rainer > > - > 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
Re: trouble with url-pattern in a filter-mapping (tomcat 6)
On Friday 20 August 2010, Pid wrote: > On 20/08/2010 10:40, David Goodenough wrote: > > I am trying to configure a filter to handle just requests to a single > > page which for the simplicity I will call page.htm (at the root of my > > application). > > > > So I created a url-pattern which read:- > > > > page.htm > > > > and put it inside my tag. > > > > But when I start tomcat6 it throws an exception complaining that this > > url-pattern is invalid. > > > > I tried with a leading /, I tried *ge.htm in case it wanted a wildcard in > > there somwhere, but none of them work. > > > > This is in a > Tomcat6.0.x? > > The url-pattern must start with a '/' character. > > Please post the complete application web.xml. > > > p Actually from reading the source the pattern MUST contain a wildcard. Simple explicit matches do not work, at least not on 6.0.28. David > > > David > > > > - > > 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
Re: trouble with url-pattern in a filter-mapping (tomcat 6)
On Friday 20 August 2010, Christopher Schultz wrote: > David, > > On 8/20/2010 11:27 AM, David Goodenough wrote: > > On Friday 20 August 2010, Pid wrote: > >> The url-pattern must start with a '/' character. > >> > >> Please post the complete application web.xml. > > > > Actually from reading the source the pattern MUST contain a wildcard. > > You must have read it wrong: the spec requires that the followup > url-patterns be supported: > > " > SRV.11.2 Specification of Mappings > In the Web application deployment descriptor, the following syntax is > used to define > mappings: > • A string beginning with a ‘/’ character and ending with a ‘/*’ suffix > is used for path mapping. > • A string beginning with a ‘*.’ prefix is used as an extension mapping. > • A string containing only the ’/’ character indicates the "default" > servlet of the application. In this case the servlet path is the request > URI minus the context path and the path info is null. > • All other strings are used for exact matches only. > " > > > Simple explicit matches do not work, at least not on 6.0.28. > > That would be a horrible bug. Well the validate routine seems to exhibit the bug. private boolean validateURLPattern(String urlPattern) { if (urlPattern == null) return (false); if (urlPattern.indexOf('\n') >= 0 || urlPattern.indexOf('\r') >= 0) { return (false); } if (urlPattern.startsWith("*.")) { if (urlPattern.indexOf('/') < 0) { checkUnusualURLPattern(urlPattern); return (true); } else return (false); } if ( (urlPattern.startsWith("/")) && (urlPattern.indexOf("*.") < 0)) { checkUnusualURLPattern(urlPattern); return (true); } else return (false); } seems to me not to allow for anything without either a leading / or a *. checkUnusualURLPattern does not help either. > > Seriously, can you post your web.xml? You might have something else > interfering with the mapping. Just changing it to a wildcard fixed it. The only thing I changed was the tag, from "page.htm" to "*.htm". > > Also, do you have another component in the environment, such as Apache > httpd? As Tomcat was throwing exceptions when it loaded the web.xml I doubt the any other component could cause it. But no, no other components, raw Tomat. David > > -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
Re: Restricting access to tomcat via httpd proxy only
On Tuesday 09 November 2010, Ari King wrote: > Hi all, > > I have an httpd proxy in front of my tomcat servers/instances, and I'd > like to restrict access to those tomcat servers/instances to be > through the httpd proxy. This is in a lab settings so I'd prefer to > use tomcat configurations, rather than use something like a firewall. > Anyone have any suggestions on how I can accomplish this? Thanks. > > -Ari > > - > To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org > For additional commands, e-mail: users-h...@tomcat.apache.org You could bind tomcat to localhost, and then although other processes (such as the httpd proxy) can reach tomcat, no other machines will be able to. David - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org