Re: Working dir incorrect tomcat 9.10?
Ok, thanks for the clarification and of course there are multiple ways to solve this; I just ran in to problems since the behaviour seemed to have changed between the versions but I've upgrade the whole stack from OS to java to tomcat so its was hard to isolate the change and I made the wrong assumption that the CWD was set to CATALINA_BASE. With your information I got to the root of why the CWD has changed to '/' and it was a simple as I had not set a home dir for the tomcat9 user and thus the user-dir was automatically set to '/' when the systemd-script started tomcat as the tomcat9 user.. Br, Kalle - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: Sticky sessions not working at get_most_suitable_worker
-BEGIN PGP SIGNED MESSAGE- Hash: SHA256 Carlos, On 6/30/18 4:12 AM, Carlos García wrote: > I' m working on a LB configuration with Apache/2.4.18 (Ubuntu) > mod_jk/1.2.41 and not getting wanted results. > > > My workers config is: > > > worker.list=balanceFFG, jk-status # tomcat-pro-03 por COLT > worker.FFG1.host=tomcat-pro-03 worker.FFG1.port=8009 > worker.FFG1.type=ajp13 worker.FFG1.sticky_session=true > > # tomcat-pro-06 por COLT worker.FFG2.host=tomcat-pro-06 > worker.FFG2.port=8010 worker.FFG2.type=ajp13 > worker.FFG2.sticky_session=true > > worker.balanceFFG.type=lb worker.balanceFFG.balance_workers=FFG1, > FFG2 worker.jk-status.type=status Thank you for posting your configuration. You need to set the sticky_session attribute on the *balancer* and not on the individual workers, although the default value for "sticky_session" is in fact "true", so this should not matter. If you look at your mod_jk log file, does it say that sticky_session isn't valid for a normal AJP13 worker? (It really should if it doesn't.) > VirtualHost config is: > > Header edit Set-Cookie "^(.*; Path=)/ffgonzalezarch_pro/?(.*)" > $1/$2 What is *this* for? > RewriteEngine on RewriteRule ^(.*)$ /ffgonzalezarch_pro$1 [PT,L] > RewriteRule ^(.*)$ /ffgonzalezarch_pro/$1 [CO] > > JkMount /ffgonzalezarch_pro/* balanceFFG > > > jvmRoute set in Engine section in Tomcat server.xml What did you set it/them to? > And finally, this is the result in mod_jk debug log: > > > [Sat Jun 30 06:52:29.565 2018] [6628:139806621300480] [debug] > service::jk_lb_worker.c (1270): service sticky_session=1 > id='7E9778933D54A11F3D91B9AF81653C53.tomcat-pro-06' [Sat Jun 30 > 06:52:29.565 2018] [6628:139806621300480] [debug] > get_most_suitable_worker::jk_lb_worker.c (1078): searching worker > for partial sessionid > 7E9778933D54A11F3D91B9AF81653C53.tomcat-pro-06 [Sat Jun 30 > 06:52:29.565 2018] [6628:139806621300480] [debug] > get_most_suitable_worker::jk_lb_worker.c (1086): searching worker > for session route tomcat-pro-06 [Sat Jun 30 06:52:29.565 2018] > [6628:139806621300480] [debug] > get_most_suitable_worker::jk_lb_worker.c (1136): found best worker > FFG1 (FFG1) using method 'Request' > > So, a session from FFG2(omcat-pro-06) ends in FFG1(tomcat-pro-03). > Why!! Sessionid is telling you FFG2(omcat-pro-06)!! It looks like you have set jvmRoute to "tomcat-pro-06" and "tomcat-pro-03" but the worker's route names default to the worker names (FFG1, FFG2). So, you either need this in workers.properties: worker.FFG1.route=tomcat-pro-03 and worker.FFG2.route=tomcat-pro-06 or you need this in conf/server.xml and Hope that helps, - -chris -BEGIN PGP SIGNATURE- Comment: GPGTools - http://gpgtools.org Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQIzBAEBCAAdFiEEMmKgYcQvxMe7tcJcHPApP6U8pFgFAls34kQACgkQHPApP6U8 pFhJRw/+JWWNWq4Vp+dMGo6YmeTcYJfRdaUiIjw3vCZxl8fDh9UBGufvQO44I1QO RuH0X155zb0csN3THWyA15pWicFLt3XNdjZIzy9X3J2K7E366wD7GJtmP/bm+ua8 LaEkwx/Iu2jADWn/FRl6k58m+xXk9LUWWpLw0YJGE2Go/PXFM9ZAsBLHi9sdPQlW xAotxkqopP4lx5CGtUARRP66cygsQQltUKbLyUhwnP4gKJgN27hw+mRuSf86H+Kh 2aXJSdDHkulgdFOBauZzVzUgctAcDi0vkxzjLmHApgCTUzQ5KHu8ChqZstOR4jaO h3g0QJzuvcGmtlZfCJte6U2YhoCgDVgIaN106BnJ1UlFICqmvi8leERTG5Da1Blx HbTi1sVxytYhm/troPNgTAnnYGRDQqtPxuFq33jZHHvHGZvSGbZYxPtb8bqTL+x6 x1vB5jhqC5mmA5on/UG+B6Xzb12BbaluJ8TLkd/HW4MiiLnX04/nkCsw2WaZAqee TJLg7cIBMeNM3H7EPlghuN9FnGeTnZgD5xRmJZOCGXvtp3DPT0JbE5I56nj0oowQ SD9qzoMDE+krdwz5B+0ZtXql/GixEsxW3S/szUQO6e2Z4YdrliHlaWnWTh9d6ezg rDxkPWrYCBOOe3XO6nSqKsgehCdZgv5yqdG3AZeRIE9eSZ+aXRs= =IF98 -END PGP SIGNATURE- - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: Working dir incorrect tomcat 9.10?
-BEGIN PGP SIGNED MESSAGE- Hash: SHA256 Konstantin, On 6/30/18 11:49 AM, Konstantin Kolinko wrote: > 2018-06-30 12:55 GMT+03:00 Carl-Henrik Tjärnlund > : >> Hi! I'm in the process of upgrading from tomcat 8 to 9 and was >> running into a probelm with velocity not beeing able to create >> the default log file, ./velocity.log and after some >> troubleshooting it seems it is trying to create it in the root of >> the file system instead of the current working directory, which i >> thought would be CATALINA_BASE. >> >> I just did some test and logging in the webapp: >> >> log.info("Working path: " + new File(".").getAbsolutePath()); >> >> would report "Working path: /. And I could do a workaround by >> creating /velocity.log manually and give the tomcat9 user >> ownership. > > Or you could do System.getProperty("user.dir"). Or put -Duser.dir=[whatever] in CATALINA_BASE/bin/setenv.sh > Tomcat does not care what the current working directory is when > you launch it. All it cares is the value of system properties > "catalina.home" and "catalina.base". > > (The well known environment variables CATALINA_HOME, CATALINA_BASE > are used by catalina.sh/catalina.bat scripts to set those system > properties when launching Java process for Tomcat). +1 Moreover, Tomcat does not alter the CWD from whatever process launched i t. > If your logging configuration supports substitution of environment > variables, use one of those variables explicitly, e.g. as > "${catalina.base}/logs" (see the default conf/logging.properties > in Tomcat for an example). This would be best. Relying on the CWD is a bad practice that will lead to these kinds of problems. - -chris -BEGIN PGP SIGNATURE- Comment: GPGTools - http://gpgtools.org Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQIzBAEBCAAdFiEEMmKgYcQvxMe7tcJcHPApP6U8pFgFAls33dEACgkQHPApP6U8 pFgKuQ/7BnyehnsnqDCrMuOZCsRnP/b24Iqpx5PHduknwCp8y1eweR+Yy5gnCTg4 BlNYabwKXdde5U+2IcE6CIxlOVKUDSaK7S0/QrrOy+QExSn5GKIlJ88F4OA5o4ow 6gkzegtMfN4FHfXUKWlCnu9x1Gpv2aAGong9tdLyoXtUo1klrjKim4NgDB7lpqNp U8fjkkNGyAL55NlqAIaRKwCCq2EfkrgSYnbsO6KgwvOJozWMTU345WrYeUEEnNup eTByANX1s5hyNsaCyViG12Ossa5kjWcDO2hfhki28z3HiXpay8MIQOgccD3PoWj8 2/oUYZzrc3zCqmKOcda+0bdI33oltSeMX0g+qGnZH05G17BhNC5KCOSf5/2n3mGS iNpBVwA0bYbgY1S0rYeLukviyr+t8LCR1ccRzgm/ureNFLt09uDXEBy6vfSjGdtP pMxUtjbBFWWY/jiTKGP4EULWjUODl9osmcAvQZAB9w22r0gyO8JJSijMjiericPH dWdPcUhTsV0PyK7tw8jxcCX91XX2nUODVPjdxP6KIo95uRRX5ZSe6RFSMEP6AOfK yrUg93gXC6ZIlJ0c0UCJJXSzb79AAy3FYkCHEnpXUyIaLPvuPiKGgScRvwhFciUh peaC/7K2/1ICRZoEoye2QSmwY999F24mwqE6uHS+8LquTnpHGQU= =AvVE -END PGP SIGNATURE- - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: Working dir incorrect tomcat 9.10?
2018-06-30 12:55 GMT+03:00 Carl-Henrik Tjärnlund : > Hi! > I'm in the process of upgrading from tomcat 8 to 9 and was running into a > probelm with velocity not beeing able to create the default log file, > ./velocity.log and after some troubleshooting it seems it is trying to > create it in the root of the file system instead of the current working > directory, which i thought would be CATALINA_BASE. > > I just did some test and logging in the webapp: > > log.info("Working path: " + new File(".").getAbsolutePath()); > > would report "Working path: /. > And I could do a workaround by creating /velocity.log manually and give the > tomcat9 user ownership. Or you could do System.getProperty("user.dir"). Tomcat does not care what the current working directory is when you launch it. All it cares is the value of system properties "catalina.home" and "catalina.base". (The well known environment variables CATALINA_HOME, CATALINA_BASE are used by catalina.sh/catalina.bat scripts to set those system properties when launching Java process for Tomcat). If your logging configuration supports substitution of environment variables, use one of those variables explicitly, e.g. as "${catalina.base}/logs" (see the default conf/logging.properties in Tomcat for an example). Best regards, Konstantin Kolinko - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Working dir incorrect tomcat 9.10?
Hi! I'm in the process of upgrading from tomcat 8 to 9 and was running into a probelm with velocity not beeing able to create the default log file, ./velocity.log and after some troubleshooting it seems it is trying to create it in the root of the file system instead of the current working directory, which i thought would be CATALINA_BASE. I just did some test and logging in the webapp: log.info("Working path: " + new File(".").getAbsolutePath()); is reporting "Working path: /. Also, I could do a workaround by creating /velocity.log manually and give the tomcat9 user ownership which strengthen my belief that there is something strange with the working path.. >From the logs it seems that tomcat is picking up the correct settings, see below, so I really cant get my head around it.. This has been workign without a problem from tomcat6 to tomcat8, is there some configuration change I may have missed? 28-Jun-2018 08:42:28.896 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Server version: Apache Tomcat/9.0.10 28-Jun-2018 08:42:28.897 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Server built: Jun 20 2018 17:32:21 UTC 28-Jun-2018 08:42:28.898 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Server number: 9.0.10.0 28-Jun-2018 08:42:28.899 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log OS Name: Linux 28-Jun-2018 08:42:28.899 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log OS Version: 4.15.0-23-generic 28-Jun-2018 08:42:28.900 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Architecture: amd64 28-Jun-2018 08:42:28.900 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Java Home: /usr/lib/jvm/java-11-openjdk-amd64 28-Jun-2018 08:42:28.901 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log JVM Version: 10.0.1+10-Ubuntu-3ubuntu1 28-Jun-2018 08:42:28.902 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log JVM Vendor: Oracle Corporation 28-Jun-2018 08:42:28.902 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log CATALINA_BASE: /ssd/opt/apache-tomcat-9.0.10 28-Jun-2018 08:42:28.903 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log CATALINA_HOME: /ssd/opt/apache-tomcat-9.0.10 28-Jun-2018 08:42:28.904 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: --add-opens=java.base/java.lang=ALL-UNNAMED 28-Jun-2018 08:42:28.905 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: --add-opens=java.base/java.io=ALL-UNNAMED 28-Jun-2018 08:42:28.905 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: --add-opens=java.rmi/sun.rmi.transport=ALL-UNNAMED 28-Jun-2018 08:42:28.906 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.util.logging.config.file=/opt/tomcat/conf/logging.pro perties 28-Jun-2018 08:42:28.906 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogMa nager 28-Jun-2018 08:42:28.907 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dfile.encoding=ISO-8859-1 28-Jun-2018 08:42:28.907 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dnet.sf.ehcache.skipUpdateCheck=true 28-Jun-2018 08:42:28.908 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -XX:+CMSClassUnloadingEnabled 28-Jun-2018 08:42:28.908 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djdk.tls.ephemeralDHKeySize=2048 28-Jun-2018 08:42:28.909 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.protocol.handler.pkgs=org.apache.catalina.webresource s 28-Jun-2018 08:42:28.909 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dorg.apache.catalina.security.SecurityListener.UMASK=0027 28-Jun-2018 08:42:28.910 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Xms512m 28-Jun-2018 08:42:28.910 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Xmx1G 28-Jun-2018 08:42:28.912 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: --add-modules=java.xml.bind 28-Jun-2018 08:42:28.913 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: --add-modules=java.xml.ws 28-Jun-2018 08:42:28.914 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dignore.endorsed.dirs= 28-Jun-2018 08:42:28.915 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dcatalina.base=/opt/tomcat 28-Jun-2018 08:42:28.918 INFO [main] org.apache.catalina.s
Working dir incorrect tomcat 9.10?
Hi! I'm in the process of upgrading from tomcat 8 to 9 and was running into a probelm with velocity not beeing able to create the default log file, ./velocity.log and after some troubleshooting it seems it is trying to create it in the root of the file system instead of the current working directory, which i thought would be CATALINA_BASE. I just did some test and logging in the webapp: log.info("Working path: " + new File(".").getAbsolutePath()); would report "Working path: /. And I could do a workaround by creating /velocity.log manually and give the tomcat9 user ownership. >From the logs it seems that tomcat is picking up the correct settings, see below, so I really cant get my head around it.. This has been workign without a problem from tomcat6 to tomcat8, is there some configuration change I may have missed? 28-Jun-2018 08:42:28.896 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Server version:Apache Tomcat/9.0.10 28-Jun-2018 08:42:28.897 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Server built: Jun 20 2018 17:32:21 UTC 28-Jun-2018 08:42:28.898 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Server number: 9.0.10.0 28-Jun-2018 08:42:28.899 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log OS Name: Linux 28-Jun-2018 08:42:28.899 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log OS Version:4.15.0-23-generic 28-Jun-2018 08:42:28.900 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Architecture: amd64 28-Jun-2018 08:42:28.900 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Java Home: /usr/lib/jvm/java-11-openjdk-amd64 28-Jun-2018 08:42:28.901 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log JVM Version: 10.0.1+10-Ubuntu-3ubuntu1 28-Jun-2018 08:42:28.902 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log JVM Vendor:Oracle Corporation 28-Jun-2018 08:42:28.902 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log CATALINA_BASE: /ssd/opt/apache-tomcat-9.0.10 28-Jun-2018 08:42:28.903 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log CATALINA_HOME: /ssd/opt/apache-tomcat-9.0.10 28-Jun-2018 08:42:28.904 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: --add-opens=java.base/java.lang=ALL-UNNAMED 28-Jun-2018 08:42:28.905 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: --add-opens=java.base/java.io=ALL-UNNAMED 28-Jun-2018 08:42:28.905 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: --add-opens=java.rmi/sun.rmi.transport=ALL-UNNAMED 28-Jun-2018 08:42:28.906 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.util.logging.config.file=/opt/tomcat/conf/logging.pro perties 28-Jun-2018 08:42:28.906 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogMa nager 28-Jun-2018 08:42:28.907 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dfile.encoding=ISO-8859-1 28-Jun-2018 08:42:28.907 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dnet.sf.ehcache.skipUpdateCheck=true 28-Jun-2018 08:42:28.908 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -XX:+CMSClassUnloadingEnabled 28-Jun-2018 08:42:28.908 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djdk.tls.ephemeralDHKeySize=2048 28-Jun-2018 08:42:28.909 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.protocol.handler.pkgs=org.apache.catalina.webresource s 28-Jun-2018 08:42:28.909 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dorg.apache.catalina.security.SecurityListener.UMASK=0027 28-Jun-2018 08:42:28.910 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Xms512m 28-Jun-2018 08:42:28.910 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Xmx1G 28-Jun-2018 08:42:28.912 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: --add-modules=java.xml.bind 28-Jun-2018 08:42:28.913 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: --add-modules=java.xml.ws 28-Jun-2018 08:42:28.914 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dignore.endorsed.dirs= 28-Jun-2018 08:42:28.915 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dcatalina.base=/opt/tomcat 28-Jun-2018 08:42:28.918 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line
Sticky sessions not working at get_most_suitable_worker
Hello. I' m working on a LB configuration with Apache/2.4.18 (Ubuntu) mod_jk/1.2.41 and not getting wanted results. My workers config is: worker.list=balanceFFG, jk-status # tomcat-pro-03 por COLT worker.FFG1.host=tomcat-pro-03 worker.FFG1.port=8009 worker.FFG1.type=ajp13 worker.FFG1.sticky_session=true # tomcat-pro-06 por COLT worker.FFG2.host=tomcat-pro-06 worker.FFG2.port=8010 worker.FFG2.type=ajp13 worker.FFG2.sticky_session=true worker.balanceFFG.type=lb worker.balanceFFG.balance_workers=FFG1, FFG2 worker.jk-status.type=status VirtualHost config is: Header edit Set-Cookie "^(.*; Path=)/ffgonzalezarch_pro/?(.*)" $1/$2 RewriteEngine on RewriteRule ^(.*)$ /ffgonzalezarch_pro$1 [PT,L] RewriteRule ^(.*)$ /ffgonzalezarch_pro/$1 [CO] JkMount /ffgonzalezarch_pro/* balanceFFG jvmRoute set in Engine section in Tomcat server.xml And finally, this is the result in mod_jk debug log: [Sat Jun 30 06:52:29.565 2018] [6628:139806621300480] [debug] service::jk_lb_worker.c (1270): service sticky_session=1 id='7E9778933D54A11F3D91B9AF81653C53.tomcat-pro-06' [Sat Jun 30 06:52:29.565 2018] [6628:139806621300480] [debug] get_most_suitable_worker::jk_lb_worker.c (1078): searching worker for partial sessionid 7E9778933D54A11F3D91B9AF81653C53.tomcat-pro-06 [Sat Jun 30 06:52:29.565 2018] [6628:139806621300480] [debug] get_most_suitable_worker::jk_lb_worker.c (1086): searching worker for session route tomcat-pro-06 [Sat Jun 30 06:52:29.565 2018] [6628:139806621300480] [debug] get_most_suitable_worker::jk_lb_worker.c (1136): found best worker FFG1 (FFG1) using method 'Request' So, a session from FFG2(omcat-pro-06) ends in FFG1(tomcat-pro-03). Why!! Sessionid is telling you FFG2(omcat-pro-06)!! Thanks for help!