Re: Configure mulitple installs tomcat 8.5 - catalina_base/catalina_home
Thank you so much for replying. I actually found the issue and it was simple. The starter daemon (which I don't control, unfortunately) wasn't launching the tomcat installs from the proper locations. It was calling the respongindPROD startup.sh from the initiatingPROD dir every time, no matter which tomcat installation it was launching. Fixing that fixed my issue completely. Thank you, Jason T. Countryman From: Christopher Schultz Sent: Thursday, February 24, 2022 3:55 PM To: users@tomcat.apache.org Subject: Re: Configure mulitple installs tomcat 8.5 - catalina_base/catalina_home Jason, On 2/23/22 13:50, Jason Countryman wrote: > Good afternoon, > > On a Centos 7 machine, I have multiple full tomcat installs. > > /var/tomcat_installs/initiatingPROD > /var/tomcat_installs/respondingPROD > > My app uses a spring configuration for cxf, and uses catalina.base to > identify the location for the keystore/truststore, and log4j2 for logging. > When I start each individual tomcat using startup.sh, they report setting > CATALINA_HOME and CATALINA_BASE correctly for their respective locations. > > $ /var/tomcat_installs/initiatingPROD/apache-tomcat-8.5.73/bin/startup.sh > Using CATALINA_BASE: > /var/tomcat_installs/initiatingPROD/apache-tomcat-8.5.73 > Using CATALINA_HOME: > /var/tomcat_installs/initiatingPROD/apache-tomcat-8.5.73 > Using CATALINA_TMPDIR: > /var/tomcat_installs/initiatingPROD/apache-tomcat-8.5.73/temp > Using JRE_HOME:/usr > Using CLASSPATH: > /var/tomcat_installs/initiatingPROD/apache-tomcat-8.5.73/bin/bootstrap.jar:/var/tomcat_installs/initiatingPROD/apache-tomcat-8.5.73/bin/tomcat-juli.jar > Using CATALINA_OPTS: > Tomcat started. > > $ /var/tomcat_installs/respondingPROD/apache-tomcat-8.5.73/bin/startup.sh > Using CATALINA_BASE: > /var/tomcat_installs/respondingPROD/apache-tomcat-8.5.73 > Using CATALINA_HOME: > /var/tomcat_installs/respondingPROD/apache-tomcat-8.5.73 > Using CATALINA_TMPDIR: > /var/tomcat_installs/respondingPROD/apache-tomcat-8.5.73/temp > Using JRE_HOME:/usr > Using CLASSPATH: > /var/tomcat_installs/respondingPROD/apache-tomcat-8.5.73/bin/bootstrap.jar:/var/tomcat_installs/respondingPROD/apache-tomcat-8.5.73/bin/tomcat-juli.jar > Using CATALINA_OPTS: > Tomcat started. > > However, as I follow catalina.out, it appears the values for these are > changed somehow, or I have a configuration error causing this (more likely). > There is all kinds of crosstalk in the respondingPROD catalina.out showing > things from the initiatingPROD installation. The initiatingPROD > catalina.out, however, only has references to what it should. > > I'm setting this up this way so to provide a testing/upgrade path for > tomcat/log4j2 updates, and need each of these installations to be agnostic of > the other, and really need a way to specify for spring where the keystores > are located and they can not be in the classpath. > > There has to be some configuration thing for multiple FULL tomcat > installations that I'm missing here causing all this crosstalk for the > respondingPROD installation, correct? All that looks weird. If startup.sh shows CATALINA_BASE == CATALINA_HOME and both initiatingPROD and respondingPROD have separate values, then then nothing should be interfering. Honestly, if you expect to run them on the same version of Tomcat (oor eve if you don't!) I would recommend having CATALINA_BASE != CATAINA_HOME and have CATALINA_HOME only contain the files that came from ASF directly. Your CATALINA_BASE will contain your application-specific stuff. Anyway, there's no need to complicate things for you like that quite yet, so ... What happens if you try this: 1. Stop both Tomcats 2. Delete catalina.out from both installations 3. Start only the initiatingPROD Tomcat process Look for any log files in EITHER of the two installations. What do you see? -chris - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org This message and any attachments may contain information that is protected by law as privileged and confidential, and is transmitted for the sole use of the intended recipient(s). If you are not the intended recipient, you are hereby notified that any use, dissemination, copying or retention of this e-mail or the information contained herein is strictly prohibited. If you received this e-mail in error, please immediately notify the sender by e-mail, and permanently delete this e-mail.
Re: [OT] Configure Tomcat development using NetBeans IDE
John, On 2/23/22 05:08, John Barrow wrote: I fall into that historic stereotypical old-school developer type labelled 'lazy' You're in good company. Awww.. the threevirtues dot com website has been hijacked by some stupid advertising company. This is why we can't have nice things. Google for a better reference; I didn't want to post any of them in this forum. -chris - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: Configure mulitple installs tomcat 8.5 - catalina_base/catalina_home
Jason, On 2/23/22 13:50, Jason Countryman wrote: Good afternoon, On a Centos 7 machine, I have multiple full tomcat installs. /var/tomcat_installs/initiatingPROD /var/tomcat_installs/respondingPROD My app uses a spring configuration for cxf, and uses catalina.base to identify the location for the keystore/truststore, and log4j2 for logging. When I start each individual tomcat using startup.sh, they report setting CATALINA_HOME and CATALINA_BASE correctly for their respective locations. $ /var/tomcat_installs/initiatingPROD/apache-tomcat-8.5.73/bin/startup.sh Using CATALINA_BASE: /var/tomcat_installs/initiatingPROD/apache-tomcat-8.5.73 Using CATALINA_HOME: /var/tomcat_installs/initiatingPROD/apache-tomcat-8.5.73 Using CATALINA_TMPDIR: /var/tomcat_installs/initiatingPROD/apache-tomcat-8.5.73/temp Using JRE_HOME:/usr Using CLASSPATH: /var/tomcat_installs/initiatingPROD/apache-tomcat-8.5.73/bin/bootstrap.jar:/var/tomcat_installs/initiatingPROD/apache-tomcat-8.5.73/bin/tomcat-juli.jar Using CATALINA_OPTS: Tomcat started. $ /var/tomcat_installs/respondingPROD/apache-tomcat-8.5.73/bin/startup.sh Using CATALINA_BASE: /var/tomcat_installs/respondingPROD/apache-tomcat-8.5.73 Using CATALINA_HOME: /var/tomcat_installs/respondingPROD/apache-tomcat-8.5.73 Using CATALINA_TMPDIR: /var/tomcat_installs/respondingPROD/apache-tomcat-8.5.73/temp Using JRE_HOME:/usr Using CLASSPATH: /var/tomcat_installs/respondingPROD/apache-tomcat-8.5.73/bin/bootstrap.jar:/var/tomcat_installs/respondingPROD/apache-tomcat-8.5.73/bin/tomcat-juli.jar Using CATALINA_OPTS: Tomcat started. However, as I follow catalina.out, it appears the values for these are changed somehow, or I have a configuration error causing this (more likely). There is all kinds of crosstalk in the respondingPROD catalina.out showing things from the initiatingPROD installation. The initiatingPROD catalina.out, however, only has references to what it should. I'm setting this up this way so to provide a testing/upgrade path for tomcat/log4j2 updates, and need each of these installations to be agnostic of the other, and really need a way to specify for spring where the keystores are located and they can not be in the classpath. There has to be some configuration thing for multiple FULL tomcat installations that I'm missing here causing all this crosstalk for the respondingPROD installation, correct? All that looks weird. If startup.sh shows CATALINA_BASE == CATALINA_HOME and both initiatingPROD and respondingPROD have separate values, then then nothing should be interfering. Honestly, if you expect to run them on the same version of Tomcat (oor eve if you don't!) I would recommend having CATALINA_BASE != CATAINA_HOME and have CATALINA_HOME only contain the files that came from ASF directly. Your CATALINA_BASE will contain your application-specific stuff. Anyway, there's no need to complicate things for you like that quite yet, so ... What happens if you try this: 1. Stop both Tomcats 2. Delete catalina.out from both installations 3. Start only the initiatingPROD Tomcat process Look for any log files in EITHER of the two installations. What do you see? -chris - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: is too quick to respond
John, On 2/23/22 05:49, John Barrow wrote: Christopher, You will just change the implementation to answer the question "have any resources been modified, but not-too-recently?" OK The check must be fast, otherwise it will hang-up other processes on the server. Don't introduce any new loops or stalls. Just return true or false as quickly as possible. The process will be repeated during the "next" check so you only have to decide not to reload "too early"? Not sure that I understand this point (re 'check must be fast'). I wasn't imagining affecting the initial trigger point at all (i.e. Tomcat has detected a change in one of the active files) so shouldn't affect the day-to-day performance. Once Tomcat has decided that a reload is required *and* the user has requested for Tomcat to do the reload (i.e. Context flag is defined to true), prior to actioning the reload, add the additional check (simple user-specified timer delay to allow the external application time to finish deployment, and then let Netbeans carry on. Tomcat won't even check for any changes unless . Tomcat has a background thread that does all the "backgroundy things" that need to be done. This is one of those things. If you hold-up that thread, than you hold-up everything. That's why you can't just stall for 10 seconds and then proceed. Instead, you say "sorry, file is too new; don't signal to reload (yet)." You don't want to hold-up the reload process itself, either, for a bunch of reasons. First, it's not really appropriate because "reload now" means "reload now" not "reload when you sort of feel like it." Your additional suggestion that the time-stamps of the amended files should remain consistent over that period also sounds sensible. Given that Tomcat can't implement the event model for reasons you have already explained, I am now thinking that the event that triggers the re-build won't contain details of what files have been amended, simply that there has been a change. Yes. Snapshotting all the files within the two folders, noting the timestamps and then polling again after the delay seems to be repeating what Tomcat is probably already doing to trigger the event in the first place. Exactly. You don't need to do any of that. Now that I just about have a development environment I can explore and debug, I think I should spend some time around this class and learn when / why it's called and the calls it makes to do the reload. So far, I have had to imagine how the code is structured and so consider a solution based on that (possibly false hypothesis). Well, even if the unit tests won't pass within Netbeans, I'm assuming that the built-in text editor is working. Just go to the code Mark initially suggested and start reading. I think it will significantly inform this conversation. Just to be clear from other questions, I have no intention in going anywhere near the 'rebuild' process - that is a black box as far as I am concerned. Good. The only process you need to tweak is the one that decides if the context *should* be reloaded. That's a relatively straightforwar process, currently, and you are going to make is slightly more complicated. -chris - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: Configure Tomcat development using NetBeans IDE
Mark, I have now got grep working (following a post from another member indicating that built into git bash!) > ant download-test-compile This is useful to know as I didn't run the tests script until later. > ant download-validate This didn't report Checkstyle missing - probably as not needed for actual development. Running Checkstyle using ant -Dexecute.validate=true validate did then update the libraries folder > I doubt you'll need a release build So do I by the sound of it - I will probably come back to the forum when looking to commit anything for the first time but I assume that I will just upload any changes that, once approved, will form part of the next release. Of course I will be able to benefit from the newly developed time-delay in the meantime :) I have passed on your observation "but NetBeans is not taking into account the isELIgnored="true" page directive" to the NetBeans community > I'd see if you can disable the JSP validation. If it makes you feel better, > Eclipse's JSP validation has similar issues. That has no effect! We can drop the issues over JSP as the NetBeans community has taken up that baton. > That is an abstract base class. You won't be able to run it. Trust me to pick that one! I have only ever written simple unit tests so not needed to create any abstract classes in my testing, but I should have spent more time looking into your source and then would have spotted the 'abstract' keyword!! In a very weak defence, I tend to use interfaces rather than abstract classes. Anyway, thanks for the naming conventions, that will prove time-saving. For good measure, I ran TestDefaultServlet and that ran the tests successfully. Thanks for the explanation of the dual 'bin' folders. > Yes, the Java compiler is smart enough to generate the byte code as if it was > generated with Java 11 so you are fine to stick with Java 17 as long as the > build version is 11. I have amended my project options to reflect this and rebuilt the project to check everything still works - it does! > Ah. You need to add webapps/examples/WEB-INF/classes as a source folder. That > should fix the two issues above. I must still be missing a link here, I have added that folder to the list of elements. I also added it to the since, as the project references files inside this folder, it seemed applicable to include it. However, it didn't appear to make any difference - i.e. NetBeans still couldn't tie the source back to those Java classes. I have checked that I have typed the paths correctly and I can see the trailers.ResponseTrailers (& util.CookieFilter) file(s) in the WEB-APP\classes and visible in the project folders (I assume as added to ) to back-up paths are valid. NetBeans doesn't let me take any action to try and find the file to resolve the [!], I assume because it is a free form Ant project and so configuration is 'read-only' once loaded (I would have options in Maven to locate the missing resource). I have added my current project.xml and Trailers.ResponseTrailers.jpg to the DropBox folder in case either of them helps. My only observation is that, as I can't find a corresponding XSD file for project.xml, there is another attribute I need to set to indicate that these are class files in a different folder to the one the other package files are in, but that seems unlikely. > I think you mean 8000 for remote debugging but otherwise great. If you can > get this working, you are doing really well. I was using 8080 and appeared to be working although I have not used it in anger yet. I had amended the catalina.bat line "set JPDA_ADDRESS=localhost:8080, because I connect to Tomcat using http://localhost:8080/examples. Your statement concerned me slightly in that I now believe that I had made a wrong assumption. Anyway, I amended the catalina.bat back and set NetBeans remote debugging to the same and it worked as well so I will leave it at 8000. I couldn't find anything on the web re Port 8000 vs 8080 (apart from "use which one you want"), but I suspect that, ideally, the debugging communications should be using a different port to the application otherwise there may be conflicts but couldn't find anything to back up that hypothesis. > - Patch file in diff -u format attached to a BugZilla issue > - GitHub pull request > Happy to provide pointers for either approval if needed. Unfortunately,II will now probably have to wait a bit for that. I will soak the changes to the NetBeans configuration files while I explore Tomcat, once the webapps/examples/WEB-INF/classes issue is sorted and (hopefully) the NetBeans community has resolved the other exceptions. That way, if I discover another missing link, I can incorporate it and upload all the configuration changes at once to minimise confusion. However, I am away in a weeks time - 5th March (Snowboarding at last!), and have to catch up with some other chores / tasks before getting back on the laptop. Hopefully, we can get these last minor
Re: In what directory was tomcat installed
Well, I found the answer: Tomcat is in /opt/tomcat, but I did not have permission to access that directory. I changed the directory permission and now its working; I think. On 2/24/22 2:30 AM, Suvendu Sekhar Mondal wrote: Hello! On Thu, Feb 24, 2022, 3:50 AM Amn Ojee Uw wrote: I am trying to setup Tomecat in Netbeans, but after installing Tomcat in my Debian 11, and in Netbeans going to "Tools -> Servers->Add server ->Apache Tomcat or TomEE -> Server Location -> Browse" I cannot tell in which directory Tomcat 10.x was installed. I am not a qualified programmer, I am just someone who would like to program and to make things worst, I am new to the Linux world. So... I am really lost here; any help will be much appreciated. Thanks in advance. I have not used Netbeans for long times. Probably you can try to find where CATALINA_HOME is pointing to. Normally that's the base of Tomcat in any environment. 1. Start your Tomcat server from Netbeans 2. After that use ps and grep command to search for text "catalina". It'll be something like: ps aux | grep catalina Thanks! Suvendu
Re: In what directory was tomcat installed
How did you install Tomcat in Debian? Mark On 24/02/2022 13:15, Amn Ojee Uw wrote: Thank you so much for the help. I tried that solution, but when I type 'echo $CATALINA_HOME' at the command prompt I get a blank return. I'd like to mention that Tomcat documentation, so far, has not provide any information regarding my question. Perhaps if the Apache Technical Writers could have a look at this question they, the Apache teem in general, could resolve this drawback by adding a bit more information regarding this issue in the Tomcat documentation. I have used Tomcat/Eclipse in the past under Windows, where my sound experience with MS-Win helped me resolve whatever settings I was asked to provide. However, being a new comer to Linux, this advantage is nearly zero. I really don't want to go back to MS-Win, rather, I want to move ahead and augment my knowledge of Linux. TIA. On 2/24/22 2:30 AM, Suvendu Sekhar Mondal wrote: Hello! On Thu, Feb 24, 2022, 3:50 AM Amn Ojee Uw wrote: I am trying to setup Tomecat in Netbeans, but after installing Tomcat in my Debian 11, and in Netbeans going to "Tools -> Servers->Add server ->Apache Tomcat or TomEE -> Server Location -> Browse" I cannot tell in which directory Tomcat 10.x was installed. I am not a qualified programmer, I am just someone who would like to program and to make things worst, I am new to the Linux world. So... I am really lost here; any help will be much appreciated. Thanks in advance. I have not used Netbeans for long times. Probably you can try to find where CATALINA_HOME is pointing to. Normally that's the base of Tomcat in any environment. 1. Start your Tomcat server from Netbeans 2. After that use ps and grep command to search for text "catalina". It'll be something like: ps aux | grep catalina Thanks! Suvendu - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: In what directory was tomcat installed
Thank you so much for the help. I tried that solution, but when I type 'echo $CATALINA_HOME' at the command prompt I get a blank return. I'd like to mention that Tomcat documentation, so far, has not provide any information regarding my question. Perhaps if the Apache Technical Writers could have a look at this question they, the Apache teem in general, could resolve this drawback by adding a bit more information regarding this issue in the Tomcat documentation. I have used Tomcat/Eclipse in the past under Windows, where my sound experience with MS-Win helped me resolve whatever settings I was asked to provide. However, being a new comer to Linux, this advantage is nearly zero. I really don't want to go back to MS-Win, rather, I want to move ahead and augment my knowledge of Linux. TIA. On 2/24/22 2:30 AM, Suvendu Sekhar Mondal wrote: Hello! On Thu, Feb 24, 2022, 3:50 AM Amn Ojee Uw wrote: I am trying to setup Tomecat in Netbeans, but after installing Tomcat in my Debian 11, and in Netbeans going to "Tools -> Servers->Add server ->Apache Tomcat or TomEE -> Server Location -> Browse" I cannot tell in which directory Tomcat 10.x was installed. I am not a qualified programmer, I am just someone who would like to program and to make things worst, I am new to the Linux world. So... I am really lost here; any help will be much appreciated. Thanks in advance. I have not used Netbeans for long times. Probably you can try to find where CATALINA_HOME is pointing to. Normally that's the base of Tomcat in any environment. 1. Start your Tomcat server from Netbeans 2. After that use ps and grep command to search for text "catalina". It'll be something like: ps aux | grep catalina Thanks! Suvendu
Re: Tomcat 8.5.75 Servlet WriteListener and ReadListener setting thread
On Thu, Feb 24, 2022 at 10:31 AM Istvan SZEKELY wrote: > > Hello! > > I have an application where a ReadListener and a WriteListener (call it > MyWriteListener) set to the ServletInputStream and the ServletOutputStream > objects. Updating the Tomcat container from 8.5.73 to 8.5.75, the follow > error occured. The ServletOutputStream objects's isReady function always > returns false (within MyWriteListener.onWritePossible). > > I think its because of this commit: > https://github.com/apache/tomcat/commit/2bfbbef65d1b1b07da46c8dcd6cee96cb5567998#diff-1ffbc1c154370a6c5385c168a0846a1c385aacbf5f880feb74cb1c27baa76003 > > The ReadListener is set first, where dispatch fired > (action(ActionCode.DISPATCH_EXECUTE, null);). There the request threadId > updated (req.setRequestThread();). > Then when i'm setting the WriteListener (within the same thread), the > DISPACTH_EXECUTE action not fired (due to threadId equals request objects > thread id). Thus registeredForWrite flag remains is true state, causing > the isReady false behaviour. > > Is this a Tomcat bug, or I should do something differently. I could't set > WriteListener within a different thread, but it feels weird. Should i do > something else? I think I see the problem, but would you have test code or example like this testcase to submit ? https://github.com/apache/tomcat/blob/main/test/org/apache/catalina/nonblocking/TestNonBlockingAPI.java#L951 It would allow verifying and validating a fix. Rémy > Thank You in Advance, > Istvan - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Tomcat 8.5.75 Servlet WriteListener and ReadListener setting thread
Hello! I have an application where a ReadListener and a WriteListener (call it MyWriteListener) set to the ServletInputStream and the ServletOutputStream objects. Updating the Tomcat container from 8.5.73 to 8.5.75, the follow error occured. The ServletOutputStream objects's isReady function always returns false (within MyWriteListener.onWritePossible). I think its because of this commit: https://github.com/apache/tomcat/commit/2bfbbef65d1b1b07da46c8dcd6cee96cb5567998#diff-1ffbc1c154370a6c5385c168a0846a1c385aacbf5f880feb74cb1c27baa76003 The ReadListener is set first, where dispatch fired (action(ActionCode.DISPATCH_EXECUTE, null);). There the request threadId updated (req.setRequestThread();). Then when i'm setting the WriteListener (within the same thread), the DISPACTH_EXECUTE action not fired (due to threadId equals request objects thread id). Thus registeredForWrite flag remains is true state, causing the isReady false behaviour. Is this a Tomcat bug, or I should do something differently. I could't set WriteListener within a different thread, but it feels weird. Should i do something else? Thank You in Advance, Istvan