Re: Database related performance degradation after upgrading from Tomcat 9.0.33 to Tomcat 9.0.69
Thanks everyone for the information and advice. Thanks to you we were able to track this down to a specific version of Tomcat and DBCP. Simply copying tomcat-dbcp.jar file from Tomcat 9.0.38 to Tomcat 9.0.33 and running Tomcat 9.0.33 results in the slowness. This means that the issue was introduced in DBCP 2.8.0-SNAPSHOT 6d232e5. Using the tomcat-dbcp.jar file from Tomcat 9.0.72 results in the same slowness as Tomcat 9.0.38, so that means that the newest version of DBCP 2.10.0-SNAPSHOT f131286 has not fixed the problem. It does sound like https://issues.apache.org/jira/browse/DBCP-558 has introduced the problem with latency. Based on the linked Pull Request <https://github.com/apache/commons-dbcp/pull/35> and implementation of com.mysql.jdbc.ConnectionImpl it looks like calling `connection.isReadOnly()` results in an extra trip to the database. Based on implementation of com.mysql.jdbc.ConnectionImpl, providing an extra parameter in connection URL: `useLocalSessionState=true` fixes the performance problem in Tomcat 9.0.69. Without providing the extra `useLocalSessionState=true` parameter in connection URL, copying tomcat-dbcp.jar file from Tomcat 9.0.33 to Tomcat 9.0.69 also fixes the database performance in Tomcat 9.0.69 and it does not seem to be causing any problems at first sight, so we have found the culprit and we have 2 potential workarounds: - Use tomcat-dbcp.jar file from Tomcat 9.0.33 in Tomcat 9.0.69, or - Append `useLocalSessionState=true` param to connection URL A few follow up questions: - Which of the two workarounds would be more recommended? Would there be any problems with mismatching tomcat-dbcp.jar version or with using the useLocalSessionState parameter? - Since the solution in the Pull Request seems to result in a considerable performance hit, would that be considered an issue or necessary evil? Should we expect such an issue to be fixed in the future or do we just need to adjust and live with it? - Out of curiosity, has anyone else here noticed such database connection performance degradation between these versions of Tomcat (essentially between 9.0.37 or earlier, and 9.0.38 or later)? Since DBCP 2.8.0 was released in 2020-09-21 and Tomcat 9.0.38 was released in 2020-08-11, it's a bit strange that this issue was not reported previously by anyone. Thank you, Artur Tomusiak On Wed, Feb 22, 2023 at 12:43 PM Mark Thomas wrote: > On 22/02/2023 04:58, Konstantin Kolinko wrote: > > ср, 22 февр. 2023 г. в 01:31, Artur Tomusiak - Hannon Hill > > : > >> > >> After upgrading from Tomcat 9.0.33 to Tomcat 9.0.69, > > > > Note that using a binary search (bisection) one could limit the version > range. > > Relevant version information is: > > 9.0.71 - DBCP f131286 2.10.0-SNAPSHOT 2022-12-30 > 9.0.53 - DBCP 2abdb49 2.9.02021-08-03 > 9.0.42 - DBCP e24196a 2.9.0-SNAPSHOT 2021-01-15 > 9.0.38 - DBCP 6d232e5 2.8.0-SNAPSHOT 2020-08-11 > 9.0.30 - DBCP a363906 2.8.0-SNAPSHOT 2019-12-06 > > > > Alternatively, it is possible to reconfigure the pool to use Apache > > Commons DBCP 2 and Apache Commons Pool 2 directly (instead of > > package-renamed version used by Tomcat), and bisect their version > > ranges. > > Given Tomcat's tendency to update to specific commits rather than > releases, bisecting Tomcat versions is probably easier. > > Does your database provide any form of debug logging? The additional > commands should be easy to spot in such a log. > > Changes to autoCommit and readOnly handling in 9.0.38 could result in > additional database calls. See > https://issues.apache.org/jira/browse/DBCP-558 > > I don't see anything else obvious in the change history but a debug log > for the connection is likely to be the quickest way to see what is going > on. > > Mark > > - > To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org > For additional commands, e-mail: users-h...@tomcat.apache.org > >
Database related performance degradation after upgrading from Tomcat 9.0.33 to Tomcat 9.0.69
After upgrading from Tomcat 9.0.33 to Tomcat 9.0.69, jobs in our application that execute lots of quick database queries end up being visibly slower - 16% slower on average in a typical setup where a database is on a local area network. Here is additional information we have confirmed: - This is not specific to operating system (tested on Linux and MacOS) - This is not related to database vendors (tested on MySQL and Oracle) - This is not related to our software (identical code runs on different versions of Tomcat) - This is related to database connection latency as opposed to the speed of the database or the app - the longer the database latency, the more significant the slowdown is. When testing with a local database on the same machine, there is no performance hit between the two versions of Tomcat. When testing with a database on another network across the Internet (very high latency), the job running on Tomcat 9.0.69 is about 50% slower than Tomcat 9.0.33. - This might be coincidental, but based on the number of queries the job executes and the database connection latency, it appears as if each database query required 2 additional network trips to the database on Tomcat 9.0.69 as compared to Tomcat 9.0.33. - For example, if a job executes about 37,000 queries, and the database connection latency is about 0.15 ms, the job ends up being about 11 seconds slower on Tomcat 9.0.69 than Tomcat 9.0.33 based on our tests. This seems to add up to 2 extra network trips per query because 37,000 queries * 0.15 ms/trip * 2 extra trips/query = 11,100 ms = 11.1 s. - Another example is when testing with a db connection over the Internet (25 ms latency) and a job that executes 1,231 queries, that job is more or less 60 seconds slower on Tomcat 9.0.69 than Tomcat 9.0.33 based on our tests. Again, if we assumed that there are extra 2 trips to the database per query, this adds up: 1,231 queries * 25 ms/trip * 2 extra trips/query = 61,550 ms = 61.55 s. We are suspecting that the slowness comes from around getting a database connection from the connection pool, though we spotted an occasional slowness around transaction committing as well. Here is our database connection configuration in context.xml file: Is this a known issue? If not, is there any additional information I could provide to help troubleshoot or replicate the problem? Thank you, Artur Tomusiak
It seems Tomcat shares libraries between web applications
Hello, I installed Tomcat using apache-tomcat-9.0.54.exe, configured server.xml to set up a database connection as Resource in GlobalNamingResources section. Tomcat\webapps directory has two web applications, let's say X and Y. Both should connect to Oracle database using ojdbc driver. Tomcat\lib has only libraries installed by default, there is no ojdbc*.jar here. By a mistake I added ojdbc8-21.7.0.0.jar only for webapp X, so Y did not have JDBC driver at all. But both web apps connected to the database, while Y should not connect. I verified tomcat directory content using "dir ojdbc*.jar /s" inside installation folder, it found only 2 ojdbc*.jar locations: 1) tomcat\webapps\X\WEB-INF\lib, 2) tomcat\temp\1-X\WEB-INF\lib. According to https://tomcat.apache.org/tomcat-9.0-doc/class-loader-howto.html app Y should not get a JDBC driver, that only exists in X lib directory. I added a Java parameter "-verbose:class", it logged loading class OracleDriver from file tomcat/temp/1-X/WEB-INF/lib/ojdbc8-21.7.0.0.jar - only from this file, so there was no other jdbc driver. I made following actions: a) stop Tomcat service, b) delete "tomcat\webapps\X" and "tomcat\webapps\X.war", c) start Tomcat. The result was "java.lang.ClassNotFoundException: oracle.jdbc.OracleDriver" for app Y. So app Y really got ojdbc library from app X: if I copy X.war to tomcat\webapps, then app Y immediately can connect to a database. Apache Tomcat versions: I spotted it on 9.0.54, after upgrade to 9.0.68 observed same behaviour. Java version is 1.8.0_202 (Oracle build). OS: Windows 10 21H2. How app Y can get a library from app X? Is tomcat\temp shared between web applications? --- Best regards Artur Swat - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
How to debug deployment process of my application in IntelliJ IDEA
I'm learning how Spring MVC works. I'd like to debug the process of deployment on different containers (using IntelliJ) as well as how my application works after deployment. I created the simplest application possible. It does nothing except registering dispatcher servlet. Now I set breakpoint somewhere in my servlet and debug application. It stops as expected. When I click on frames of my thread, I can download sources of spring (because the dependencies are in my pom.xml). These framed have yellow background in default IntelliJ Theme. There are also frames with white background. The ones with black foreground belong to my application. The ones with grey letters are from org.apache.catalina. I can't view corresponding source code because it's not been attached. When I edit configurations, I can configure application server and add source code. I downloaded matching tomcat source code and added it in Application Servers windows. IntelliJ added these directories as source code. Unfortunatelly I still can't see the source code. What shall I do to see the source code of tomcat? I'm using tomcat 8.
Re: Restart problem
Hi Charles, thank you for your tip. I solved now my problem. My application waited for a service wich was not initialized before the application. A classical deadlock which of course do not appear when I start Tomcat first (with the needed service) and then deploy my application ;-) kind regards Artur Osmanov 2010/10/20 Caldarale, Charles R chuck.caldar...@unisys.com From: Artur Osmanov [mailto:a.osma...@52north.org] Subject: Restart problem But if I stop Tomcat and start it again Tomcat hangs and nothing works anymore. Have you tried taking a thread dump? Tomcat version: Apache Tomcat/6.0.29 with default configuration Windows 7 Professional 64bit hibernate 3.5.2 postgresql 8.3 JVM version? Running Tomcat from scripts or as a service? - Chuck THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY MATERIAL and is thus for use only by the intended recipient. If you received this in error, please contact the sender and delete the e-mail and its attachments from all computers. - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org -- Artur Osmanov 52°North GmbH | Martin-Luther-King-Weg 24 | D - 48155 Muenster | phone +49 (0)251.396371-0 | http://52north.org/
Restart problem
Hello Tomcat users, I have a big problem with Tomcat after restart. I try to solve this problem some days and can not find any solution for it: When I start Tomcat and copy the *.war file of my application to the webapps folder everything is fine. Tomcat deploys the application as normal. Everything runs. But if I stop Tomcat and start it again Tomcat hangs and nothing works anymore. It is a GWT application. I also use hibernate and postgresql as database. I have really no idea where the problem is. None of my servlets starts, no exceptions, nothing... The only solution I have by now is to stop Tomcat and delete the application folder and the *.war from the webapps folder. Start Tomcat and then copy the *.war again to the webapps folder. But it is not a solution for a production system. I hope someone can help me with my problem. Log file entry is below. Tomcat version: Apache Tomcat/6.0.29 with default configuration Windows 7 Professional 64bit hibernate 3.5.2 postgresql 8.3 kind regards Artur Osmanov log entry after tomcat stop 19.10.2010 20:43:17 org.apache.coyote.http11.Http11Protocol pause INFO: Pausing Coyote HTTP/1.1 on http-8080 19.10.2010 20:43:18 org.apache.catalina.core.StandardService stop INFO: Stopping service Catalina 19.10.2010 20:43:18 org.apache.catalina.loader.WebappClassLoader clearReferencesJdbc SCHWERWIEGEND: The web application [/ThinSweClient2.0_Beta] registered the JBDC driver [org.postgresql.Driver] but failed to unregister it when the web application was stopped. To prevent a memory leak, the JDBC Driver has been forcibly unregistered. 19.10.2010 20:43:18 org.apache.catalina.loader.WebappClassLoader clearReferencesThreads SCHWERWIEGEND: The web application [/ThinSweClient2.0_Beta] appears to have started a thread named [Timer-0] but has failed to stop it. This is very likely to create a memory leak. 19.10.2010 20:43:18 org.apache.catalina.loader.WebappClassLoader clearReferencesThreads SCHWERWIEGEND: The web application [/ThinSweClient2.0_Beta] appears to have started a thread named [Timer-1] but has failed to stop it. This is very likely to create a memory leak. 19.10.2010 20:43:18 org.apache.catalina.loader.WebappClassLoader clearThreadLocalMap SCHWERWIEGEND: The web application [/ThinSweClient2.0_Beta] created a ThreadLocal with key of type [org.apache.xmlbeans.XmlBeans$1] (value [org.apache.xmlbeans.xmlbean...@5fcfad77]) and a value of type [java.lang.ref.SoftReference] (value [java.lang.ref.softrefere...@3b8590c5]) but failed to remove it when the web application was stopped. This is very likely to create a memory leak. 19.10.2010 20:43:18 org.apache.catalina.loader.WebappClassLoader clearThreadLocalMap SCHWERWIEGEND: The web application [/ThinSweClient2.0_Beta] created a ThreadLocal with key of type [org.apache.xmlbeans.impl.schema.SchemaTypeLoaderImpl$1] (value [org.apache.xmlbeans.impl.schema.schematypeloaderimp...@3de3940a]) and a value of type [java.util.ArrayList] (value [[java.lang.ref.softrefere...@280c3c44]]) but failed to remove it when the web application was stopped. This is very likely to create a memory leak. 19.10.2010 20:43:18 org.apache.catalina.loader.WebappClassLoader clearThreadLocalMap SCHWERWIEGEND: The web application [/ThinSweClient2.0_Beta] created a ThreadLocal with key of type [org.apache.xmlbeans.impl.store.CharUtil$1] (value [org.apache.xmlbeans.impl.store.charuti...@3b48a8e6]) and a value of type [java.lang.ref.SoftReference] (value [java.lang.ref.softrefere...@1f48b272]) but failed to remove it when the web application was stopped. This is very likely to create a memory leak. 19.10.2010 20:43:18 org.apache.catalina.loader.WebappClassLoader clearReferencesThreads SCHWERWIEGEND: The web application [/SES-2010] appears to have started a thread named [SES-ScheduledTermination-Worker-Thread] but has failed to stop it. This is very likely to create a memory leak. 19.10.2010 20:43:18 org.apache.catalina.loader.WebappClassLoader clearThreadLocalMap SCHWERWIEGEND: The web application [/SES-2010] created a ThreadLocal with key of type [org.apache.xmlbeans.XmlBeans$1] (value [org.apache.xmlbeans.xmlbean...@d38d2fc]) and a value of type [java.lang.ref.SoftReference] (value [java.lang.ref.softrefere...@da3a52c]) but failed to remove it when the web application was stopped. This is very likely to create a memory leak. 19.10.2010 20:43:18 org.apache.catalina.loader.WebappClassLoader clearThreadLocalMap SCHWERWIEGEND: The web application [/SES-2010] created a ThreadLocal with key of type [org.apache.xmlbeans.impl.store.Locale$1] (value [org.apache.xmlbeans.impl.store.local...@72b0f2b2]) and a value of type [java.lang.ref.SoftReference] (value [java.lang.ref.softrefere...@3f0dbef1]) but failed to remove it when the web application was stopped. This is very likely to create a memory leak. 19.10.2010 20:43:18 org.apache.catalina.loader.WebappClassLoader clearThreadLocalMap SCHWERWIEGEND: The web application [/SES-2010] created a ThreadLocal with key
Re: DefaultServlet, allowLinking, symbolic links do not work
Mark wrote: Tomcat version? I think I recall some issues with this on older versions. I installed 6.0.14 and it works, thank you for help. Best regards, Artur - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Why DefaultServlet listing does not work
The way the default servlet works, if it isn't mapped to '/', it won't work properky. Thanks, with that mapping it works. - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Why DefaultServlet listing does not work
Hello. I have the following servlet definition: servlet servlet-nameListings/servlet-name servlet-classorg.apache.catalina.servlets.DefaultServlet/servlet-class init-param param-namedebug/param-name param-value0/param-value /init-param init-param param-namelistings/param-name param-valuetrue/param-value /init-param load-on-startup1/load-on-startup /servlet servlet-mapping servlet-nameListings/servlet-name url-pattern/listings/url-pattern /servlet-mapping It did say resource not available until I created a directory `listings' in the application directory. Then it become to show an empty directory listing. I then created various files in the directory, but the directory listing was still empty, even after page reload. What did I wrong? Best regards, Artur - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Why DefaultServlet listing does not work
Is not the listings option in apps' web.xml enough? I wanted the app to decide if it allows listings of its servlet. - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Java source encoding
What do you need source files stored inside war file for? I don't need them them there. The conversion of characters is at compile time, of course. I have mistaken this. Thank you. Best regards, Artur - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Java source encoding
Hello, can I specify the encoding of java source files in the war file? Best regards, Artur - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Context.xml error
On 7/10/07, Caldarale, Charles R [EMAIL PROTECTED] wrote: From: Artur Rataj [mailto:[EMAIL PROTECTED] Subject: Re: Context.xml error I have a web app that has servlets on /library/*, and want tomcat to also display some directory listing under /files or something like that. Directory listings are handled by the DefaultServlet, normally controlled by the value of the listings parameter in the servlet declaration in Tomcat's conf/web.xml file. This should be set to false to prevent obtaining listings from arbitrary directories. In your webapp's WEB-INF/web.xml, try adding another servlet declaration with a different servlet-name but the same servlet-class as the normal DefaultServlet, and set its listings parameter to true. Then add a servlet-mapping for your renamed DefaultServlet with a url-pattern that covers just the directories you want to display. But is not url-pattern defining the page address, and not a listed directory? Also, would not the page address still be under /library/*, and not under /files? Artur - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Context.xml error
On 7/9/07, Caldarale, Charles R [EMAIL PROTECTED] wrote: What are you actually trying to accomplish? I have a web app that has servlets on /library/*, and want tomcat to also display some directory listing under /files or something like that. Artur - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Context.xml error
On 7/8/07, Mark Thomas [EMAIL PROTECTED] wrote: Because each context.xml file can oly define a single context. So, if an app has additional context for some directory listing, where it should be defined? Artur - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Context.xml error
) at org.apache.catalina.startup.ContextConfig.processContextConfig(ContextConfig.java:800) at org.apache.catalina.startup.ContextConfig.contextConfig(ContextConfig.java:736) at org.apache.catalina.startup.ContextConfig.init(ContextConfig.java:1005) at org.apache.catalina.startup.ContextConfig.lifecycleEvent(ContextConfig.java:279) at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:117) at org.apache.catalina.core.StandardContext.init(StandardContext.java:5297) at org.apache.catalina.core.StandardContext.start(StandardContext.java:4070) at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:791) at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:771) at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:525) at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:920) at org.apache.catalina.startup.HostConfig.deployDirectories(HostConfig.java:883) at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:492) at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1138) at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:311) at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:117) at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1053) at org.apache.catalina.core.StandardHost.start(StandardHost.java:719) at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045) at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443) at org.apache.catalina.core.StandardService.start(StandardService.java:516) at org.apache.catalina.core.StandardServer.start(StandardServer.java:710) at org.apache.catalina.startup.Catalina.start(Catalina.java:566) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:288) at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:413) 2007-07-07 11:23:06 org.apache.catalina.startup.ContextConfig processContextConfig SEVERE: Occurred at line 20 column 2 Could you tell me why? Best regards, Artur - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Mod_jk and Kernel Panic - not syncing: Attempting to free lock on active lock list
Hello, We are running Red Hat Enterprise Linux ES (v. 4 for AMD64/Intel EM64T) as an Web server with Apache (2.2.4 compiled from sources) connected through mod_jk (1.2.21 compiled from sources) to tomcat server(5.5.17). Everything is installed on IBM x346 with 3GB of RAM and Xeon 3Ghz CPU. The kernel is 2.6.9-42.0.10.ELsmp from rpm package. After upgrading from mod_jk 1.2.18 to mod_jk 1.2.21, during heavy load in work hours sometimes server hangs with message: Kernel Panic - not syncing: Attempting to free lock on active lock list and it stops responding to anything. After restarting it can work for several hours without any problem but suddenly it hangs. We suspect that new mod_jk is the reason. Now we are back on mod_jk 1.2.18 and problem doesn't occur during last 30 hours. This problem occures on several identical machines (IBM x346), so it's not a hardware dependent. Below is our configuration, maybe you have any suggestions to change something for better performance. ### worker.properties worker.list=worker4,jkstatus worker.worker2.type=ajp13 worker.worker2.host=localhost worker.worker2.port=8009 worker.worker2.lbfactor=1 worker.worker2.socket_timeout=60 worker.worker2.connection_pool_timeout=300 worker.worker3.type=ajp13 worker.worker3.host=localhost worker.worker3.port=8109 worker.worker3.lbfactor=1 worker.worker3.socket_timeout=60 worker.worker3.connection_pool_timeout=300 worker.jkstatus.type=status worker.worker4.type=lb worker.worker4.sticky_session=true worker.worker4.balance_workers=worker2,worker3 ### worker.properties ### httpd.conf # # worker MPM IfModule mpm_worker_module ServerLimit 64 StartServers 20 MaxClients 960 MinSpareThreads 20 MaxSpareThreads 100 ThreadsPerChild 15 MaxRequestsPerChild 3 /IfModule ### httpd.conf # server.xml ### Connector port=8009 redirectPort=8433 secure=true connectionTimeout=0 threadPriority=25 connectionUploadTimeout=0 connectionLinger=0 maxSpareThreads=100 maxThreads=500 maxKeepAliveRequests=250 disableUploadTimeout=false uRIEncoding=ISO-8859-2 tcpNoDelay=false minSpareThreads=4 acceptCount=6 protocol=AJP/1.3 /Connector server.xml ### Thanks in advance for any help. Best regards Artur - To start a new topic, e-mail: [EMAIL PROTECTED] To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
A disk directory context without cache
Hello. How to configure a context that displays the contents of a given disk directory, but without it being cached? I tried this, but it does not work at all, i. e. I get an error message from tomcat when trying to access /disk. Context path=/disk docBase=/home/lib/disk/ reloadable=true Logger className=org.apache.catalina.logger.FileLogger Source code of org.apache.catalina.logger.FileLogger prefix=localhost_examples_log. suffix=.txt timestamp=true/ Ejb name=ejb/EmplRecord type=Entity home=com.wombat.empl.EmployeeRecordHome remote=com.wombat.empl.EmployeeRecord/ Environment name=maxExemptions type=java.lang.Integer Source code of java.lang.Integer value=15/ Parameter name=context.param.name value=context.param.value override=false/ Resource name=jdbc/EmployeeAppDb auth=SERVLET type=javax.sql.DataSource Source code of javax.sql.DataSource/ /Context - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: A disk directory context without cache
I have just copied the context from another one in the default configuration file. On 3/21/07, Mikolaj Rydzewski [EMAIL PROTECTED] wrote: Artur Rataj wrote: Context path=/disk docBase=/home/lib/disk/ reloadable=true Logger className=org.apache.catalina.logger.FileLogger Source code of org.apache.catalina.logger.FileLogger prefix=localhost_examples_log. suffix=.txt timestamp=true/ Ejb name=ejb/EmplRecord type=Entity home=com.wombat.empl.EmployeeRecordHome remote=com.wombat.empl.EmployeeRecord/ Where can I read about Ejb/ element? I cannot find it in the docs. -- Mikolaj Rydzewski [EMAIL PROTECTED] - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: A disk directory context without cache
Please help me. I tried this: Context path=/disk docBase=/home/lib/disk debug=0 reloadable=true /Context with various combinations of slashes, with a symlink etc. it all gives 404 when trying http://address/disk - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: A disk directory context without cache
Thank you for help, it was indeed the listings setting in web.xml that needed to be changed. Now it works ok. Artur - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Contexts in Tomcat 6, why does not work
Hello. I upgrade some webapp to Tomcat 6. The app has three contexts, one for dynamic pages, one for some disk directory. I put them into the server.xml file on the new Tomcat, into the Host part. Here are the first two contexts, that is, one for the servlets and one for some disk directory. Context path= docBase=library debug=0 reloadable=true Logger className=org.apache.catalina.logger.FileLogger prefix=localhost_examples_log. suffix=.txt timestamp=true/ Ejb name=ejb/EmplRecord type=Entity home=com.wombat.empl.EmployeeRecordHome remote=com.wombat.empl.EmployeeRecord/ Environment name=maxExemptions type=java.lang.Integer value=15/ Parameter name=context.param.name value=context.param.value override=false/ Resource name=jdbc/EmployeeAppDb auth=SERVLET type=javax.sql.DataSource/ /Context Context path=/informacja_ekspresowa docBase=/home/library/islib/Informacja_Ekspresowa/ reloadable=true Logger className=org.apache.catalina.logger.FileLogger prefix=localhost_examples_log. suffix=.txt timestamp=true/ Ejb name=ejb/EmplRecord type=Entity home=com.wombat.empl.EmployeeRecordHome remote=com.wombat.empl.EmployeeRecord/ Environment name=maxExemptions type=java.lang.Integer value=15/ Parameter name=context.param.name value=context.param.value override=false/ Resource name=jdbc/EmployeeAppDb auth=SERVLET type=javax.sql.DataSource/ /Context The first context seems to be working fine, the second one does not work even that the given directory exists. The error message is: HTTP Status 404 - /informacja_ekspresowa/ type Status report message /informacja_ekspresowa/ description The requested resource (/informacja_ekspresowa/) is not available. Apache Tomcat/6.0.9 Why the second context does not work? The respective directory /home/library/islib/Informacja_Ekspresowa exists, and the user that runs tomcat can read from it. Thanks, Artur - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Mod_jk balancing, session problem
Choose the suggested access log methods to improve observability (URLs and Cookie and Set-Cookie Headers. We make some tests with error log set to debug, but it is so many informations in the log (even the decrypted password !!, should it be so ??) that it may take some time to analyse everything. But here I have another question about the errors reported by JK status manager. In our production environment we have log level set to error and there are about 200 requests per worker shown by JK status manager as error , but there isn't any line in the mod_jk.log with error. Why is that so ? Another question is about tomcat catalina.out. Please find below a cut from log: 2006-08-10 06:17:20 org.apache.jk.core.MsgContext action WARNING: Error sending end packet java.net.SocketException: Broken pipe at java.net.SocketOutputStream.socketWrite0(Native Method) at java.net.SocketOutputStream.socketWrite(SocketOutputStream.java:92) at java.net.SocketOutputStream.write(SocketOutputStream.java:136) at org.apache.jk.common.ChannelSocket.send(ChannelSocket.java:518) at org.apache.jk.common.JkInputStream.endMessage(JkInputStream.java:112) at org.apache.jk.core.MsgContext.action(MsgContext.java:293) at org.apache.coyote.Response.action(Response.java:182) at org.apache.coyote.Response.finish(Response.java:304) at org.apache.jk.server.JkCoyoteHandler.invoke(JkCoyoteHandler.java:204) at org.apache.jk.common.HandlerRequest.invoke(HandlerRequest.java:282) at org.apache.jk.common.ChannelSocket.invoke(ChannelSocket.java:754) at org.apache.jk.common.ChannelSocket.processConnection(ChannelSocket.java:684) at org.apache.jk.common.ChannelSocket$SocketConnection.runIt(ChannelSocket.java:876) at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684) at java.lang.Thread.run(Thread.java:595) 2006-08-10 06:17:20 org.apache.jk.common.ChannelSocket processConnection WARNING: processCallbacks status 2 2006-08-10 08:38:53 org.apache.jk.core.MsgContext action WARNING: Error sending end packet java.net.SocketException: Broken pipe at java.net.SocketOutputStream.socketWrite0(Native Method) at java.net.SocketOutputStream.socketWrite(SocketOutputStream.java:92) at java.net.SocketOutputStream.write(SocketOutputStream.java:136) at org.apache.jk.common.ChannelSocket.send(ChannelSocket.java:518) at org.apache.jk.common.JkInputStream.endMessage(JkInputStream.java:112) at org.apache.jk.core.MsgContext.action(MsgContext.java:293) at org.apache.coyote.Response.action(Response.java:182) at org.apache.coyote.Response.finish(Response.java:304) at org.apache.jk.server.JkCoyoteHandler.invoke(JkCoyoteHandler.java:204) at org.apache.jk.common.HandlerRequest.invoke(HandlerRequest.java:282) at org.apache.jk.common.ChannelSocket.invoke(ChannelSocket.java:754) at org.apache.jk.common.ChannelSocket.processConnection(ChannelSocket.java:684) at org.apache.jk.common.ChannelSocket$SocketConnection.runIt(ChannelSocket.java:876) at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684) at java.lang.Thread.run(Thread.java:595) 2006-08-10 08:38:53 org.apache.jk.common.ChannelSocket processConnection WARNING: processCallbacks status 2 2006-08-10 08:57:51 org.apache.jk.core.MsgContext action WARNING: Error sending end packet java.net.SocketException: Broken pipe at java.net.SocketOutputStream.socketWrite0(Native Method) at java.net.SocketOutputStream.socketWrite(SocketOutputStream.java:92) at java.net.SocketOutputStream.write(SocketOutputStream.java:136) at org.apache.jk.common.ChannelSocket.send(ChannelSocket.java:518) at org.apache.jk.common.JkInputStream.endMessage(JkInputStream.java:112) at org.apache.jk.core.MsgContext.action(MsgContext.java:293) at org.apache.coyote.Response.action(Response.java:182) at org.apache.coyote.Response.finish(Response.java:304) at org.apache.jk.server.JkCoyoteHandler.invoke(JkCoyoteHandler.java:204) at org.apache.jk.common.HandlerRequest.invoke(HandlerRequest.java:282) at org.apache.jk.common.ChannelSocket.invoke(ChannelSocket.java:754) at org.apache.jk.common.ChannelSocket.processConnection(ChannelSocket.java:684) at org.apache.jk.common.ChannelSocket$SocketConnection.runIt(ChannelSocket.java:876) at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684) at java.lang.Thread.run(Thread.java:595) 2006-08-10 08:57:51 org.apache.jk.common.ChannelSocket processConnection WARNING: processCallbacks status 2 Do you have any idea what my be the reason ? Best regards Artur -- View this message in context: http://www.nabble.com/Mod_jk-balancing%2C-session-problem-tf2073073.html#a5765997 Sent from
Re: Mod_jk balancing, session problem
Rainer Jung-3 wrote: What do you mean by losing sessions? I expect you mean users work in a session and then they send a request and get a response indicating, that the requested session has not been found? Thats exactly what I meant. If so: - does it happen in times, when you get errors in the mod_jk-log? Does it happen at all times, or do you have peaks at special times? I can't figure it out, when this happens, but there isn't any special moment I can observe. It happens randomly. There isn't any error in mod_jk.log - if it happens even when there's no other problem at the same time: You can also add a request log to mod_jk, that logs, which worker has beend chosen for every request. That way you do not rely on your user feedback, but can measure the problem yourself (how many users/sessions, what time of day etc.). And here I need some help. In mod_jk.log I always see the same worker - balancer worker, so I don't know which worker has been choosen. How can I change it ? I assume by adding request log to mod_jk you mean something like this: # JkRequestLogFormat set the request format JkRequestLogFormat %w %V %T Of course sticky_session is set to true. Below I paste our config files. Please help if you only can. Best regards Artur ###Jk status for one day: Name TypejvmRouteHostAddrStatD F M V Acc Err Wr Rd BusyMax RR Cd worker2 ajp13 worker2 localhost:8009 127.0.0.1:8009 OK 0 1 1 2144824825 512 480M 5.8G6 138 worker3 worker3 is in the original output and has iónly been removed by your copypaste? Right What was happening, when you got these 2144 Errors? The time stamps should be available from the mod_jk log. Loosing session occurs even when there arnen't any errors in mod_jk status manager, it just looks like with next request you have to log in once more. ###httpd.mpm section: # worker MPM # StartServers: initial number of server processes to start # MaxClients: maximum number of simultaneous client connections # MinSpareThreads: minimum number of worker threads which are kept spare # MaxSpareThreads: maximum number of worker threads which are kept spare # ThreadsPerChild: constant number of worker threads in each server process # MaxRequestsPerChild: maximum number of requests a server process serves IfModule mpm_worker_module StartServers 5 MaxClients 448 MinSpareThreads 5 MaxSpareThreads 25 ThreadsPerChild 7 MaxRequestsPerChild 0 /IfModule Interesting, very few ThreadsPerChild. Not really a problem, but I wonder if this is efficient. We have decresed this value because we thought that maybe Apache is opening too many threads to Tomcat. We had in Tomcat's log entries saying All threads (500) are curently busy, increase maxThreds. Think about using connect_timeout and prepost_timeout. Maybe also set recovery_options to 3. What values do you suggest for above parameters ? -- View this message in context: http://www.nabble.com/Mod_jk-balancing%2C-session-problem-tf2073073.html#a5710742 Sent from the Tomcat - User forum at Nabble.com. - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: ClassLoader IllegalStateException
One of the reasons might be that you have stray threads that do not stop when Tomcat tries to stop. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: ClassLoader IllegalStateException
It might that it unloaded an app. You may turn off app unloading/reloading in serwer.xml. Or start and stop threads using listeners. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: ClassLoader IllegalStateException
To turn it off, set reloadable=false in the context definition of your app. I do not know where you have it defined, it might be tomcat's server.xml or context.xml of your app. I am not sure if it will work -- I have used applications listeners to stop the threads, which was very easy. Artur - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Strange servlet exception
Now, I changed the name of the method, adding an underscore before it, clean and rebuild in Netbeans worked fine, the WAR worked in the tomcat bundled with Netbeans, yet, copying the WAR to any other tomcat I tried causes now: javax.servlet.ServletException: Servlet execution threw an exception root cause java.lang.NoSuchMethodError: org.algstoch.httpuserlib.Password._removeUserId(Ljavax/servlet/http/HttpSession;)V servlets.LoginScreenServlet.processRequest(LoginScreenServlet.java:33) servlets.LoginScreenServlet.doGet(LoginScreenServlet.java:110) javax.servlet.http.HttpServlet.service(HttpServlet.java:689) javax.servlet.http.HttpServlet.service(HttpServlet.java:802) How can it be, if the WAR works with the Tomcat in netbeans? - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
A simple question about creating a thread in Tomcat app
Hello! I would like, just after tomcat starts, to create a new thread. Where can I put the code that starts it? I do not want to wait with starting the thread until some servlet is needed. Best regards, Artur - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: A simple question about creating a thread in Tomcat app
Thanks for help, Artur - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
STrange problem with a thread made in Servlet.init()
I made a servlet that starts on startup, and in its init() method a new thread is started. The thread reads from a FS and uses JDBC, yet, it does not work, as many errors similar to that occur: Feb 22, 2006 5:26:27 PM org.apache.catalina.loader.WebappClassLoader loadClass INFO: Illegal access: this web application instance has been stopped already. Could not load java.util.Scanner. The eventual following stack trace is caused by an error thrown for debugging purposes as well as to attempt to terminate the thread which caused the illegal access, and has no functional impact. java.lang.IllegalStateException at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1238) at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1198) at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319) at org.algstoch.trafficlogger.Logger.init(Logger.java:50) at logger.LoggerThread.run(LoggerThread.java:35) If the same thread is run outside webapp, it works ok. What can it be? Best regards, Artur - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: STrange problem with a thread made in Servlet.init()
On 2/22/06, David Smith [EMAIL PROTECTED] wrote: Hmmm A very verbose exception message. Can we see the code that threw the exception? Are there any other exceptions in the logs before this one? There is a servlet that loads on start up. In its init(ServletConfig config) is a code starting a new thread: LoggerThread loggerThread = new LoggerThread(); loggerThread.start(); the run() method of the LoggerThread is as follows: public void run() { try { try { String fifoName = MapTable.get(tlog_conf, feed-fifo); System.out.println(LoggerThread: feed fifo name is ` + fifoName + '); Logger logger = new Logger(fifoName, 1000*10); } catch(IOException e) { throw new IOException(Could not start traffic logger thread: + e.toString()); } catch(SQLException e) { throw new IOException(Could not start traffic logger thread: + e.toString()); } } catch(IOException e) { System.out.println(e.toString()); } } It is being developed, and no proper error handling is done yet. The constructor of Logger is in an infinite loop that scans fifo output. The last line of the code shown causes the error: public Logger(String namedPipe, int reportPeriod) throws IOException { InputStream in; try { in = new FileInputStream(namedPipe); } catch(FileNotFoundException e) { throw new IOException(Could not open pipe: + e.toString()); } Scanner scanner = new Scanner(in); The catalina.out log up to the error is as follows: Feb 22, 2006 5:26:02 PM org.apache.coyote.http11.Http11BaseProtocol init INFO: Initializing Coyote HTTP/1.1 on http-8080 Feb 22, 2006 5:26:02 PM org.apache.catalina.startup.Catalina load INFO: Initialization processed in 1852 ms Feb 22, 2006 5:26:02 PM org.apache.catalina.core.StandardService start INFO: Starting service Catalina Feb 22, 2006 5:26:02 PM org.apache.catalina.core.StandardEngine start INFO: Starting Servlet Engine: Apache Tomcat/5.5.15 Feb 22, 2006 5:26:02 PM org.apache.catalina.core.StandardHost start INFO: XML validation disabled LoggerThread: feed fifo name is `/home/art/fifo' Exception in thread HSQLDB Timer @dc57db java.lang.NullPointerException at org.hsqldb.lib.HsqlTimer.nextTask(Unknown Source) at org.hsqldb.lib.HsqlTimer$TaskRunner.run(Unknown Source) at java.lang.Thread.run(Thread.java:595) Feb 22, 2006 5:26:07 PM org.apache.coyote.http11.Http11BaseProtocol start INFO: Starting Coyote HTTP/1.1 on http-8080 Feb 22, 2006 5:26:07 PM org.apache.jk.common.ChannelSocket init INFO: JK: ajp13 listening on /0.0.0.0:8009 Feb 22, 2006 5:26:07 PM org.apache.jk.server.JkMain start INFO: Jk running ID=0 time=0/50 config=null Feb 22, 2006 5:26:07 PM org.apache.catalina.storeconfig.StoreLoader load INFO: Find registry server-registry.xml at classpath resource Feb 22, 2006 5:26:07 PM org.apache.catalina.startup.Catalina start INFO: Server startup in 5577 ms As you can see, HSQLDB, that worked correctly before adding the thread, started to misbehave for some reason, too. Best regards, Artur - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: STrange problem with a thread made in Servlet.init()
I replaced HttpServlet.init() with a listener, do both startup/shutdown of the thread, and also shut down HSQLDB not before VM shutdown, but in the listener. And now the thread works OK, and these error messages are gone. Best regards, Artur - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: A simple question about creating a thread in Tomcat app
I had some problems with the thread run in init(), that I described in the thread `STrange problem with a thread made in Servlet.init()'. Now I use the listeners with both startup/shutdown of the thread. Best regards, Artur - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Strange servlet exception
Hello! I am developing a web app inside netbeans, and it worked until the following servlet exception began to appear: javax.servlet.ServletException: Servlet execution threw an exception root cause java.lang.NoClassDefFoundError: javax/servlet/http/HttpSession org.algstoch.httpuserlib.Password.removeUserId(Password.java:118) servlets.LoginScreenServlet.processRequest(LoginScreenServlet.java:31) servlets.LoginScreenServlet.doGet(LoginScreenServlet.java:108) javax.servlet.http.HttpServlet.service(HttpServlet.java:689) javax.servlet.http.HttpServlet.service(HttpServlet.java:802) The platform is Java 1.6.0b2, tomcat 5.5.13. The methods pass HttpSession object until some method tries to call session.removeAttribute(), what throws the NoClassDefFoundException. The class is inside servlet-api.jar in tomcat, and inside the war because some library needs it to compile within netbeans, and netbeans propagates compile-time libraries to all categories. What can be the reason of it? Thanks, Artur - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Strange servlet exception
Thank you for help. It was the tomcat web app that was putting the servlet-api-jar into war. I corrected it and the app works ok again. Artur - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Strange servlet exception
The error is there again. javax.servlet.ServletException: Servlet execution threw an exception root cause java.lang.NoClassDefFoundError: javax/servlet/http/HttpSession org.algstoch.httpuserlib.Password.removeUserId(Password.java:118) servlets.LoginScreenServlet.processRequest(LoginScreenServlet.java:31) servlets.LoginScreenServlet.doGet(LoginScreenServlet.java:108) javax.servlet.http.HttpServlet.service(HttpServlet.java:689) javax.servlet.http.HttpServlet.service(HttpServlet.java:802) It also appears with other calls to session. servlet_api.jar is now included once. So perhaps it was not the reason. What it might be? Tomcat would not work without HttpSession, yet it says no class def found. I guess it is some kind of bug because it appeared probably just after I changed some unimportant string in the app. Artur - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Strange servlet exception
More details: 1. The jars within the war do not have servlet_api.jar, too. 2. The method session.removeAttribute() works OK in servlets.LoginScreenServlet.processRequest, but in the method called by processRequest it throws the exception. 3. processRequest is in the netbeans webapp, and removeUserId is in a library, included in the war as a jar. 4. It looked as if just calling removeUserId(HttpSession session) from processRequest() caused the error, because println() in the first line of the method did not show in catalina.out. Artur - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Strange servlet exception
5. And the error occurs also with Java 1.5 and Tomcat 5.5.15. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]