Missatge de Mark Eggers <its_toas...@yahoo.com.invalid> del dia dt., 1 de set. 2020 a les 21:47:
> Carles, > > > On 9/1/2020 11:23 AM, Christopher Schultz wrote: > > Carles, > > > > On 9/1/20 14:08, Carles Franquesa wrote: > >> This message is a reply to those that asked me for uploading a > >> simple version of my webapp reproducing the problem of not finding > >> classes when a JSP is inside a subfolder, thus not hanging directly > >> from web root directly. > > > >> I have slimmed down the code as much as possible. You'll see is > >> almost nothing. > > > >> algorismes.zip > >> <https://drive.google.com/file/d/1RUanXza2wjCBQimjum-LlbGNaYP6vs4O/vie > > w?usp=drive_web> > > > > > > > >> So, the project's became very simple, but the problem is there: > > > >> Built with NetBeans 8.0.2 on Windows 10 Tested on local host (so > >> tomcat running on windows), it works My VPS holds a public web > >> domain called algosismes.cat. Tested on my VPS, it depends. > > > >> Once deploy's done with tomcat 8.5.57 manager app, clicking on its > >> list of sites, it works, since the browser is connecting to the > >> ip:port/algorismes. > > > >> Setting directly "algorismes.cat" in the browser url, the error is > >> found. Just click to go to the level2.jsp. > > > >> Lervel2.jsp is a blank page that just declares ann object of class > >> Student to show the problem. > > > >> Anybody can explain to me what am i doing wrong? > > > > The ZIP file does not contain a build web application. Can you publish > > your WAR file instead of mixed source/resources? > > > > It's pretty important how you build the WAR, which is why I'm asking > > for it. > > > > -chris > > > > --------------------------------------------------------------------- > > To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org > > For additional commands, e-mail: users-h...@tomcat.apache.org > > > > There are a lot of issues with your project that have nothing to do with > Tomcat. I'm going to assume that most of your project problems exist > because of how aggressively you stripped down your project. > I don't know what are you referring to. But I would like to! > As a start, you'll need to set up your project correctly in NetBeans. > > Instead of just copying the commons-fileupload-1.3.jar and > commons-io-2.2.jar into WEB-INF/lib, you'll need to add them to your > project. > I was not sure where to put them, and now they are in both places. > > Right-mouse on the project, then: > > Properties->Libraries > Click on the Add Jar / Folder button > Already did that. > > Browse to your jar files and add them. Then when NetBeans builds the > project, they will be included in the war file. > Thanks for clarify me about this. > > I've checked, and all of the files are in the proper place in the built > war file. > Now some project notes: > > 1. Start with using NetBeans 12 - netbeans.apache.org > > I will do it. > 2. Seriously consider using a Maven-based project instead of an > Ant-based project > Perhaps may be because I am too old, but I am not used to this reference managers. I don't use maven neither gradle,... I work in an old fashioned way! > This will make dependency management much easier. > > 3. Seriously consider using the NetBeans built-in CDNJS manager for > JavaScript libraries > This will make JavaScript dependency management much easier. > If this is one of my problems, I do not realize it. > 4. Do not use generic top-level package names. Consider starting > everything with org.franquesa. > Why? > > 5. Do not manage database access on your own. Use JNDI and Tomcat's > pooling. > See: http://tomcat.apache.org/tomcat-8.5-doc/jndi-resources-howto.html I like to use database access on my own. Is this a problem? Sorry for my ignorance, but I only change the way I work when I understand why I do it. > > > See Christopher Schultz's excellent document on how to properly handle > pooled JDBC connections: > > > https://blog.christopherschultz.net/2009/03/16/properly-handling-pooled-jdbc-connections/ > > Thanks. Just read it, and will try to modify the code accordingly, since have already had this kind of leaks. > Yes, there are reasons to manage your own database pooling, but there > are not that many use cases for it. > I would thank you for unwrapping this. I can't imagine which use cases are you talking on. > PS: I fixed some obvious typos in your posted project, built it, and ran > Also, would like to know which typos you say. > it on Tomcat 9.0.37 and JDK 11 on a local internal system (not > localhost). I was able to successfully click on the first page and > navigate to the second page (/appname/folder/level2.jsp). > > Thanks for your words. It's been very useful. This is certainly an illustrative mail! Carles