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.

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.

Right-mouse on the project, then:

Properties->Libraries
Click on the Add Jar / Folder button

Browse to your jar files and add them. Then when NetBeans builds the
project, they will be included in the war file.

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

2. Seriously consider using a Maven-based project instead of an
Ant-based project
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.

4. Do not use generic top-level package names. Consider starting
everything with org.franquesa.

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

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/

Yes, there are reasons to manage your own database pooling, but there
are not that many use cases for it.

PS: I fixed some obvious typos in your posted project, built it, and ran
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).

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to