Re: GC Issue on Tomcat6
http://ca.linkedin.com/in/ameermawia Toronto, ON Phone:647-262-4380 On Fri, Apr 17, 2015 at 8:47 AM, David kerber dcker...@verizon.net wrote: On 4/17/2015 8:32 AM, Subhro Paul wrote: Hi Team, For our client website we have two Tomcat servers. Both servers are having same configuration which is 16GB RAM, 8CPUS and Linux 6.5 OS. Tomcat 6 and JAVA 6 are installed in both systems. Yesterday, using Jconsole we observed that frequency of GC on one server was very high which was 5 GC hit per Minute and on other server it was 1 GC hit per 3 Minutes. But today we observed that on both of the servers GC frequency is same. Garbage Collection in Oracle Hot spot JVM takes place in generational manner. GC on young generation is invoked much more frequently, while Full GC is invoked once in a while. In any case, frequency is much higher than what you have mentioned. I'm not sure which GC(Young/Full) you are talking about? What pattern of GC you have earlier observed? Is this a know secnario or the server is facing any issue? GC issue has nothing to do with Tomcat per say. It is the memory footprint of your application which will dictate GC behavior. In any case, if your application is facing some memory bottle-neck, it is better to pay attention on the percentage your JVM is spending in GCing your application. If that percentage is very high, say ~90%, that means your application is facing sever memory constrain, your application is almost stalled as JVM has been trying very high to recover some space. Most probably in that case, your JVM will die throwing OOM error in sometime. It was probably just receiving more traffic and/or doing more work of some other kind. - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: GC Issue on Tomcat6
On Fri, Apr 17, 2015 at 10:07 AM, Subhro Paul subhro.p...@tcs.com wrote: From: Ameer Mawia ameer.ma...@gmail.com To: Tomcat Users List users@tomcat.apache.org Date: 04/17/2015 06:29 PM Subject:Re: GC Issue on Tomcat6 http://ca.linkedin.com/in/ameermawia Toronto, ON Phone:647-262-4380 On Fri, Apr 17, 2015 at 8:47 AM, David kerber dcker...@verizon.net wrote: On 4/17/2015 8:32 AM, Subhro Paul wrote: Hi Team, For our client website we have two Tomcat servers. Both servers are having same configuration which is 16GB RAM, 8CPUS and Linux 6.5 OS. Tomcat 6 and JAVA 6 are installed in both systems. Yesterday, using Jconsole we observed that frequency of GC on one server was very high which was 5 GC hit per Minute and on other server it was 1 GC hit per 3 Minutes. But today we observed that on both of the servers GC frequency is same. Garbage Collection in Oracle Hot spot JVM takes place in generational manner. GC on young generation is invoked much more frequently, while Full GC is invoked once in a while. In any case, frequency is much higher than what you have mentioned. I'm not sure which GC(Young/Full) you are talking about? What pattern of GC you have earlier observed? Is this a know secnario or the server is facing any issue? GC issue has nothing to do with Tomcat per say. It is the memory footprint of your application which will dictate GC behavior. In any case, if your application is facing some memory bottle-neck, it is better to pay attention on the percentage your JVM is spending in GCing your application. If that percentage is very high, say ~90%, that means your application is facing sever memory constrain, your application is almost stalled as JVM has been trying very high to recover some space. Most probably in that case, your JVM will die throwing OOM error in sometime. It was probably just receiving more traffic and/or doing more work of some other kind. - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org Dear Ameer, I am talking about Young GC which is PS Scavenge for both of the servers. Full GC was Running 1/Hour. Can you please assist how to check the % of memory utilization by GC through JConsole or any other process. Subhro, please reply inline. People prefer that way here. It makes reading the thread easier. I was talking about percentage utilization of CPU Time by GC Threads. Getting % Memory usage is also very helpful. There is a number of way to check Memory utilization, stats: - JConsole Memory tab. - Console output. You will have to turn on the JVM flag to dump these details. - -XX:+PrintGCDetails -- This also give time spent in a particular GC operation. - Thread dump( Kill -3 Unix machine) Also, you can get some fine tuned information about time usage by your application threads, using these flags: - -XX:+PrintGCApplicationConcurrentTime - -XX:+PrintGCApplicationStoppedTime Out of curiosity, how did you get this information Full GC was Running 1/Hour. I guess that is too few run. Thanks Regards, Subhro Paul =-=-= Notice: The information contained in this e-mail message and/or attachments to it may contain confidential or privileged information. If you are not the intended recipient, any dissemination, use, review, distribution, printing or copying of the information contained in this e-mail message and/or attachments to it are strictly prohibited. If you have received this communication in error, please notify us by reply e-mail or telephone and immediately and permanently delete the message and any attachments. Thank you -- http://ca.linkedin.com/in/ameermawia Toronto, ON
Re: Tomcat server Performance imporvement required
On Mar 29, 2015 2:53 AM, Paul, Subhro subhro.p...@pseg.com wrote: Dear Team, I am an application developer from TCS and working for PSEG ( https://www.pseg.com). You might have seen my queries which I forwarded on 12 Feb, 2015 for Tomcat server crashing issue. After that we have added some resources to the servers. Now we have two Tomcat6 servers each one is having 16GB of RAM and 8CUPS. All server are Linux 6.5 64 bit OS. As per application architecture we have two Apache Proxy servers and two Tomcat servers. Also we have two loadbalancers, one for Proxy loadbalancing and another for Tomcat loadbalancing. So, when request comes that comes to proxy loadbalncer first then Apache Proxy server - Tomcat loadbalancer - Tomcat server. Some days back on 19th and 23rd of March another incident occurs when server faced some issues again. This time none of the servers where crashed but for some highly used pages in the site, Apache proxy server started complaining Timeout which is 60 seconds. After googling we thought we could increase the Time out in Proxy but client don't accept that. So we need some tuning parameters on Tomcat server for better performance. Below are some of the setting parameters from actual server. Ports are masked. Initializing param: JAVA_OPTS=${JAVA_OPTS} -Xms1024M -Xmx1024M CATALINA_OPTS=${CATALINA_OPTS} -Xms1024M -Xmx1024M Connector Initialization param: Connector port= protocol=HTTP/1.1 connectionTimeout=2 server= secure=true redirectPort= maxThreads=512/ All other parameters are kept as default. Also we did some load testing on the servers in Test environment and found that if we restart the Tomcat server it works absolutely fine but gradually performance decrease though the garbage collection happening and very little memory captured by PS Old Gen'. You almost HIT the point. You have to allocate more heap space..Xmx..to your Tomcat JVM, OR else if you can't afford that, then obviously analyse your application and try reducing the memory footprint. Is there any other parameters we can add in the servers to increase performance? Thanks Regards, Subhro Paul - The information contained in this e-mail, including any attachment(s), is intended solely for use by the named addressee(s). If you are not the intended recipient, or a person designated as responsible for delivering such messages to the intended recipient, you are not authorized to disclose, copy, distribute or retain this message, in whole or in part, without written authorization from PSEG. This e-mail may contain proprietary, confidential or privileged information. If you have received this message in error, please notify the sender immediately. This notice is included in all e-mail messages leaving PSEG. Thank you for your cooperation. - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org Regards, Ameer Mawia
Re: Help! Tomcat crashing on takeoff
Tomcat has few fallback approach for catalina.properties: 1.First it look at system properties for config url, with property name catalina.config 2.If it could not find in step-1, it looks at CATALINA_BASE/conf/ 3.If it again could'n find above, it tries to load it from the classpath of bootstrap classloader. 4.If it couldn't find even there, it will spit a WARNING log. Given that: a. as you mentioned 2nd is not a problem and CATALINA_BASE/conf/catalina.properties have valid common.loader values b. 3rd should not be a problem, because as can be seen bootstrap.jar is there, and if everything is okay, catalina.properties should be included inside it(you can verify it by unzipping the bootstrap.jar and sneaking at org/apache/catalina/startup) c. and finally you don't see any warning log I will imagine you are passing catalina.config as a system property, which is pointing to a catalina.properties which doesn't have a valid common.loader value. And if this is not the case, then catalina.jar which is being picked us is corrupted and doesn't contain org.apache.catalina.startup.Catalina. This you can verify by manually sneaking into the jar, by unzipping it. Apart from these, there is little else which I could imagine is a problem. And off-course these are all under the assumption that you are using standard distribution and haven't tweaked with the build process/or even customizing the code. Also, I will suggest you past your catalina.log somewhere for us to see, probably you may be missing something? Regards, Ameer Mawia On Sat, Dec 13, 2014 at 7:50 AM, Filip Hanik fi...@hanik.com wrote: It means they didn't take into effect. On the command line you should be able to do java -verbose:class -version and see if that flag works, if it does, then I suggest you create a setenv.sh file next to startup.sh and put JAVA_OPTS=-verbose:class -Dibm.cl.verbose=ClassToTrace export JAVA_OPTS and hopefully that way it takes into effect On Fri, Dec 12, 2014 at 6:47 PM, James H. H. Lampert jam...@touchtonecorp.com wrote: On 12/12/14 5:36 PM, Filip Hanik wrote: We're not looking for change, we're looking for the output, that may tell us what is going on. Please post it, if you're not getting any output, then either those aren't supported (which I definitely thought they would be), or you're invoking it incorrectly Of course I wasn't expecting any change in behavior. No change implicitly meant no change in the output. And I then explicitly said that the exceptions in catalina.out look the same, what gets sent to STDOUT looks the same, and the joblogs from what QSHELL spawned off look the same. If there's anyplace else that additional output from those parameters could have gone, besides catalina.out, STDOUT, or a spool file, I can't imagine where, and I have over 20 years of experience with AS/400s. -- JHHL - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: Help! Tomcat crashing on takeoff
On Sat, Dec 13, 2014 at 12:01 AM, Filip Hanik fi...@hanik.com wrote: Couple of things that comes to mind 1. the 'java' binary that gets executed is actually not the one you think it is 2. the file /wintouch/tomcat/bin/bootstrap.jar is corrupted or not readable by the JVM hence it can't find the class org.apache.catalina.startup.Catalina is distributed as part of catalina.jar. catalina.jar is loaded by common.loader defined catalina.properties: common.loader=${catalina.base}/lib,${catalina.base}/lib/*.jar,${catalina.home}/lib,${catalina.home}/lib/*.jar As stack-trace shows Bootstrap has been loaded successfully. So bootstrap.jar is not an issue. Can you please check your conf/catalina.properties, it contains above line? Filip On Fri, Dec 12, 2014 at 11:27 AM, James H. H. Lampert jam...@touchtonecorp.com wrote: On 12/12/14 10:02 AM, Caldarale, Charles R wrote: From: James H. H. Lampert [mailto:jam...@touchtonecorp.com] Subject: Help! Tomcat crashing on takeoff I'm trying to bring up Tomcat on a customer's AS/400. Don't suppose you'd want to give us a clue as to _exactly_ which version of Tomcat you're trying to run? Certainly. The customer box (an AS/400 at V6R1) is, according to RELEASE-NOTES, on 7.0.56. Our box (another AS/400 at V6R1) is on 7.0.54. We have another customer box (another AS/400, this one at V7R1) that is running 7.0.56 just fine. I just wiped out the /wintouch/tomcat directory (same convention we use at all of our Tomcat installations), re-unzipped it, and tried to launch it without doing any of our usual configuration changes (e.g., enabling SSL, setting up a user for Manager). It still crashed exactly the same way. -- James H. H. Lampert - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: Help! Tomcat crashing on takeoff
On Sat, Dec 13, 2014 at 12:01 AM, Filip Hanik fi...@hanik.com wrote: Couple of things that comes to mind 1. the 'java' binary that gets executed is actually not the one you think it is 2. the file /wintouch/tomcat/bin/bootstrap.jar is corrupted or not readable by the JVM hence it can't find the class org.apache.catalina.startup.Catalina is distributed as part of catalina.jar, located at CATALINA_BASE/lib. catalina.jar is loaded by commonloader defined having classpath defined in catalina.properties: common.loader=${catalina.base}/lib,${catalina.base}/lib/*.jar,${catalina.home}/lib,${catalina.home}/lib/*.jar As stack-trace shows Bootstrap has been loaded successfully. So bootstrap.jar is not an issue. Can you please check your conf/catalina.properties, if it contains above line? Filip On Fri, Dec 12, 2014 at 11:27 AM, James H. H. Lampert jam...@touchtonecorp.com wrote: On 12/12/14 10:02 AM, Caldarale, Charles R wrote: From: James H. H. Lampert [mailto:jam...@touchtonecorp.com] Subject: Help! Tomcat crashing on takeoff I'm trying to bring up Tomcat on a customer's AS/400. Don't suppose you'd want to give us a clue as to _exactly_ which version of Tomcat you're trying to run? Certainly. The customer box (an AS/400 at V6R1) is, according to RELEASE-NOTES, on 7.0.56. Our box (another AS/400 at V6R1) is on 7.0.54. We have another customer box (another AS/400, this one at V7R1) that is running 7.0.56 just fine. I just wiped out the /wintouch/tomcat directory (same convention we use at all of our Tomcat installations), re-unzipped it, and tried to launch it without doing any of our usual configuration changes (e.g., enabling SSL, setting up a user for Manager). It still crashed exactly the same way. -- James H. H. Lampert - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: tomcat on windows 2012 weirdness
On Sat, Dec 13, 2014 at 1:06 AM, Christopher Schultz ch...@christopherschultz.net wrote: -BEGIN PGP SIGNED MESSAGE- Hash: SHA256 Cris, On 12/12/14 2:18 PM, Cris Berneburg - US wrote: Hi Chris Thanks for your replies. I am somewhat new to Tomcat, only been using it for 1 year, so some of the technical details are new to me. Is it possible that you are not using URL-based session ids, and that your browser has cookies disabled via a policy? I will need to check URL-based session ids. How do I check? If your browser has cookies disabled, then all the links on the web pages in this web application should have a ;jsessionid=[id] path parameter added to them. See below. Also, my browser does not have cookies disabled. This is almost certainly the issue. Chris, I think he meant cookies are already enabled on his browser. If your browser does not support cookies (Tomcat knows if you support cookies if you send a JSESSIONID cookie, but it can't tell if you send nothing), then the web application must fall-back to using URL-based session-tracking. Unfortunately, this isn't entirely auto-magical: the web application needs to support it properly. Most 3rd-party web applications should already be doing things properly, but if you have an in-house application, it may not be written properly. When emitting a URL onto a page for a client, the application needs to run the URL through a call to HttpServletResponse.encodeURL(String) or HttpServletResponse.encodeRedirectURL(String). These methods will add the ;jsessionid=[id] path parameter to the URL when the client does not support cookies. In this way, session-tracking will still work. If the application isn't doing this for *every URL in the whole application*, then sessions can be dropped and the user will have to re-authenticate. If this is the case, you only have two options: 1. Re-enable cookies on your browser 2. Review the application and fix every instance of a URL on a page (it's a huge job) Is the browser or the server (or both) on Windows 2012? The server is on Win 2012. It works OK when both the browser and server are the same 2012 VM. I don't know if it works when both client and server are both Win 2012 but different machines. I will be able to check that soon. It does not work with different client OS version and box than the server, but that may simply be coincidence. It may be a cookie policy: if localhost is trusted, the cookie policy may change. Try using a protocol sniffer to see if the browser is sending a session id to the server, and if the server is responding with a session id either before or after login. Wow, that sounds intimidating - never done that before. :-) It's worth learning how to do. I think there's a plug-in for MSIE called IEHeaders (or something similar). Install that and you can watch the conversation between client and server -- even when TLS is being used. If you are using IE9, it has a very useful utility in its developer tool to capture network traffic. Few simple steps to capture it: Press F12 -- Go to network tab-- start capturing You can save/export the captured data in an xml file and then can see everything going to-and-fro between your browser and server. Compare the traffic when you are communicating from localhost, which you say is working fine, with the traffic when you are accessing from an outside client. Pay special attention to the headers section of the HTTP calls. Hope that helps, - -chris -Original Message- From: Christopher Schultz [mailto:ch...@christopherschultz.net] Sent: Thursday, December 11, 2014 1:35 PM To: Tomcat Users List Subject: Re: tomcat on windows 2012 weirdness Cris, On 12/11/14 12:41 PM, Christopher Schultz wrote: Cris, On 12/11/14 11:28 AM, Cris Berneburg - US wrote: I'm having trouble with my JSP web app using Tomcat 6 and 7 on Windows Server 2012. The issue is that no matter what file I request in the browser URL, it always returns the app welcome file, that is, the login page. Even when requesting an image. The one exception is that after logging in, the main menu page appears, but none of the graphics or CSS files load. Clicking on the app links, it just brings up the welcome page again. Checking the Tomcat log files, I see that Tomcat is returning the welcome page instead of the files requested in the main menu page. Using the Tomcat manager, I see that my application has a ridiculous number of sessions, instead of just one. I interpret that for every single file requested, a new Tomcat session is being generated and possibly invalidated. FYI, using the same setup on Windows Server 2003 and 2008 works fine. Opening the same firewall ports on all three OS's has been done. Even disabling the firewall on 2012 does not affect the issue in any way. And to make things even weirder, accessing the
Re: Tomcat cluster with static membership
Hi Theo, Since you are using static membership and NOT dynamic(multi-cast) which auto-detect members, my current understanding says that you will have to add entry of all the members of your cluster in each of nodes server.xml. Example: My cluster has two nodes. So to configure these I had add these two members entries in both node's server.xml(since running on the same machine, they have varying port with same ip): Interceptor className=org.apache.catalina.tribes.group.interceptors.StaticMembershipInterceptor Member className=org.apache.catalina.tribes.membership.StaticMember port=4000 host=192.168.1.6 uniqueId={10,1,0,100,0,0,0,0,0,0,0,0,0,0,0,0}/ Member className=org.apache.catalina.tribes.membership.StaticMember port=4001 host=192.168.1.6 uniqueId={10,1,0,101,0,0,0,0,0,0,0,0,0,0,0,0}/ Regards, Ameer Mawia On Mon, Dec 8, 2014 at 8:26 PM, Théo Chamley theo...@mley.fr wrote: Hello, I am trying to setup a simple Tomcat cluster with static membership. I can't use multicast because I am on a virtualization environment that does not allow it. Debian 7 Tomcat 8.0.14 Oracle JVM 1.8.0_25 Both Tomcat are ok on their own, but I can't seem to make the clustering work: the sessions are not replicated from one to another. Following the official documentation, I wrote this configuration : Engine name=Catalina defaultHost=localhost Cluster className=org.apache.catalina.ha.tcp.SimpleTcpCluster Manager className=org.apache.catalina.ha.session. BackupManager expireSessionsOnShutdown=false notifyListenersOnReplication=true mapSendOptions=6/ Channel className=org.apache.catalina.tribes.group. GroupChannel Receiver className=org.apache. catalina.tribes.transport.nio.NioReceiver address=0.0.0.0 port=4110 selectorTimeout=100 maxThreads=6/ Interceptor className=org.apache.catalina.tribes.group. interceptors.StaticMembershipInterceptor Member className=org.apache. catalina.tribes.membership.StaticMember port=4110 host=my.server.1 domain=staging-cluster uniqueId={1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,0}/ /Interceptor Sender className=org.apache.catalina.tribes.transport. ReplicationTransmitter Transport className=org.apache. catalina.tribes.transport.nio.PooledParallelSender/ /Sender Interceptor className=org.apache.catalina.tribes.group. interceptors.TcpFailureDetector/ Interceptor className=org.apache.catalina.tribes.group. interceptors.MessageDispatch15Interceptor/ Interceptor className=org.apache.catalina.tribes.group. interceptors.ThroughputInterceptor/ /Channel Valve className=org.apache.catalina.ha.tcp.ReplicationValve filter=.*\.gif|.*\.js|.*\.jpeg|.*\.jpg|.*\.png|.*\.css|. *\.txt/ ClusterListener className=org.apache.catalina.ha.session. ClusterSessionListener/ /Cluster [...] /Engine Note: I changed the host and uniqId on the StaticMembershipInterceptor on the other Tomcat. This is not a network problem as I can telnet into the 4110 port from one server to another. Also, by running a tcpdump, I can't see any trafic between the two servers. The Tomcats seem to be doing something, because I have the following in my catalina.out: ** 08-Dec-2014 15:38:15.309 INFO [main] org.apache.catalina.ha.tcp.SimpleTcpCluster.startInternal Cluster is about to start 08-Dec-2014 15:38:15.312 INFO [main] org.apache.catalina.tribes.transport.ReceiverBase.bind Receiver Server Socket bound to:/0.0.0.0:4110 08-Dec-2014 15:38:15.328 INFO [Thread-5] org.apache.catalina.ha.tcp.SimpleTcpCluster.memberAdded Replication member added:org.apache.catalina.tribes.membership. StaticMember[t cp://my.server.1:4110,my.server.1,4110, alive=0, securePort=-1, UDP Port=-1, id={1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 0 }, payload={}, command={}, domain={115 116 97 103 105 110 103 45 99 ...(15)}, ] 08-Dec-2014 15:38:15.330 INFO [main] org.apache.catalina.tribes. membership.McastServiceImpl.setupSocket Setting cluster mcast soTimeout to 500 08-Dec-2014 15:38:15.332 INFO [main] org.apache.catalina.tribes. membership.McastServiceImpl.waitForMembers Sleeping for 1000 milliseconds to establish cluster membership, sta rt level:4 08-Dec-2014 15:38:16.155 INFO [Membership-MemberAdded.] org.apache.catalina.ha.tcp.SimpleTcpCluster.memberAdded Replication member added:org.apache.catalina.tribes.membership .MemberImpl[tcp://{0, 0, 0, 0}:4110,{0, 0, 0, 0},4110, alive=1277686, securePort=-1, UDP Port=-1, id={-22 -45 110 -29 21
Re: My problem: I cannot successfully get or set a session attribute from a JSP file.
On Sun, Dec 7, 2014 at 2:49 AM, Jim Anderson jim_ander...@centurylink.net wrote: Hi to all, I am currently developing some server side JSP code. By and large, things are progressing and working well. I have gotten half way decent at debugging my java/javascript/jquery/jsp/HTML source code, but I have run into a problem in JSP where the code does not work, but I have found no clues as to why it is not working. The environment that I am working in is Tomcat 7.0.54 and I am using java 1.8 and jquery 1.7.2. What I am trying to do: I have html code with an embedded javascript that runs jquery code. The jquery code being run makes an ajax call to a JSP file on the server side, which I will call s.jsp. This file is a very simple file whose sole function is to take a registration name and query an SQL database to see if the name has already been used at the web site. The registration name is passed with a method call that looks like this: regName = request.getParameter(registrationName);[item 1] This all works fine for me. So far so good. If the registration name is good, the state of my application logic changes. I guess there are multiple ways to store state, but I have chosen to store the state as a session variable. I searched the net and found an example of JSP code that uses the session object to store information as an attribute with a statement that looks something like: session.setAttribute(logicState,nameValidated); [item 2] I tried adding this line and when I now push the submit button of my HTML form, which calls s.jsp as an action, the application hangs (in firefox). I receive no error messages anywhere. Usually, when I add bad code in s.jsp I will get a stacktrace from firefox or error messages in the firefox debug console, or both. Or I will error message in my own homegrown debug code, but that does not happen. I know that my home grown code does not get called, so I can infer that the call to s.jsp is never made, but I cannot be 100% certain of this. I also checked my tomcat/logs directory and there was nothing in the log files that I would not expect. So my first question is: Can I simply add item 2, above, to my jsp file and expect that tomcat will recognize that I am referencing the session object? In s.jsp, item 1, above, references the request object and tomcat handles that and I am expecting that it will also hand my reference to the session object. This should work. Make sure, you don't have the session disable on your jsp i.e. your jsp don't have this directive: %@ page *session*=false % My second question is more general. My code is not working and there are no error messages. Can anyone speculate why this would be the case? Is there any place else I should be looking for error messages? There are many places to start debugging at. But first and foremost is your application logs. What does your application logs says? Any exception, corresponding stack-trace?? Jim A. - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: Tomcat giving more request to my application.
On Nov 28, 2014 12:08 PM, sarojkumar.ya...@ril.com wrote: Hello, I am using apache-tomcat-7.0.53 for my application (which is working on multithreading environment). To generate 10 requests with 500 concurrent, I am trying to use following command on my linux server: ab -n 10 -c 500 http://localhost:30080/ESME/StartupServlet?Source_Addr=%2B918895267182Destination_Addr=121short_message=recharge+111+asdrfgtyhu12+222SMS_ID=042040f1-a309-4901-b9f1-3e47bf41c7c2Received_Time=1416404203SmscID=smpp-NVMBD01VSR551MsgCode=0MsgChar=UTF-8MsgUDH= ” Excuse me for my ignorance. But what is ab. Your own custom client. In any case I will first cindier your client to be culprit, generating more request than you have expected. But at the output side, my application is receiving more than 10 requests. I have attached the configurations files. Kindly revert back if we are doing something wrong or if there is any solution available. Confidentiality Warning: This message and any attachments are intended only for the use of the intended recipient(s), are confidential and may be privileged. If you are not the intended recipient, you are hereby notified that any review, re-transmission, conversion to hard copy, copying, circulation or other use of this message and any attachments is strictly prohibited. If you are not the intended recipient, please notify the sender immediately by return email and delete this message and any attachments from your system. Virus Warning: Although the company has taken reasonable precautions to ensure no viruses are present in this email. The company cannot accept responsibility for any loss or damage arising from the use of this email or attachment. - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: How to setup rewrite valve for angularjs
Tay, Quickly glossing over the code, what I understand is, it is breaking while evaluating one of the conditions mentioned in your re-write rules: RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_URI} !index Basically it is trying to locate %{REQUEST_FILENAME}%, to evaluate these conditions. But that file path is being evaluated to NULL, and this confirm with your request: GET /web/ HTTP/1.1 500 2990 assuming your web is your application resource root, the path relative to this root is NULL. Can you please try, something like: GET /web/someXYZ.jsp and it should NOT complained about path being NULL. Once this is confirmed you can then find a way to handle this NULL path in re-write rule. Regards, Ameer Mawia On Mon, Nov 24, 2014 at 12:48 PM, Tay Kai Yang kaiyang@gmail.com wrote: Hi I have tried to add a / to index.jsp. The problem still persist. It consistently complained about resource path null. What is this resource that it is looking for? On Nov 24, 2014 2:25 PM, Ameer Mawia ameer.ma...@gmail.com wrote: On Nov 24, 2014 8:30 AM, Tay Kai Yang kaiyang@gmail.com wrote: Hi Daniel Thanks for the reply. I have not used a webapp META-INF/context.xml before. So I had tried to refer to online examples. This is what I did. - Create context.xml in webapp/META-INF - This is what I have added in context.xml - - ?xml version=1.0 encoding=UTF-8? - Context copyXML=true unpackWAR=true - Valve className=org.apache.catalina.valves.rewrite.RewriteValve/ - /Context My rewrite.config in webapp/WEB-INF RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_URI} !index RewriteRule (.*) index.jsp [L] And in my localhost.log 24-Nov-2014 10:39:56.163 FINE [localhost-startStop-1] org.apache.catalina.valves.rewrite.RewriteValve.startInternal Read configuration from: /WEB-INF/rewrite.config 24-Nov-2014 10:39:56.163 FINE [localhost-startStop-1] org.apache.catalina.valves.rewrite.RewriteValve.parse Add rule with pattern (.*) and substitution index.jsp 24-Nov-2014 10:39:56.163 FINE [localhost-startStop-1] org.apache.catalina.valves.rewrite.RewriteValve.parse Add condition !-f test %{REQUEST_FILENAME} to rule with pattern (.*) and substitution index.jsp 24-Nov-2014 10:39:56.163 FINE [localhost-startStop-1] org.apache.catalina.valves.rewrite.RewriteValve.parse Add condition !-d test %{REQUEST_FILENAME} to rule with pattern (.*) and substitution index.jsp 24-Nov-2014 10:39:56.163 FINE [localhost-startStop-1] org.apache.catalina.valves.rewrite.RewriteValve.parse Add condition !index test %{REQUEST_URI} to rule with pattern (.*) and substitution index.jsp Seems that all the required components starts up fine. But I received this error when i try to access http://localhost:8080/{webapp}/, it shows the following on the response. *type* Exception report *message* *The resource path [null] is not valid* *description* *The server encountered an internal error that prevented it from fulfilling this request.* *exception* java.lang.IllegalArgumentException: The resource path [null] is not valid org.apache.catalina.webresources.StandardRoot.validate(StandardRoot.java:237) org.apache.catalina.webresources.StandardRoot.getResource(StandardRoot.java:199) org.apache.catalina.webresources.StandardRoot.getResource(StandardRoot.java:193) org.apache.catalina.valves.rewrite.ResolverImpl.resolveResource(ResolverImpl.java:151) org.apache.catalina.valves.rewrite.RewriteCond$ResourceCondition.evaluate(RewriteCond.java:82) org.apache.catalina.valves.rewrite.RewriteCond.evaluate(RewriteCond.java:235) org.apache.catalina.valves.rewrite.RewriteRule.evaluate(RewriteRule.java:105) org.apache.catalina.valves.rewrite.RewriteValve.invoke(RewriteValve.java:311) org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79) org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:610) org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:526) org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1078) org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:655) org.apache.coyote.http11.Http11AprProtocol$Http11ConnectionHandler.process(Http11AprProtocol.java:277) org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.doRun(AprEndpoint.java:2381) org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.run(AprEndpoint.java:2370) java.util.concurrent.ThreadPoolExecutor.runWorker
Re: Tomcat 8 does not start with java 8 on YOSEMITE
Find my comment inline: On Mon, Nov 24, 2014 at 3:25 PM, Edoardo Panfili edoa...@aspix.it wrote: Il 24/11/14 10:04, Fabio Ricci ha scritto: Hi Ameer thank you again for the link to the JDK - But I had it already installed on my yosemite. This JDK 8.25 has also the spoken peculiarity. I am using Tomcat 8.0.15 with jdk1.8.0_25 on Yosemite and it works fine (only some troubles setting up the startup script). As I said, the issue lies ONLY with jdk/jre *1.8.0_40 EA* release. Try understand, the difference between 1.8.0_40 and release like 1.8.0_25. Both are java8 but different update release. 1.8.0_40 is an EARLY Access release and not officially released yet. You can expect things like this with an EA release. That why I said, go with a stable release, latest one available at oracle is 1.8.0_25 and that should work fine. I switched to Linux - there there seem to be less peculiarities as on osx. completely agree! I have verified 1.8.0_40 on window, it has issue to. I didn't got the chance to verify with Linux version of this release, but I guess, issue lies with all the platform of this release. Edoardo :) Kind regards / Meilleures salutations / Freundliche Grüsse Fabio Ricci semweb Semantic Web Technologies · Records Management Software systems · ICT coaching · ICT Projects leading www.semweb.ch Weinmanngasse 26 CH-8700 Küsnacht ZH (Switzerland) Tel. +41 (076) 5281961 +39 (389) 0681334 Skype: semweb-llc Confidentiality Warning: This message and any attachments are intended only for the use of the intended recipients, are confidential and maybe privileged. If you are not the intended recipient, you are hereby notified that any review, retransmission, conversion to hard copy, copying, circulation or other use of this message and any attachments is strictly prohibited. If you are not the intended recipient, please notify the sender immediately by return email, and delete this message and any attachments from your system. Thank you. From: Ameer Mawia ameer.ma...@gmail.com Reply: Tomcat Users List users@tomcat.apache.org Date: 24 November 2014 at 00:44:45 To: Tomcat Users List users@tomcat.apache.org Subject: Re: Tomcat 8 does not start with java 8 on YOSEMITE Hi Fabio, There seems to be an issue with update 40 Early Access release of jre/jdk8(1.8.0_40). Compared with update 20 of jre/jdk8 release, you will see following lines of code has been added to getPlatfromMBeanServer: for (final PlatformManagedObject o : ExtendedPlatformComponent.getMXBeans()) { if (!platformMBeanServer.isRegistered(o.getObjectName())) { addMXBean(platformMBeanServer, o); } But if you look into the accompanied rt.jar of the jre, this newly introduced class(ExtendedPlatformComponent) can NO-WHERE be found. This issue, seems to be there across all the JAVA_VERSION=1.8.0_40 EA release, irrespective of platform. Your remedy is to move back to a stable release. Latest stable release seems to be Java SE 8u25. Regards, Ameer Mawia On Sun, Nov 23, 2014 at 4:09 AM, Fabio Ricci fabio.ri...@semweb.ch wrote: Dear tomcat community Maybe someone did have this before (and possibly solved it) On a mac book pro/JOSEMITE I installed Java 8 1.8.0_40-ea with JDK. My $JAVA_HOME is /Library/Java/JavaVirtualMachines/jdk1.8.0_ 40.jdk/Contents/Home Then I downloaded a tomcat 8 core from http://tomcat.apache.org/ download-80.cgi When I start this tomcat 8 I get the following Java exceptio - see below. With this Java 8 also my older tomcat 7 throws the same exception. The official oracle java test page (https://www.java.com/en/ download/installed.jsp) says, I have already java uptodate. The exception: It seems that sun/management/ExtendedPlatformComponent be not part of tomcat 8 nor java 8 ... Does anyone have some hints for me? I cannot figure our what is wrong ... Thank you very much in advance! Kind regards Fabio PS: The exception on start (/bin/startup.sh): 22-Nov-2014 18:43:02.218 SEVERE [main] org.apache.tomcat.util.digester.Digester.startElement Begin event threw error java.lang.NoClassDefFoundError: sun/management/ ExtendedPlatformComponent at java.lang.management.ManagementFactory. getPlatformMBeanServer(ManagementFactory.java:494) at org.apache.tomcat.util.modeler.Registry. getMBeanServer(Registry.java:443) at org.apache.catalina.mbeans.MBeanUtils.createServer( MBeanUtils.java:580) at org.apache.catalina.mbeans.MBeanUtils.clinit( MBeanUtils.java:77) at org.apache.catalina.mbeans.GlobalResourcesLifecycleListen er.clinit(GlobalResourcesLifecycleListener.java:66) at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance( NativeConstructorAccessorImpl.java:62
Re: Tomcat 8 does not start with java 8 on YOSEMITE
Hi Fabio, There seems to be an issue with update 40 Early Access release of jre/jdk8(1.8.0_40). Compared with update 20 of jre/jdk8 release, you will see following lines of code has been added to getPlatfromMBeanServer: *for (final PlatformManagedObject o :* * ExtendedPlatformComponent.getMXBeans()) {* *if (!platformMBeanServer.isRegistered(o.getObjectName())) {* *addMXBean(platformMBeanServer, o);* *}* But if you look into the accompanied rt.jar of the jre, this newly introduced class(*ExtendedPlatformComponent*) can NO-WHERE be found. This issue, seems to be there across all the JAVA_VERSION=1.8.0_40 EA release, irrespective of platform. Your remedy is to move back to a stable release. Latest stable release seems to be Java SE 8u25 http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html . Regards, Ameer Mawia On Sun, Nov 23, 2014 at 4:09 AM, Fabio Ricci fabio.ri...@semweb.ch wrote: Dear tomcat community Maybe someone did have this before (and possibly solved it) On a mac book pro/JOSEMITE I installed Java 8 1.8.0_40-ea with JDK. My $JAVA_HOME is /Library/Java/JavaVirtualMachines/jdk1.8.0_40.jdk/Contents/Home Then I downloaded a tomcat 8 core from http://tomcat.apache.org/download-80.cgi When I start this tomcat 8 I get the following Java exceptio - see below. With this Java 8 also my older tomcat 7 throws the same exception. The official oracle java test page ( https://www.java.com/en/download/installed.jsp) says, I have already java uptodate. The exception: It seems that sun/management/ExtendedPlatformComponent be not part of tomcat 8 nor java 8 ... Does anyone have some hints for me? I cannot figure our what is wrong ... Thank you very much in advance! Kind regards Fabio PS: The exception on start (/bin/startup.sh): 22-Nov-2014 18:43:02.218 SEVERE [main] org.apache.tomcat.util.digester.Digester.startElement Begin event threw error * java.lang.NoClassDefFoundError: sun/management/ExtendedPlatformComponent* at java.lang.management.ManagementFactory.getPlatformMBeanServer(ManagementFactory.java:494) at org.apache.tomcat.util.modeler.Registry.getMBeanServer(Registry.java:443) at org.apache.catalina.mbeans.MBeanUtils.createServer(MBeanUtils.java:580) at org.apache.catalina.mbeans.MBeanUtils.clinit(MBeanUtils.java:77) at org.apache.catalina.mbeans.GlobalResourcesLifecycleListener.clinit(GlobalResourcesLifecycleListener.java:66) at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) at java.lang.reflect.Constructor.newInstance(Constructor.java:422) at java.lang.Class.newInstance(Class.java:442) at org.apache.tomcat.util.digester.ObjectCreateRule.begin(ObjectCreateRule.java:117) at org.apache.tomcat.util.digester.Digester.startElement(Digester.java:1184) at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.startElement(AbstractSAXParser.java:509) at com.sun.org.apache.xerces.internal.parsers.AbstractXMLDocumentParser.emptyElement(AbstractXMLDocumentParser.java:182) at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanStartElement(XMLDocumentFragmentScannerImpl.java:1343) at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(XMLDocumentFragmentScannerImpl.java:2786) at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:606) at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:510) at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:848) at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:777) at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:141) at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1213) at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(SAXParserImpl.java:649) at org.apache.tomcat.util.digester.Digester.parse(Digester.java:1457) at org.apache.catalina.startup.Catalina.load(Catalina.java:551) at org.apache.catalina.startup.Catalina.load(Catalina.java:599) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43
Re: How to setup rewrite valve for angularjs
? See the second option here... http://tomcat.apache.org/tomcat-8.0-doc/rewrite.html#Configuration It can also be in the context.xml of a webapp. The valve will then use a rewrite.config file containing the rewrite directives, it must be placed in the WEB-INF folder of the web application Have anyone written a tutorial or can point me to a source for how-to? The docs seem pretty thorough but if you need a tutorial you could look for a mod_rewrite tutorial. This valve is designed to be similar to mod_rewrite, so a tutorial for that should be mostly applicable here. Dan I am trying to set a single page angularjs app to point /context/path/path/... To /context/index.jsp Any idea on how to do that? Thanks. Kai yang -- Tay Kai Yang Mobile: (+65) 94879678 Email: kaiyang@gmail.com Skype: Kaiyang.Tay Regards, Ameer Mawia
Re: How to setup rewrite valve for angularjs
correction: On Nov 24, 2014 11:54 AM, Ameer Mawia ameer.ma...@gmail.com wrote: On Nov 24, 2014 8:30 AM, Tay Kai Yang kaiyang@gmail.com wrote: Hi Daniel Thanks for the reply. I have not used a webapp META-INF/context.xml before. So I had tried to refer to online examples. This is what I did. - Create context.xml in webapp/META-INF - This is what I have added in context.xml - - ?xml version=1.0 encoding=UTF-8? - Context copyXML=true unpackWAR=true - Valve className=org.apache.catalina.valves.rewrite.RewriteValve/ - /Context My rewrite.config in webapp/WEB-INF RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_URI} !index RewriteRule (.*) index.jsp [L] And in my localhost.log 24-Nov-2014 10:39:56.163 FINE [localhost-startStop-1] org.apache.catalina.valves.rewrite.RewriteValve.startInternal Read configuration from: /WEB-INF/rewrite.config 24-Nov-2014 10:39:56.163 FINE [localhost-startStop-1] org.apache.catalina.valves.rewrite.RewriteValve.parse Add rule with pattern (.*) and substitution index.jsp 24-Nov-2014 10:39:56.163 FINE [localhost-startStop-1] org.apache.catalina.valves.rewrite.RewriteValve.parse Add condition !-f test %{REQUEST_FILENAME} to rule with pattern (.*) and substitution index.jsp 24-Nov-2014 10:39:56.163 FINE [localhost-startStop-1] org.apache.catalina.valves.rewrite.RewriteValve.parse Add condition !-d test %{REQUEST_FILENAME} to rule with pattern (.*) and substitution index.jsp 24-Nov-2014 10:39:56.163 FINE [localhost-startStop-1] org.apache.catalina.valves.rewrite.RewriteValve.parse Add condition !index test %{REQUEST_URI} to rule with pattern (.*) and substitution index.jsp Seems that all the required components starts up fine. But I received this error when i try to access http://localhost:8080/{webapp}/, it shows the following on the response. *type* Exception report *message* *The resource path [null] is not valid* *description* *The server encountered an internal error that prevented it from fulfilling this request.* *exception* java.lang.IllegalArgumentException: The resource path [null] is not valid org.apache.catalina.webresources.StandardRoot.validate(StandardRoot.java:237) org.apache.catalina.webresources.StandardRoot.getResource(StandardRoot.java:199) org.apache.catalina.webresources.StandardRoot.getResource(StandardRoot.java:193) org.apache.catalina.valves.rewrite.ResolverImpl.resolveResource(ResolverImpl.java:151) org.apache.catalina.valves.rewrite.RewriteCond$ResourceCondition.evaluate(RewriteCond.java:82) org.apache.catalina.valves.rewrite.RewriteCond.evaluate(RewriteCond.java:235) org.apache.catalina.valves.rewrite.RewriteRule.evaluate(RewriteRule.java:105) org.apache.catalina.valves.rewrite.RewriteValve.invoke(RewriteValve.java:311) org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79) org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:610) org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:526) org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1078) org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:655) org.apache.coyote.http11.Http11AprProtocol$Http11ConnectionHandler.process(Http11AprProtocol.java:277) org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.doRun(AprEndpoint.java:2381) org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.run(AprEndpoint.java:2370) java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) java.lang.Thread.run(Thread.java:745) Taking hints from doc page, http://tomcat.apache.org/tomcat-8.0-doc/rewrite.html and your log, you seems to be missing path prex in your substitution string. Can you prefix /to index.jsp to your substituion string. That is: RewriteRule (.*) index.jsp [L] RewriteRule (.*) /index.jsp [L] Checking localhost_access.log gives me 127.0.0.1 - - [24/Nov/2014:10:42:18 +0800] GET /web/ HTTP/1.1 500 2990 I cannot figure out what is the problem, because I can't find anymore errors, or stacktrace in any of my logfiles, catalina.stderr etc... I can't find any information with regard to resource path [null]. What have I missed out? On Fri, Nov 21, 2014 at 8:28 PM, Daniel Mikusa dmik...@pivotal.io wrote: On Thu, Nov 20, 2014 at 9:08 PM, Tay Kai Yang kaiyang@gmail.com wrote: Hi I have been reading up tomcat 8's user doc. But I have some problems understanding the setup of rewrite valve
Re: Thread stucked at (java.net.SocketInputStream.socketRead0(Native Method))
Jaiswal, This issue is of connection between your host and postgresql server, you are trying to connect and has nothing to do with Tomcat per say. To debug the issue, you will have to answer few more question: Is your postgresql server responsive? Have you ever been able to get a valid connection during the lifetime of the application? Was it working for sometime, and then you suddenly start getting this issue...? Assuming you have isolated this thread correctly as one which is stuck(by taking multiple thread dump...) for how long it has been stuck? Is it ever coming out of that stuck state? Look into the state of tcp connection using netstat. Regards, Ameer Mawia On Sat, Nov 22, 2014 at 10:44 AM, Dhaval Jaiswal dhaval.jais...@via.com wrote: yes. the thread is stucked and started increasing load of the server. My configuration is as below. Query is fetching one row only. Resource name=jdbc auth=Container type=javax.sql.DataSource driverClassName=org.postgresql.Driver url=jdbc:postgresql maxActive=100 maxIdle=20 maxWait=3 validationQuery=select 1 testOnBorrow=true removeAbandoned=true removeAbandonedTimeout=120 logAbandoned=true / On Sat, Nov 22, 2014 at 1:29 AM, Ameer Mawia ameer.ma...@gmail.com wrote: Jaiswal, what your exact question is? Obviously in your application, you need a DB connection and if this is thread which is stuck, stack trace tells that tomcat dbcp, is trying to get you a connection, but stuck while reading the result of validate query which it had run before returning you a valid connection. Probably you can take a look at validation query, for now? Ideally it should be a very simple query, returning just one row and column. Regards, Ameer Mawia On Sat, Nov 22, 2014 at 12:30 AM, Dhaval Jaiswal dhaval.jais...@via.com wrote: Following thread stuck and increased the load. java.net.SocketInputStream.read(SocketInputStream.java:129) org.postgresql.core.VisibleBufferedInputStream.readMore(VisibleBufferedInputStream.java:145) org.postgresql.core.VisibleBufferedInputStream.ensureBytes(VisibleBufferedInputStream.java:114) org.postgresql.core.VisibleBufferedInputStream.read(VisibleBufferedInputStream.java:73) org.postgresql.core.PGStream.ReceiveChar(PGStream.java:274) org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:1660) org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:257) org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:500) org.postgresql.jdbc2.AbstractJdbc2Statement.executeWithFlags(AbstractJdbc2Statement.java:374) org.postgresql.jdbc2.AbstractJdbc2Statement.executeQuery(AbstractJdbc2Statement.java:254) org.apache.tomcat.dbcp.dbcp.DelegatingStatement.executeQuery(DelegatingStatement.java:208) org.apache.tomcat.dbcp.dbcp.PoolableConnectionFactory.validateConnection(PoolableConnectionFactory.java:332) org.apache.tomcat.dbcp.dbcp.PoolableConnectionFactory.validateObject(PoolableConnectionFactory.java:312) org.apache.tomcat.dbcp.pool.impl.GenericObjectPool.borrowObject(GenericObjectPool.java:991) org.apache.tomcat.dbcp.dbcp.AbandonedObjectPool.borrowObject(AbandonedObjectPool.java:84) org.apache.tomcat.dbcp.dbcp.PoolingDataSource.getConnection(PoolingDataSource.java:96) org.apache.tomcat.dbcp.dbcp.BasicDataSource.getConnection(BasicDataSource.java:880) com.eos.accounts.util.AccountsDatabaseManager.getConnection(Unknown Source) com.eos.accounts.util.AccountsDatabaseManager.getConnection(Unknown Source) com.eos.accounts.policies.PolicyManager.getAllPoliciesForUser(PolicyManager.java:62) com.eos.accounts.policies.Policies.loadAllPoliciesForUser(Policies.java:25) com.eos.accounts.data.User.createFromDataSet(User.java:3165) com.eos.accounts.data.User.getUserById(User.java:2878) com.eos.b2c.beans.GenericProductBean.setDeliveryDetails(GenericProductBean.java:320) com.eos.b2c.ui.ResellerNavigation.doGet(ResellerNavigation.java:2362) com.eos.b2c.ui.ResellerNavigation.doPost(ResellerNavigation.java:579) javax.servlet.http.HttpServlet.service(HttpServlet.java:710) javax.servlet.http.HttpServlet.service(HttpServlet.java:803) org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290) thread dump http-8080-2 daemon prio=10 tid=0x5335e000 nid=0x6d82 runnable [0x2b8b9a5c9000..0x2b8b9a5caa90] java.lang.Thread.State: RUNNABLE at java.net.SocketInputStream.socketRead0(Native Method) at java.net.SocketInputStream.read(SocketInputStream.java:129) at org.postgresql.core.VisibleBufferedInputStream.readMore(VisibleBufferedInputStream.java:145
Re: Thread stucked at (java.net.SocketInputStream.socketRead0(Native Method))
On Sat, Nov 22, 2014 at 4:03 PM, Dhaval Jaiswal dhaval.jais...@via.com wrote: Is your postgresql server responsive? Yes, there is no error logged in db server and server is very much responsive. Have you ever been able to get a valid connection during the lifetime of the application? Yes Was it working for sometime, and then you suddenly start getting this issue...? Yes. it happenes suddendly and sometime not always. Assuming you have isolated this thread correctly as one which is stuck(by taking multiple thread dump...) for how long it has been stuck? Many thread dump took, analyzed and says thread stuck while getting the connection from the db or trying to execute queries. Is it possible firewall dropping connection when Apps server trying to get the db connection. I don't think, firewall is an issue, as you said you are able to get connection successfully for sometime and this is happening only intermittently. Is it ever coming out of that stuck state? yes. However, number of threads are not coming down. How is it coming out? Does it throws SocketTimeOutException or does it return back normally returning a valid connection. But in any case, your thread is no lunger stuck. If number of thread is not coming down, it is because it must be busy doing other things. You can't expect the thread to die down just after getting a connection. It must proceed on doing other stuff in your code flow. Look into the state of tcp connection using netstat. 1 FIN_WAIT1 1 Foreign 1 established) 2 LAST_ACK 2 SYN_SENT 4 CLOSING 10 LISTEN 17 CLOSE_WAIT 116 TIME_WAIT 287 ESTABLISHED You can use below command to get the state of connection opened by your tomcat process: netstat -atp|grep pid of the tomcat process In any case, by the symptom you mentioned(connection hunged intermittently),I highly expect it is the postgresql server which is causing the issue. You should check the load at that specific time at your db server. Try connecting an alternate, probably back db server, to see is issue still exist, which I'm to certain extent sure, it will not. On Sat, Nov 22, 2014 at 3:08 PM, Ameer Mawia ameer.ma...@gmail.com wrote: Jaiswal, This issue is of connection between your host and postgresql server, you are trying to connect and has nothing to do with Tomcat per say. To debug the issue, you will have to answer few more question: Is your postgresql server responsive? Have you ever been able to get a valid connection during the lifetime of the application? Was it working for sometime, and then you suddenly start getting this issue...? Assuming you have isolated this thread correctly as one which is stuck(by taking multiple thread dump...) for how long it has been stuck? Is it ever coming out of that stuck state? Look into the state of tcp connection using netstat. Regards, Ameer Mawia On Sat, Nov 22, 2014 at 10:44 AM, Dhaval Jaiswal dhaval.jais...@via.com wrote: yes. the thread is stucked and started increasing load of the server. My configuration is as below. Query is fetching one row only. Resource name=jdbc auth=Container type=javax.sql.DataSource driverClassName=org.postgresql.Driver url=jdbc:postgresql maxActive=100 maxIdle=20 maxWait=3 validationQuery=select 1 testOnBorrow=true removeAbandoned=true removeAbandonedTimeout=120 logAbandoned=true / On Sat, Nov 22, 2014 at 1:29 AM, Ameer Mawia ameer.ma...@gmail.com wrote: Jaiswal, what your exact question is? Obviously in your application, you need a DB connection and if this is thread which is stuck, stack trace tells that tomcat dbcp, is trying to get you a connection, but stuck while reading the result of validate query which it had run before returning you a valid connection. Probably you can take a look at validation query, for now? Ideally it should be a very simple query, returning just one row and column. Regards, Ameer Mawia On Sat, Nov 22, 2014 at 12:30 AM, Dhaval Jaiswal dhaval.jais...@via.com wrote: Following thread stuck and increased the load. java.net.SocketInputStream.read(SocketInputStream.java:129) org.postgresql.core.VisibleBufferedInputStream.readMore(VisibleBufferedInputStream.java:145) org.postgresql.core.VisibleBufferedInputStream.ensureBytes(VisibleBufferedInputStream.java:114) org.postgresql.core.VisibleBufferedInputStream.read(VisibleBufferedInputStream.java:73) org.postgresql.core.PGStream.ReceiveChar(PGStream.java:274) org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:1660) org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:257
Re: Thread stucked at (java.net.SocketInputStream.socketRead0(Native Method))
Jaiswal, what your exact question is? Obviously in your application, you need a DB connection and if this is thread which is stuck, stack trace tells that tomcat dbcp, is trying to get you a connection, but stuck while reading the result of validate query which it had run before returning you a valid connection. Probably you can take a look at validation query, for now? Ideally it should be a very simple query, returning just one row and column. Regards, Ameer Mawia On Sat, Nov 22, 2014 at 12:30 AM, Dhaval Jaiswal dhaval.jais...@via.com wrote: Following thread stuck and increased the load. java.net.SocketInputStream.read(SocketInputStream.java:129) org.postgresql.core.VisibleBufferedInputStream.readMore(VisibleBufferedInputStream.java:145) org.postgresql.core.VisibleBufferedInputStream.ensureBytes(VisibleBufferedInputStream.java:114) org.postgresql.core.VisibleBufferedInputStream.read(VisibleBufferedInputStream.java:73) org.postgresql.core.PGStream.ReceiveChar(PGStream.java:274) org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:1660) org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:257) org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:500) org.postgresql.jdbc2.AbstractJdbc2Statement.executeWithFlags(AbstractJdbc2Statement.java:374) org.postgresql.jdbc2.AbstractJdbc2Statement.executeQuery(AbstractJdbc2Statement.java:254) org.apache.tomcat.dbcp.dbcp.DelegatingStatement.executeQuery(DelegatingStatement.java:208) org.apache.tomcat.dbcp.dbcp.PoolableConnectionFactory.validateConnection(PoolableConnectionFactory.java:332) org.apache.tomcat.dbcp.dbcp.PoolableConnectionFactory.validateObject(PoolableConnectionFactory.java:312) org.apache.tomcat.dbcp.pool.impl.GenericObjectPool.borrowObject(GenericObjectPool.java:991) org.apache.tomcat.dbcp.dbcp.AbandonedObjectPool.borrowObject(AbandonedObjectPool.java:84) org.apache.tomcat.dbcp.dbcp.PoolingDataSource.getConnection(PoolingDataSource.java:96) org.apache.tomcat.dbcp.dbcp.BasicDataSource.getConnection(BasicDataSource.java:880) com.eos.accounts.util.AccountsDatabaseManager.getConnection(Unknown Source) com.eos.accounts.util.AccountsDatabaseManager.getConnection(Unknown Source) com.eos.accounts.policies.PolicyManager.getAllPoliciesForUser(PolicyManager.java:62) com.eos.accounts.policies.Policies.loadAllPoliciesForUser(Policies.java:25) com.eos.accounts.data.User.createFromDataSet(User.java:3165) com.eos.accounts.data.User.getUserById(User.java:2878) com.eos.b2c.beans.GenericProductBean.setDeliveryDetails(GenericProductBean.java:320) com.eos.b2c.ui.ResellerNavigation.doGet(ResellerNavigation.java:2362) com.eos.b2c.ui.ResellerNavigation.doPost(ResellerNavigation.java:579) javax.servlet.http.HttpServlet.service(HttpServlet.java:710) javax.servlet.http.HttpServlet.service(HttpServlet.java:803) org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290) thread dump http-8080-2 daemon prio=10 tid=0x5335e000 nid=0x6d82 runnable [0x2b8b9a5c9000..0x2b8b9a5caa90] java.lang.Thread.State: RUNNABLE at java.net.SocketInputStream.socketRead0(Native Method) at java.net.SocketInputStream.read(SocketInputStream.java:129) at org.postgresql.core.VisibleBufferedInputStream.readMore(VisibleBufferedInputStream.java:145) at org.postgresql.core.VisibleBufferedInputStream.ensureBytes(VisibleBufferedInputStream.java:114) at org.postgresql.core.VisibleBufferedInputStream.read(VisibleBufferedInputStream.java:73) at org.postgresql.core.PGStream.ReceiveChar(PGStream.java:274) at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:1660) at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:257) - locked 0x2b881d689760 (a org.postgresql.core.v3.QueryExecutorImpl) at org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:500) at org.postgresql.jdbc2.AbstractJdbc2Statement.executeWithFlags(AbstractJdbc2Statement.java:374) at org.postgresql.jdbc2.AbstractJdbc2Statement.executeQuery(AbstractJdbc2Statement.java:254) at org.apache.tomcat.dbcp.dbcp.DelegatingStatement.executeQuery(DelegatingStatement.java:208) at org.apache.tomcat.dbcp.dbcp.PoolableConnectionFactory.validateConnection(PoolableConnectionFactory.java:332) at org.apache.tomcat.dbcp.dbcp.PoolableConnectionFactory.validateObject(PoolableConnectionFactory.java:312) at org.apache.tomcat.dbcp.pool.impl.GenericObjectPool.borrowObject(GenericObjectPool.java:991) at org.apache.tomcat.dbcp.dbcp.AbandonedObjectPool.borrowObject(AbandonedObjectPool.java:84) at org.apache.tomcat.dbcp.dbcp.PoolingDataSource.getConnection
Re: Problem when rebooting....
Hi Bjorn, I'm looking into the issue(I had been longing to contribute to community and I see some opportunity to start doing so here. Hope my effort will be welcomed!:) ) I'm looking at the code base in trunk. Here is the method where localhost-startstop thread is busy: protected void processAnnotationsFile(File file, WebXml fragment, //line 1963 boolean handlesTypesOnly) { if (file.isDirectory()) { // Returns null if directory is not readable String[] dirs = file.list();//line 1968 if (dirs != null) { for (String dir : dirs) { processAnnotationsFile(//line 1971 new File(file,dir), fragment, handlesTypesOnly); } } } else if (file.canRead() file.getName().endsWith(.class)) { try (FileInputStream fis = new FileInputStream(file)) { processAnnotationsStream(fis, fragment, handlesTypesOnly); } catch (IOException e) { log.error(sm.getString(contextConfig.inputStreamFile, file.getAbsolutePath()),e); } catch (ClassFormatException e) { log.error(sm.getString(contextConfig.inputStreamFile, file.getAbsolutePath()),e); } } } As you can see and as konstantin said, the thread is busy walking over directories listed in web-fragements. Here it is from where it is being called: protected void processAnnotations(SetWebXml fragments, boolean handlesTypesOnly) { for(WebXml fragment : fragments) { // Only need to scan for @HandlesTypes matches if any of the // following are true: // - it has already been determined only @HandlesTypes is required // (e.g. main web.xml has metadata-complete=true // - this fragment is for a container JAR (Servlet 3.1 section 8.1) // - this fragment has metadata-complete=true boolean htOnly = handlesTypesOnly || !fragment.getWebappJar() || fragment.isMetadataComplete(); WebXml annotations = new WebXml(); // no impact on distributable annotations.setDistributable(true); URL url = fragment.getURL(); processAnnotationsUrl(url, annotations, htOnly);// This in turn calls processAnnotationsFile SetWebXml set = new HashSet(); set.add(annotations); // Merge annotations into fragment - fragment takes priority fragment.merge(set); } } I'will let you know, as soon as I come to some concrete understanding. Meanwhile you can take a look at various web-fragments in your web-application. Regards, Ameer Mawia, New Delhi On Mon, Nov 10, 2014 at 4:55 AM, Bjørn T Johansen b...@havleik.no wrote: On Sun, 09 Nov 2014 23:49:54 +0100 André Warnier a...@ice-sa.com wrote: Bjørn T Johansen wrote: On Mon, 10 Nov 2014 00:35:46 +0300 Konstantin Kolinko knst.koli...@gmail.com wrote: Rules: http://tomcat.apache.org/lists.html#tomcat-users - 6. Do not top-post. Ok, did a thread dump that resulted in the following dump..: Full thread dump Java HotSpot(TM) 64-Bit Server VM (25.25-b02 mixed mode): localhost-startStop-1 #15 daemon prio=5 os_prio=0 tid=0x7fdc84002000 nid=0x702 runnable [0x7fdc8ebe7000] java.lang.Thread.State: RUNNABLE at java.io.UnixFileSystem.checkAccess(Native Method) at java.io.File.canRead(File.java:768) at org.apache.catalina.startup.ContextConfig.processAnnotationsFile(ContextConfig.java:1975) at org.apache.catalina.startup.ContextConfig.processAnnotationsFile(ContextConfig.java:1971) As it is visible from the method name, the start thread is busy scanning classes for annotations. This behaviour is explained here: https://wiki.apache.org/tomcat/HowTo/FasterStartUp#General But it never finishes? And also I do not have this problem when stopping and starting the Tomcat server without booting, why is that? Shouldn't the result be the same? http://en.wikipedia.org/wiki/Entropy_%28computing%29 Maybe your problem is there ? (When the system boots, it has little entropy available, and it may already be consumed by other processes starting around the same time). Hmm... Guess I'll havce to check it out... Thx... :) BTJ - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: Where do System.out and System.err go in Tomcat?
Hi, Tomcat by default dump both console output and error in catalina.out under tomcat-home/log directory. But you can change it any day by modifying startup script catalina.sh/catalina.bat in *nix environment or catalina.bat in bin directory of tomcat home. Regards, Ameer Mawia On Oct 10, 2014 2:19 PM, M. D. mo...@abv.bg wrote: Hello devs, I saw this post on the Internet: http://www.jguru.com/faq/view.jsp?EID=302980 Where do System.out and System.err go in Tomcat? By default, they will go to the console where the tomcat is started. You have to modify the startup scripts to redirect them to appropriate files. See Tomcat Mailing List for a discussion on how to redirect the System.out and System.err. On the other hand, if you are running Tomcat as an NT Service, you can modify the conf/wrapper.properties file and set wrapper.stdout and wrapper.stderr properties to point to your log files. So... what do I have to do in order so that Tomcat5 can redirect System.err to logfile instead of just the console. Best regards, Marin - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: Where do System.out and System.err go in Tomcat?
Btw if you want the console logs from your application to go in your application log file, then in that case you have to add a console appender to your log4j configuation file(assuming you are infact using log4j). On Oct 10, 2014 3:37 PM, Ameer Mawia ameer.ma...@gmail.com wrote: sorry for typos. In catalina.sh in *nix environment and catalina.bat in windows environment. Regards, Ameer Mawia On Oct 10, 2014 3:35 PM, Ameer Mawia ameer.ma...@gmail.com wrote: Hi, Tomcat by default dump both console output and error in catalina.out under tomcat-home/log directory. But you can change it any day by modifying startup script catalina.sh/catalina.bat in *nix environment or catalina.bat in bin directory of tomcat home. Regards, Ameer Mawia On Oct 10, 2014 2:19 PM, M. D. mo...@abv.bg wrote: Hello devs, I saw this post on the Internet: http://www.jguru.com/faq/view.jsp?EID=302980 Where do System.out and System.err go in Tomcat? By default, they will go to the console where the tomcat is started. You have to modify the startup scripts to redirect them to appropriate files. See Tomcat Mailing List for a discussion on how to redirect the System.out and System.err. On the other hand, if you are running Tomcat as an NT Service, you can modify the conf/wrapper.properties file and set wrapper.stdout and wrapper.stderr properties to point to your log files. So... what do I have to do in order so that Tomcat5 can redirect System.err to logfile instead of just the console. Best regards, Marin - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: Where do System.out and System.err go in Tomcat?
sorry for typos. In catalina.sh in *nix environment and catalina.bat in windows environment. Regards, Ameer Mawia On Oct 10, 2014 3:35 PM, Ameer Mawia ameer.ma...@gmail.com wrote: Hi, Tomcat by default dump both console output and error in catalina.out under tomcat-home/log directory. But you can change it any day by modifying startup script catalina.sh/catalina.bat in *nix environment or catalina.bat in bin directory of tomcat home. Regards, Ameer Mawia On Oct 10, 2014 2:19 PM, M. D. mo...@abv.bg wrote: Hello devs, I saw this post on the Internet: http://www.jguru.com/faq/view.jsp?EID=302980 Where do System.out and System.err go in Tomcat? By default, they will go to the console where the tomcat is started. You have to modify the startup scripts to redirect them to appropriate files. See Tomcat Mailing List for a discussion on how to redirect the System.out and System.err. On the other hand, if you are running Tomcat as an NT Service, you can modify the conf/wrapper.properties file and set wrapper.stdout and wrapper.stderr properties to point to your log files. So... what do I have to do in order so that Tomcat5 can redirect System.err to logfile instead of just the console. Best regards, Marin - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org