RE: is too quick to respond
Hi Mark / Christopher, Firstly, thanks for confirming my analysis on what is happening. >> Would you be interested in looking at the existing algorithm to see if >> it would be updated in this way? > WebappLoader.backgroundProcess() would be a good place to start. I am sort of interested in looking at this. I have only been playing with Java for about 6 months, having been a Pascal developer most of my life (40 odd years). Therefore, I think that I could at least ‘give it a look’, if I can get Tomcat installed locally. However, I appreciate that I could be well out of my depth and there are too many unknowns / barriers in order to be of any use. It is the installation process that I am having issues with. I think it is down to lack of experience / knowledge / familiarity with commercial strength application. I use Netbeans 12.6 (Apache loyalty!) on Windows 10 for all my Java development using JDK 17. Unfortunately, I am only ‘sort-of’ familiar with Maven and have never touched Ant so I am flying a bit blind here, but that shouldn’t matter if it all works as I don't need to touch the build process. I downloaded the ‘main’ branch from GitHub (https://github.com/apache/tomcat) and unzipped it into its own folder, again with Ant (apache-ant-1.9.16). I have managed to get Ant to build it using instructions in BUILDING.txt. While it says that Tomcat built successfully, scrolling up, I got lots of warnings saying ‘can’t find a module etc so not sure if doing something wrong. I can send the results as an attachment if that would be useful. I can also get it to build in Netbeans (I first had to set Project > Properties > Java Sources to Source Level 17 which may be a bit of a guess as Netbeans complained about default value of 1.7). The java files in Netbeans don’t highlight any exceptions, just warnings. I appear to have issues with the other two folders ‘C:\Community\Tomcat\tomcat-main\webapps\docs\appdev\sample\src\mypackage’ and ‘C:\Community\Tomcat\tomcat-main\test’ as they don’t seem to be able to locate the dependencies (HelloWorld is -e.g. import jakarta.servlet.http.HttpServlet & tests is -e.g. import org.junit.Assert). In Maven, I would add a dependency to the pom.xml file, but not sure what to do in Ant as I would expect the configuration to already be set up. I also ran the ‘ant test’, took about 90 minutes and failed a number of tests (which I thought was surprising as I would expect sources in the repository to pass all the tests. I can provide examples if useful as it may indicate that I have done something wrong. I read through the ‘RUNNING.txt’ file, but that assumes a binary to start, rather than following on from BUILDING Tomcat and so I couldn’t relate that to what I was trying to achieve. However, if I launch Tomcat from within Netbeans (F6), I get a dialog which I don’t understand - probably due to my lack of familiarity with Ant. Again, I can include a screenshot if that would help. [Run – Tomcat 8.0] No build target is associated with Run action. The free-form project requires a target Representing the Run action to invoke in Your Ant script. Select the target to invoke. [Dropdown with lots of tasks v] Is there an alternative document I should be reviewing to get me to actually run Tomcat from within Netbeans? I need to be able to run the locally built version of Tomcat so that, as a starting point, I can add some System.out.print() messages around the relevant routines (which I have located – thanks Mark). Of course I am assuming that it is possible to develop Tomcat from within Netbeans. While I would enjoy the challenge of reviewing the existing sources and attempting to incorporate a delay, I may waste more peoples time trying to get off the starting blocks. If that is the case, then I can raise a bug for future inclusion although it will be a pain-in-the-neck having to keep shutting down Tomcat after each compile! John From: Mark Thomas Sent: 17 February 2022 21:47 To: users@tomcat.apache.org Subject: Re: is too quick to respond On 17/02/2022 19:50, Christopher Schultz wrote: > This kind of thing could happen due to a number of different reasons, > such as a slow disk or network share, etc. and ought to be > protected-against. > > I haven't looked at the code, but I would imagine it periodically reads > all relevant files looking for anything that's been updated, but > immediately acts the first time is finds someting worth triggering a > reload. It does. The periodic check is triggered by the background process. > It might make more sense to modify that logic so that *all* files are > checked, but we cancel the reload if there are any files that are "too > new". This would allow us to avoid a reload if some kind of copy is in > progress. So we are looking for "anything newer than > last_reload_timestamp but not if we find anything older than NOW - 10 > seconds". Yes. We do something similar when checking for an update WAR file. Te
Re: is too quick to respond
John, On 2/18/22 10:50, John Barrow wrote: Would you be interested in looking at the existing algorithm to see if it would be updated in this way? WebappLoader.backgroundProcess() would be a good place to start. I am sort of interested in looking at this. Awesome! I have only been playing with Java for about 6 months, having been a Pascal developer most of my life (40 odd years). Therefore, I think that I could at least ‘give it a look’, if I can get Tomcat installed locally. However, I appreciate that I could be well out of my depth and there are too many unknowns / barriers in order to be of any use. It is the installation process that I am having issues with. I think it is down to lack of experience / knowledge / familiarity with commercial strength application. I use Netbeans 12.6 (Apache loyalty!) on Windows 10 for all my Java development using JDK 17. Unfortunately, I am only ‘sort-of’ familiar with Maven and have never touched Ant so I am flying a bit blind here, but that shouldn’t matter if it all works as I don't need to touch the build process. I downloaded the ‘main’ branch from GitHub (https://github.com/apache/tomcat) and unzipped it into its own folder, again with Ant (apache-ant-1.9.16). I have managed to get Ant to build it using instructions in BUILDING.txt. While it says that Tomcat built successfully, scrolling up, I got lots of warnings saying ‘can’t find a module etc so not sure if doing something wrong. I can send the results as an attachment if that would be useful. I can also get it to build in Netbeans (I first had to set Project > Properties > Java Sources to Source Level 17 which may be a bit of a guess as Netbeans complained about default value of 1.7). The java files in Netbeans don’t highlight any exceptions, just warnings. I appear to have issues with the other two folders ‘C:\Community\Tomcat\tomcat-main\webapps\docs\appdev\sample\src\mypackage’ and ‘C:\Community\Tomcat\tomcat-main\test’ as they don’t seem to be able to locate the dependencies (HelloWorld is -e.g. import jakarta.servlet.http.HttpServlet & tests is -e.g. import org.junit.Assert). In Maven, I would add a dependency to the pom.xml file, but not sure what to do in Ant as I would expect the configuration to already be set up. Try this: 1. Close the project in NetBeans 2. On the command-line, go to the directory where your Tomcat git checkout is 3. Run "ant ide-netbeans" 4. Open the project again in Netbeans See if that improves anything. That ant target configures Netbeans in a way that should be "helpful". I don't use Netbeans myself, but the equivalent for Eclipse (ide-eclipse) sets up the build-path and lots of other goodies. I also ran the ‘ant test’, took about 90 minutes and failed a number of tests (which I thought was surprising as I would expect sources in the repository to pass all the tests. I can provide examples if useful as it may indicate that I have done something wrong. You can speed-up the unit tests by throwing more CPU cores at it; by default it uses just one. You can do that by adding this to build.properties in the same directory as the build.xml file: test.threads=n That n should be something ... reasonable. I have a 6-core hyperthreaded CPU (=12 logic CPUs) and setting the number of threads to 4 significantly reduces the time to run the whole test-suite. I wouldn't set this to anything higher than the number of physical cores you actually have unless you don't want to use your computer for anything else during that test. As for test failures, some of them are known to fail in certain environments. Do you have a list of the tests which fail? Do you know how to get that list? I have an automated build-test-etc script[1] that performs this little gem after the unit tests have run: grep "\(Failures\|Errors\): [^0]" "${BASE_SOURCE_DIR}/output/build/logs/"TEST*.txt That should tell you which tests have failed. Feel free to post them here and we'll let you know if any of them are concerning. I read through the ‘RUNNING.txt’ file, but that assumes a binary to start, rather than following on from BUILDING Tomcat and so I couldn’t relate that to what I was trying to achieve. If you can run the unit tests, then they are compiling and you should be able to build a binary release (ant deploy) without a problem. However, if I launch Tomcat from within Netbeans (F6), I get a dialog which I don’t understand - probably due to my lack of familiarity with Ant. Again, I can include a screenshot if that would help. [Run – Tomcat 8.0] No build target is associated with Run action. The free-form project requires a target Representing the Run action to invoke in Your Ant script. Select the target to invoke. [Dropdown with lots of tasks v] This might be solved by running "ant ide-netbeans". Or maybe not. You may have to pick a target. The "deploy" target is probably the one you want, or maybe "compile". Running ant from within an IDE only make
Re: is too quick to respond
Hi, > 3. Run "ant ide-netbeans" Apologies, I should have made that point clear, I have already run that otherwise Netbeans wouldn't recognise the project at all - i.e. I couldn't open it. In that respect, it was helpful, as in I could now compile and navigate the source files. > The "deploy" target is probably the one you want, or maybe "compile". Perhaps I am expecting a different outcome. The 'clean' + 'deploy' is what happens when I 'Clean and build main project' in Netbeans speak (checking the Projects properties dialog confirms this, see attached screenshot). What I was expecting 'Run project' to do, was locate the source with the "public static void main(final String[] args)" method in it and run the application, hopefully bringing up the Netbeans console window in a CMD like window (similar to running the .bat file %CATALINA_HOME%\bin\startup.bat). In Maven, this is what happens automatically when I 'Run project', I don't believe that I ever configured anything to execute a project from within Netbeans. The only slight variance is if NetBeans finds multiple main() methods, in which case you get a popup allowing you to select the appropriate starting point. So, perhaps, an alternative question would be, how do you go about making an amendment in Eclipse within the Tomcat sources (e.g. add a System.out.println() statement to log a field to the Eclipse 'console window' and then run Tomcat to see the effect. Also how do you run the Eclipse debugger on the Tomcat application? > Do you have a list of the tests which fail? Do you know how to get that list? Yes, although I am on Windows, not UNIX and so I don't have access to grep. I did a simple search within logs for 'FAILED' and it came up with about 20 or so. The list of test results has been cleared now (probably when I next built Tomcat) and so I will need to run them again but will try using the threads at the same time and then send you the results in a separate email. > If you can run the unit tests, then they are compiling and you should be able > to build a binary release (ant deploy) without a problem. I ran the tests from a CMD prompt rather than in NetBeans. NetBeans is telling me that it can't find the resources. A quick Google seems to imply that there should be a project.xml as well as a build.xml but then as I don't know Ant, I am not sure what to expect. I will attempt to create a simple 'Hello World' project in NetBeans using Ant to see what I get so I have a simple project to refer to as a base when trying to relate Tomcat. Without this, I couldn't review or extend the tests that form part of Tomcat as any attempt to run them within Netbeans tells me that the packages don't exist. Is there anyone else in the group that is successfully developing Tomcat using Netbeans? On Fri, 18 Feb 2022 at 17:03, Christopher Schultz wrote: > > John, > > On 2/18/22 10:50, John Barrow wrote: > >>> Would you be interested in looking at the existing algorithm to see if > >>> it would be updated in this way? > > > >> WebappLoader.backgroundProcess() would be a good place to start. > > > > I am sort of interested in looking at this. > > Awesome! > > > I have only been playing > > with Java for about 6 months, having been a Pascal developer most of > > my life (40 odd years). Therefore, I think that I could at least ‘give > > it a look’, if I can get Tomcat installed locally. > > > > However, I appreciate that I could be well out of my depth and there > > are too many unknowns / barriers in order to be of any use. > > > > It is the installation process that I am having issues with. I think > > it is down to lack of experience / knowledge / familiarity with > > commercial strength application. > > > > I use Netbeans 12.6 (Apache loyalty!) on Windows 10 for all my Java > > development using JDK 17. > > > > Unfortunately, I am only ‘sort-of’ familiar with Maven and have never > > touched Ant so I am flying a bit blind here, but that shouldn’t matter > > if it all works as I don't need to touch the build process. > > > > I downloaded the ‘main’ branch from GitHub > > (https://github.com/apache/tomcat) and unzipped it into its own > > folder, again with Ant (apache-ant-1.9.16). > > > > I have managed to get Ant to build it using instructions in > > BUILDING.txt. While it says that Tomcat built successfully, scrolling > > up, I got lots of warnings saying ‘can’t find a module etc so not sure > > if doing something wrong. I can send the results as an attachment if > > that would be useful. > > > > I can also get it to build in Netbeans (I first had to set Project > > > Properties > Java Sources to Source Level 17 which may be a bit of a > > guess as Netbeans complained about default value of 1.7). The java > > files in Netbeans don’t highlight any exceptions, just warnings. > > > > I appear to have issues with the other two folders > > ‘C:\Community\Tomcat\tomcat-main\webapps\docs\appdev\sample\src\mypackage’ > > and ‘C:\Community\Tomcat\tomcat-main\t
Re: is too quick to respond
On 18/02/2022 18:01, John Barrow wrote: Do you have a list of the tests which fail? Do you know how to get that list? Yes, although I am on Windows, not UNIX and so I don't have access to grep. I did a simple search within logs for 'FAILED' and it came up with about 20 or so. The list of test results has been cleared now (probably when I next built Tomcat) and so I will need to run them again but will try using the threads at the same time and then send you the results in a separate email. If you haven't cleared out the results from the logs directory you can do: ant test-status Mark - 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
Mark,I checked the logs folder and it was empty and so I am assuming that Any is clearing it each time I build Tomcat.John Original message From: Mark Thomas Date: 18/02/2022 18:16 (GMT+00:00) To: users@tomcat.apache.org Subject: Re: is too quick to respond On 18/02/2022 18:01, John Barrow wrote:>> Do you have a list of the tests which fail? Do you know how to get that list?> > Yes, although I am on Windows, not UNIX and so I don't have access to> grep. I did a simple search within logs for 'FAILED' and it came up> with about 20 or so. The list of test results has been cleared now> (probably when I next built Tomcat) and so I will need to run them> again but will try using the threads at the same time and then send> you the results in a separate email.If you haven't cleared out the results from the logs directory you can do:ant test-statusMark-To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.orgFor additional commands, e-mail: users-h...@tomcat.apache.org
RE: is too quick to respond
Hi, As mentioned in my last email, I have built a simple ‘Hello World’ Ant project in NetBeans, referencing an external library (GSON in my case) and the project properties looks quite different for the generated Ant project against the one that was created for Tomcat. The attached screenshot illustrates the differences (ignore the other unopened projects!) The 'Hello world' Ant project (source file attached) was created using the tools built into NetBeans so I - Created Java Application with Ant - Project name: HelloWorldAnt - Wrote the attached class - NetBeans flags up that com.google.gson library (jar) not found - Projects > HelloWorldAnt > Libraries - Locate gson-2.9.0.jar and open it - Library is added to the libaries folder within the project (as per screenshot) - Run project - compiles successfully and exports myLog to JSON in c:\Work\UserLogins.json (reproduced below). - I can also add breakpoints and step through the code during execution. The file structure for this simple Ant project looks a lot more complex than the one I am used to for Maven (see below). I am struggling to compare the two structures (HelloWorldAnt & Tomcat) as they look so different. While, I have not included any of the files in the directory structure listed below, happy to or upload the folder to DropBox. However, I think the exercise was more to determine that the Tomcat folder structure isn't as NetBeans would expect it for development to take place. Going to re-run the Tomcat tests and see if I can get a list of the failures in a suitable format. John Directory / File structure for created HelloWorldAnt project C:\Development\Work\HelloWorldAnt\build C:\Development\Work\HelloWorldAnt\build.xml C:\Development\Work\HelloWorldAnt\manifest.mf C:\Development\Work\HelloWorldAnt\nbproject C:\Development\Work\HelloWorldAnt\src C:\Development\Work\HelloWorldAnt\test C:\Development\Work\HelloWorldAnt\build\classes C:\Development\Work\HelloWorldAnt\build\classes\.netbeans_automatic_build C:\Development\Work\HelloWorldAnt\build\classes\.netbeans_update_resources C:\Development\Work\HelloWorldAnt\build\classes\helloworldant C:\Development\Work\HelloWorldAnt\build\classes\helloworldant\HelloWorldAnt.class C:\Development\Work\HelloWorldAnt\build\classes\helloworldant\HelloWorldAnt.rs C:\Development\Work\HelloWorldAnt\build\classes\helloworldant\TransactionLog$LocalDateSerializer.class C:\Development\Work\HelloWorldAnt\build\classes\helloworldant\TransactionLog$Transaction.class C:\Development\Work\HelloWorldAnt\build\classes\helloworldant\TransactionLog.class C:\Development\Work\HelloWorldAnt\nbproject\build-impl.xml C:\Development\Work\HelloWorldAnt\nbproject\genfiles.properties C:\Development\Work\HelloWorldAnt\nbproject\private C:\Development\Work\HelloWorldAnt\nbproject\project.properties C:\Development\Work\HelloWorldAnt\nbproject\project.xml C:\Development\Work\HelloWorldAnt\nbproject\private\private.properties C:\Development\Work\HelloWorldAnt\nbproject\private\private.xml C:\Development\Work\HelloWorldAnt\src\helloworldant C:\Development\Work\HelloWorldAnt\src\helloworldant\HelloWorldAnt.java gson (taken from my Maven .m2\repository) is referenced in project.properties in the following snippet excludes= file.reference.gson-2.9.0.jar=C:\\Users\\John\\.m2\\repository\\com\\google\\code\\gson\\gson\\2.9.0\\gson-2.9.0.jar includes=** jar.compress=false javac.classpath=\ ${file.reference.gson-2.9.0.jar} c:\Work\UserLogins.json file - { "KP": { "reference": "KP", "name": "Kevin Peters", "loggedIn": "2022-02-18" }, "MS": { "reference": "MS", "name": "Mike Smith", "loggedIn": "2022-02-18" }, "JB": { "reference": "JB", "name": "John Barrow", "loggedIn": "2022-02-18" } } From: Mark Thomas Sent: 18 February 2022 18:16 To: users@tomcat.apache.org Subject: Re: is too quick to respond On 18/02/2022 18:01, John Barrow wrote: >> Do you have a list of the tests which fail? Do you know how to get that list? > > Yes, although I am on Windows, not UNIX and so I don't have access to > grep. I did a simple search within logs for 'FAILED' and it came up > with about 20 or so. The list of test results has been cleared now > (probably when I next built Tomcat) and so I will need to run them > again but will try using the threads at the same time and then send > you the results in a separate email. If you haven't cleared out the results from the logs directory you can do: ant test-status Mark - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org