Re: OT: Breadcrumbs Tomcat 7.0.11
You can't, unless you have a filter parsing the outbound generated page, or use JavaScript on the client (neither of which I'd recommend). One of the options I was thinking of writing the filter just to get the path of the clicked pages and use that. But now I feel I might not require that. >>>Of course, there's no parameter being set on that link. Thanks for clarifying this.I am not a full time developer so obviously I am prone to make mistakes.Good now I realise how to pull values.I do have around 15 pages and around 10 servlets with some bits of JSTL.But again some days I work with JS/CSS and some days with Java.So sometimes do forget these basic things.Lucky I am sometimes good folks like you point it out. For that matter if you use the 'books.jsp' => Books approach, you can probably use JSTL to do that transform. Or create a custom tag to handle it (possibly better). I am working on it now that I have some clarity as how I can implement this. One final doubt can I have one servlet similar to listener which will listen to the clicks,store the path info,validate the sessions and then push that data to some jsp and I can include that jsp in my all pages.Do I need to implement this exactly the way we implement httpsession listener ? and also Hassan many thanks for direction. On 12/29/2011 6:02 AM, Hassan Schroeder wrote: On Wed, Dec 28, 2011 at 3:58 PM, Kiran Badi wrote: Books How can I pull out name value here ? You can't, unless you have a filter parsing the outbound generated page, or use JavaScript on the client (neither of which I'd recommend). request.getparameter is giving me null here. Of course, there's no parameter being set on that link. and other thing I can think of is Books and point the call towards books.jsp and then use request.getGetRequestURL() and then strip the last part of the URL and then use that as navigational info. That was my point :-) though '/books' is nicer than 'books.jsp' IMO, but ... That would be be my first level, and then do similar thing for second level with check that at each level that session id remains the same in all cases. I don't understand that at all -- if you're using the session to keep track of the breadcrumb path, it's "the same" by definition. Does my thoughts makes sense or do we have some better solutions with pure jsp/servlets/jstl with TC without using any plugin? Again, what magic do you think is going to map some arbitrary text to a URL used by your application? If you create a simple mapping table, you can use JSTL to populate your pages (and breadcrumb trail) appropriately. For that matter if you use the 'books.jsp' => Books approach, you can probably use JSTL to do that transform. Or create a custom tag to handle it (possibly better). HTH, - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
help analyzing thread dump for Tomcat 7.0.23 issue
I have an app that runs on Tomcat 7.0.21 and APR 1.4.7 just fine. The app serves both SSL and non-SSL traffic. SSL traffic makes up roughly 1% of the overall traffic. The Connectors for SSL and non-SSL both use the default value (200) for maxThreads. When I try to run the app on Tomcat 7.0.23 (with the same server.xml, context.xml and web.xml) and APR 1.4.7, the app slowly grinds to a halt after running on a live production server for about a day. I took heap dumps of the app on both 7.0.21 and 7.0.23 and don't see any significant difference in memory usage. Memory seems to be fine. I did a stack dump on 7.0.23 when it was in its messed up state. No threads are blocked on critical sections of my app. For the port 8080 connector, there are 196 threads in "waiting on condition" and 4 threads in "runnable". For the port 8443 connector, there are 81 threads in "waiting on condition" and 119 threads in "runnable". I don't know how to interpret this data, since I'm not really clear on what the difference is between "runnable" and "waiting on condition". Do these numbers seem normal, or are they perhaps giving a clue as to what the underlying problem might be? - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: Odd NIO connector behavior
On Thu, Dec 29, 2011 at 12:02 PM, Tim Watts wrote: > On Thu, 2011-12-29 at 11:22 -0800, Matthew Tyson wrote: > > > > > How an empty 200 response could be generated > > without executing the logging statement here is a mystery. > > > > Do you still have that MonitoringFilter configured in the web app? > Perhaps it is short circuiting the chain. > > I've been running tests without the filter in place - unfortunately, same results. Empty 200s from tomcat for many requests. Thanks, Matt Tyson
Re: Odd NIO connector behavior
On Thu, 2011-12-29 at 11:22 -0800, Matthew Tyson wrote: > How an empty 200 response could be generated > without executing the logging statement here is a mystery. > Do you still have that MonitoringFilter configured in the web app? Perhaps it is short circuiting the chain. > protected void service(HttpServletRequest request, HttpServletResponse > response) throws ServletException, IOException > { > logger.info("REQUEST: " + request.getRemoteAddr() + " " + > request.getMethod() + " " + request.getQueryString() + " | TRACE: ", new > Throwable()); > > if ("OPTIONS".equals(request.getMethod())) > { > serviceOptions(request, response); > return; > } > > HttpTransport transport = null; > List allowedTransports = _bayeux.getAllowedTransports(); > for (String transportName : allowedTransports) > { > ServerTransport serverTransport = > _bayeux.getTransport(transportName); > if (serverTransport instanceof HttpTransport) > { > HttpTransport t = (HttpTransport)serverTransport; > if (t.accept(request)) > { > transport = t; > logger.info("ACCEPTED: " + request.getRemoteAddr() + " > " + t.getClass().getName()); > break; > } else { > logger.info("NOT ACCEPTED: " + request.getRemoteAddr() + " > " + t.getClass().getName()); > } > } > } > > if (transport == null) > { > if (!response.isCommitted()) { > response.sendError(HttpServletResponse.SC_BAD_REQUEST, "Unknown > Bayeux Transport"); > } else { > logger.info("NULL TRANSPORT: " + request.getRemoteAddr()); > } > } > else > { > try > { > _bayeux.setCurrentTransport(transport); > transport.setCurrentRequest(request); > transport.handle(request, response); > } > finally > { > transport.setCurrentRequest(null); > BayeuxServerImpl bayeux = _bayeux; > if (bayeux != null) > bayeux.setCurrentTransport(null); > } > } > } > > Best, > > Matt Tyson signature.asc Description: This is a digitally signed message part
Re: Odd NIO connector behavior
On 29/12/2011 17:27, Matthew Tyson wrote: > On Wed, Dec 28, 2011 at 6:22 PM, Matthew Tyson > wrote: > >> On Wed, Dec 28, 2011 at 8:58 AM, Stefan Mayr wrote: >> >>> Am 28.12.2011 10:04, schrieb ma...@apache.org: >>> >>> Matthew Tyson> wrote: That's right, there is an f5 load balancer. The valve is used to keep > track of whether the request was via HTTPS or not. > What happens if you go direct to Tomcat and bypass the F5? tcpdump seems to confirm the same. What are you thinking? > Probably, like me, that the F5 isn't handling the Comet requests correctly. >>> >>> This is what I would guess. We have a loadbalancing device that handles n >>> client-lb connections with m lb-server connections in its HTTP mode. There >>> we have to switch to TCP proxy mode to keep 1:1 relations. >>> >>> Your F5 is where to do start crosschecking with tcpdump: client <-> F5 vs >>> F5 <-> server >>> >>> Stefan >>> >>> >> You think its possible that multiplexing or some load-balancer config >> would cause the two observed issues: >> >> 1) When the custom valve is in use, zombie service() executions continue >> with no actual inbound requests >> 2) Inbound requests are being replied to with blank 200s, without ever >> executing the service method. >> >> Thanks, >> >> Matt Tyson >> >> > I think maybe I wasn't clear before. I am running ngrep on the server, > inside the f5. > > F5 <-> ngrep <-> tomcat > > So the behavior I am seeing is inbound traffic from the F5 to Tomcat, then > outbound traffic from Tomcat (empty 200s that don't execute the servlet > service) back to the F5. It seems very unlikely that F5 configuration is > the cause there. Can you post the CometdServlet code? p -- [key:62590808] signature.asc Description: OpenPGP digital signature
Re: Odd NIO connector behavior
On Thu, Dec 29, 2011 at 11:07 AM, Pid wrote: > On 29/12/2011 17:27, Matthew Tyson wrote: > > On Wed, Dec 28, 2011 at 6:22 PM, Matthew Tyson > > wrote: > > > >> On Wed, Dec 28, 2011 at 8:58 AM, Stefan Mayr >wrote: > >> > >>> Am 28.12.2011 10:04, schrieb ma...@apache.org: > >>> > >>> Matthew Tyson matthewcarlty...@gmail.com>> > wrote: > > That's right, there is an f5 load balancer. The valve is used to > keep > > track of whether the request was via HTTPS or not. > > > > What happens if you go direct to Tomcat and bypass the F5? > > tcpdump seems to confirm the same. What are you thinking? > > > > Probably, like me, that the F5 isn't handling the Comet requests > correctly. > > >>> > >>> This is what I would guess. We have a loadbalancing device that > handles n > >>> client-lb connections with m lb-server connections in its HTTP mode. > There > >>> we have to switch to TCP proxy mode to keep 1:1 relations. > >>> > >>> Your F5 is where to do start crosschecking with tcpdump: client <-> F5 > vs > >>> F5 <-> server > >>> > >>> Stefan > >>> > >>> > >> You think its possible that multiplexing or some load-balancer config > >> would cause the two observed issues: > >> > >> 1) When the custom valve is in use, zombie service() executions continue > >> with no actual inbound requests > >> 2) Inbound requests are being replied to with blank 200s, without ever > >> executing the service method. > >> > >> Thanks, > >> > >> Matt Tyson > >> > >> > > I think maybe I wasn't clear before. I am running ngrep on the server, > > inside the f5. > > > > F5 <-> ngrep <-> tomcat > > > > So the behavior I am seeing is inbound traffic from the F5 to Tomcat, > then > > outbound traffic from Tomcat (empty 200s that don't execute the servlet > > service) back to the F5. It seems very unlikely that F5 configuration is > > the cause there. > > Can you post the CometdServlet code? > > > p > > Here is the code from the service method, it is basically from the cometd.org project, with some added logging. There's obviously quite a bit more involved in how cometd processes things, but in this case, the servlet itself is very simple. How an empty 200 response could be generated without executing the logging statement here is a mystery. protected void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { logger.info("REQUEST: " + request.getRemoteAddr() + " " + request.getMethod() + " " + request.getQueryString() + " | TRACE: ", new Throwable()); if ("OPTIONS".equals(request.getMethod())) { serviceOptions(request, response); return; } HttpTransport transport = null; List allowedTransports = _bayeux.getAllowedTransports(); for (String transportName : allowedTransports) { ServerTransport serverTransport = _bayeux.getTransport(transportName); if (serverTransport instanceof HttpTransport) { HttpTransport t = (HttpTransport)serverTransport; if (t.accept(request)) { transport = t; logger.info("ACCEPTED: " + request.getRemoteAddr() + " " + t.getClass().getName()); break; } else { logger.info("NOT ACCEPTED: " + request.getRemoteAddr() + " " + t.getClass().getName()); } } } if (transport == null) { if (!response.isCommitted()) { response.sendError(HttpServletResponse.SC_BAD_REQUEST, "Unknown Bayeux Transport"); } else { logger.info("NULL TRANSPORT: " + request.getRemoteAddr()); } } else { try { _bayeux.setCurrentTransport(transport); transport.setCurrentRequest(request); transport.handle(request, response); } finally { transport.setCurrentRequest(null); BayeuxServerImpl bayeux = _bayeux; if (bayeux != null) bayeux.setCurrentTransport(null); } } } Best, Matt Tyson
Re: Odd NIO connector behavior
On Wed, Dec 28, 2011 at 6:22 PM, Matthew Tyson wrote: > On Wed, Dec 28, 2011 at 8:58 AM, Stefan Mayr wrote: > >> Am 28.12.2011 10:04, schrieb ma...@apache.org: >> >> Matthew Tyson> >>> wrote: >>> >>> That's right, there is an f5 load balancer. The valve is used to keep track of whether the request was via HTTPS or not. >>> >>> What happens if you go direct to Tomcat and bypass the F5? >>> >>> tcpdump seems to confirm the same. What are you thinking? >>> >>> Probably, like me, that the F5 isn't handling the Comet requests >>> correctly. >>> >> >> This is what I would guess. We have a loadbalancing device that handles n >> client-lb connections with m lb-server connections in its HTTP mode. There >> we have to switch to TCP proxy mode to keep 1:1 relations. >> >> Your F5 is where to do start crosschecking with tcpdump: client <-> F5 vs >> F5 <-> server >> >> Stefan >> >> > You think its possible that multiplexing or some load-balancer config > would cause the two observed issues: > > 1) When the custom valve is in use, zombie service() executions continue > with no actual inbound requests > 2) Inbound requests are being replied to with blank 200s, without ever > executing the service method. > > Thanks, > > Matt Tyson > > I think maybe I wasn't clear before. I am running ngrep on the server, inside the f5. F5 <-> ngrep <-> tomcat So the behavior I am seeing is inbound traffic from the F5 to Tomcat, then outbound traffic from Tomcat (empty 200s that don't execute the servlet service) back to the F5. It seems very unlikely that F5 configuration is the cause there. Matt Tyson
Re: Tomcat HTTPS Connector Stops working after an hour
On 29/12/2011 08:51, Saravanan L wrote: > *Point 1 and 2. * > 1. When I remove acceptCount=1 My tomcat 7 works fine. So remove it and don't put it back. > 2. But I had the same property in tomcat 6 and it worked fine on that. Clearly something is broken with your app / Tomcat 7 configuration. Using maxThreads=5000 when you are only servicing 9000 requests in 1800 seconds with an average processing time of less than 1s per request is not only excessive it will mask any connection related problems you do have. The default of 200 should be fine. Since you are using APR, you don't need a thread to maintain a keep-alive connection so I would reduce maxThreads to no more than 20 for now to aid debugging. Once you have fixed the problem, then you can restore the default. > A. I tried remove and altering some variables to check this problem. > Mistakenly I thought acceptCount was the culprit, because > after removing acceptCount, tomcat was running for 2 hours then 443 > connector stopped. Tomcat 6 with the same configuration (server.xml) > works fine. That is pretty much completely unhelpful. a) you need to tell us what you are changing and what the results were and b) you should only change one thing at a time. > *Point 4* > 4. Also found out that when it reaches 9000 connections with my existing > connector [See below] the tomcat https [Http works fine] stops > responding and the browser says 'Connection reset by peer'. Connections != requests. Please make sure you use the correct terminology because if you don't it will cause confusion. Point was was related to old, invalid attributes you had in server.xml that should be removed. > A. When the request count reaches 9000, the tomcat fails within minutes. > This depends , the last two times I tested, I was able to reproduce this. > Log from Tomcat Server status. > (after 1/half hour) > Max threads: 5000 Current thread count: 209 Current thread busy: 2 > Keeped alive sockets count: 56 > Max processing time: 300477 ms Processing time: 8788.765 s Request > count: 9926 Error count: 783 Bytes received: 0.22 MB Bytes sent: 5.43 MB So, actions for you are: - remove accepCount from the connector configuration - reduce maxThreads to 20 - remove use of attributes that are not supported in Tomcat 7 (check that each attribute is in the docs) - explain exactly how you are testing these SSL connections (JMeter, browser, something else?) - repeat your test with the above settings and then report the results. Include relevant extracts from: - logs - netstat output - thread dump Mark - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Apache tribes deserialization issues
Hi All, We are using Apache tribes library for presence and inter node communication within an OSGi runtime environment. We have a central node (say node A) receiving messages from other nodes ( say node B, C). The message passed is a custom class which is present as part of the API defined in a separate OSGi bundle. This custom class is Serializable. When a send method is invoked on the GroupChannel to send the custom class message to node A then it throws an exception with the following stack trace: java.lang.ClassNotFoundException: com.sap.nm.NodeSnapshot at org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(BundleLoader.java:513) at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:429) at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:417) at org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.loadClass(DefaultClassLoader.java:107) at java.lang.ClassLoader.loadClass(Unknown Source) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Unknown Source) at java.io.ObjectInputStream.resolveClass(Unknown Source) at java.io.ObjectInputStream.readNonProxyDesc(Unknown Source) at java.io.ObjectInputStream.readClassDesc(Unknown Source) at java.io.ObjectInputStream.readOrdinaryObject(Unknown Source) at java.io.ObjectInputStream.readObject0(Unknown Source) at java.io.ObjectInputStream.readObject(Unknown Source) at org.apache.catalina.tribes.io.XByteBuffer.deserialize(XByteBuffer.java:568) at org.apache.catalina.tribes.io.XByteBuffer.deserialize(XByteBuffer.java:554) at org.apache.catalina.tribes.group.GroupChannel.messageReceived(GroupChannel.java:261) at org.apache.catalina.tribes.group.ChannelInterceptorBase.messageReceived(ChannelInterceptorBase.java:84) at org.apache.catalina.tribes.group.ChannelInterceptorBase.messageReceived(ChannelInterceptorBase.java:84) at org.apache.catalina.tribes.group.ChannelCoordinator.messageReceived(ChannelCoordinator.java:253) at org.apache.catalina.tribes.transport.ReceiverBase.messageDataReceived(ReceiverBase.java:287) at org.apache.catalina.tribes.transport.nio.NioReplicationTask.drainChannel(NioReplicationTask.java:212) at org.apache.catalina.tribes.transport.nio.NioReplicationTask.run(NioReplicationTask.java:101) at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source) at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) at java.lang.Thread.run(Unknown Source) The problem is that OSGi has a totally different class loading mechanism that what is followed in java/j2ee applications. We looked at the tribes source code and found out that following piece of code is the culprit: Class: XByteBuffer.java public static Serializable deserialize(byte[] data, int offset, int length) throws IOException, ClassNotFoundException, ClassCastException { return deserialize(data,offset,length,null); } Instead of passing null to the ClassLoader[] (last argument), Thread context classloader should have been passed. What is happening is that the tribes is trying to load the class with the tribes class loader and not using the current thread classloader and is therefore not able to find the custom class. A workaround that we have adopted now is to use byte[] and set Channel.SEND_OPTIONS_BYTE_MESSAGE option while sending the message. We then explicitly recreate the object in the ChannelListener in bundle A from the bytes message. This is possible because in GroupChannel byte messages are not deserialized using XByteBuffer. It will great if anyone can investigate this issue. Best Regards, Madhav -- When I tell the truth, it is not for the sake of convincing those who do not know it, but for the sake of defending those that do
Re: Tomcat HTTPS Connector Stops working after an hour
*Point 1 and 2. * 1. When I remove acceptCount=1 My tomcat 7 works fine. 2. But I had the same property in tomcat 6 and it worked fine on that. A. I tried remove and altering some variables to check this problem. Mistakenly I thought acceptCount was the culprit, because after removing acceptCount, tomcat was running for 2 hours then 443 connector stopped. Tomcat 6 with the same configuration (server.xml) works fine. *Point 4* 4. Also found out that when it reaches 9000 connections with my existing connector [See below] the tomcat https [Http works fine] stops responding and the browser says 'Connection reset by peer'. A. When the request count reaches 9000, the tomcat fails within minutes. This depends , the last two times I tested, I was able to reproduce this. Log from Tomcat Server status. (after 1/half hour) Max threads: 5000 Current thread count: 209 Current thread busy: 2 Keeped alive sockets count: 56 Max processing time: 300477 ms Processing time: 8788.765 s Request count: 9926 Error count: 783 Bytes received: 0.22 MB Bytes sent: 5.43 MB On 12/28/2011 2:37 PM, ma...@apache.org wrote: Saravanan L wrote: Tomcat does not pass through any proxy. My firefox browser has a proxy plugin configured which RELAYED this message. I enabled this plugin because, I wanted to be sure of whats happening. (I guess I should made it clear) So the end line is tomcat does not responds to the request at all. Firefox says- Connection reset by peer. Chrome says - Same as above but in a different manner Firefox with Proxy - 504 Q. how your system is configured A. Just tomcat running in linux box (Fedora) with APR and Native compiled. 3. A 504 response code is a gateway timeout. Tomcat does not issue this on its own. Either you have a proxy in front of Tomcat or your application is returning this value. A. Yes the proxy relayed this message, it seems the tomcat did not respond with any message at all. - Original Message - From: "Mark Thomas" To: "Tomcat Users List" Sent: Tuesday, December 27, 2011 10:58:29 PM Subject: Re: Tomcat HTTPS Connector Stops working after an hour On 27/12/2011 10:47, Saravanan L wrote: 3. A 504 response code is a gateway timeout. Tomcat does not issue this on its own. Either you have a proxy in front of Tomcat or your application is returning this value. A. Yes the proxy relayed this message, it seems the tomcat did not respond with any message at all. Which is the first mention in this thread that you are accessing Tomcat via a proxy which makes most of the previous contents of this thread null and void. I think you need to start again with a more complete description of how your system is configured. This is look less and less like a Tomcat issue and more and more like a poorly configured proxy. Mark - 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 Ok. So go back a few messages and address points 1, 2 and 4. Mark - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org -- Regards *Saravanan.L* This message and any attachment(s) contained here are information that is confidential, proprietary to TE Software Services and its customers. Contents may be privileged or otherwise protected by law. The information is solely intended for the individual or the entity it is addressed to. If you are not the intended recipient of this message, you are not authorized to read, forward, print, retain, copy or disseminate this message or any part of it. If you have received this e-mail in error, please notify the sender immediately by return e-mail and delete it from your computer.
403 jsp - display required roles
hi, i have a custom 403 error page. on that page i'd like to display the securityConstraints that apply to the requested resource. example : i have a securityConstraint in my web.xml that says that only users with role "X" are allowed to view resource "myPage". when someone tries to access "myPage" without being in the role "X", i'd like to display "Role "X" is required to view "myPage"" is there a way to access the security constraints defined in web.xml from within a jsp? any pointer really appreciated wkr http://www.turnguard.com/turnguard -- | Jürgen Jakobitsch, | Software Developer | Semantic Web Company GmbH | Mariahilfer Straße 70 / Neubaugasse 1, Top 8 | A - 1070 Wien, Austria | Mob +43 676 62 12 710 | Fax +43.1.402 12 35 - 22 COMPANY INFORMATION | http://www.semantic-web.at/ PERSONAL INFORMATION | web : http://www.turnguard.com | foaf : http://www.turnguard.com/turnguard | skype : jakobitsch-punkt - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Adding Support to Fedora for Starting tomcat with jsvc
Currently, Fedora 16 does not support starting/stopping tomcat with jsvc. systemd starts tomcat directly using an unprivileged account. This means the only options supported out-of-the-box are: 1) using something like apache mod_proxy as a front-end, or 2) using an iptables entry to forward port 80 to port 8080. If one wanted to use jsvc, one would have had to manually manipulate the scripts, which could get overwritten in the next update. Thus, I created a patch where systemd would start jsvc, which in turn would start tomcat. If you believe this to be beneficial, I encourage you to check it out at: https://bugzilla.redhat.com/show_bug.cgi?id=761623 - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org