Here are several approaches you could try to diagnose and possibly resolve the 
problem:

        1.      Check Tomcat Version Compatibility: Ensure that the Tomcat 9 
version you’re using is fully compatible with the version of the JDK configured 
in NetBeans and the JDK used by Tomcat itself. Since you mentioned Apache uses 
Java 11 and your apps target Java 8, this could lead to inconsistencies. 
Sometimes, Tomcat might need specific JDK versions to function properly.
        2.      Review Tomcat Logs: Look in the Tomcat logs (catalina.out and 
others in the logs directory) for any warning or error messages that occur when 
you try to deploy the problematic app. These logs can provide clues about what 
might be going wrong during the deployment process.
        3.      Examine Deployment Descriptors: Since the web-app versions 
differ between your two applications, make sure that your deployment 
descriptors (web.xml) and any related configuration files (like context.xml) 
are correctly formatted and include all necessary specifications that match 
Tomcat’s requirements.
        4.      Ensure Project Settings Consistency: Compare the project 
settings in NetBeans for both projects. Check for any discrepancies in the way 
the projects are configured under Project Properties -> Build -> Compiling and 
Run. Ensure that both are set to use the same JDK and similar settings.
        5.      Manual Deployment Test: Try manually deploying the WAR file to 
Tomcat outside of NetBeans. You can do this by placing the WAR file in the 
webapps directory of Tomcat and then starting/restarting Tomcat. Watch the 
Tomcat logs for any deployment messages. This can help isolate the issue to 
either the application itself or the way NetBeans interacts with Tomcat.
        6.      Permissions and Path Issues: Since you are running on MacOS, 
ensure there are no permission issues with the NetBeans or Tomcat directories. 
Also, verify that all paths in any custom configurations (like in context.xml) 
are correct and accessible by Tomcat.
        7.      NetBeans Clean and Build: Sometimes, clearing out all build 
data can help. Use the “Clean and Build” function from the project’s context 
menu in NetBeans, which might clear up any lingering issues from previous 
compilations.
        8.      JDK Misconfiguration: Double-check that the JDK configured in 
NetBeans (for both compiling and running) matches the JDK version required by 
your Tomcat and your application. JDK misconfigurations can lead to subtle 
problems that are hard to diagnose.

If after these steps the problem still persists, it might be useful to create a 
simple test application with minimal configuration and see if that deploys 
successfully. This could help determine if the issue is project-specific or 
related to your development environment setup.
Brian Allison
Innovative Systems Software

> On Apr 28, 2024, at 4:47 PM, Thad Humphries <thad.humphr...@gmail.com> wrote:
> 
> have two web app projects in NB21. One app installs to the Tomcat 9 that I 
> use for development, and it runs fine. However the second app will not 
> install, although it uses similar run configuration settings. 
> 
> My NetBeans info is
> 
> Product Version: Apache NetBeans IDE 21
> Java: 17.0.9; OpenJDK 64-Bit Server VM 17.0.9+8-LTS
> Runtime: OpenJDK Runtime Environment 17.0.9+8-LTS
> System: Mac OS X version 14.4.1 running on aarch64; UTF-8; en_US (nb)
> User directory: /Users/thad/Library/Application Support/NetBeans/21
> Cache directory: /Users/thad/Library/Caches/NetBeans/21
> 
> The OpenJDK is Amazon Corretto. Apache is using Java 11. Both apps target 
> Java 8. The app that works uses web-app version 4.0. This problem app uses 
> web-app version 3.1. 
> 
> Oddly, both apps are working fine on an older Mac with NB18 (see below). 
> 
> Product Version: Apache NetBeans IDE 18
> Java: 17.0.4; OpenJDK 64-Bit Server VM 17.0.4+8-LTS
> Runtime: OpenJDK Runtime Environment 17.0.4+8-LTS
> System: Mac OS X version 10.15.7 running on x86_64; UTF-8; en_US (nb)
> User directory: /Users/thad/Library/Application Support/NetBeans/18
> Cache directory: /Users/thad/Library/Caches/NetBeans/18   
> 
> The Tomcat install on both Macs is the same.
> 
> I tried various solutions, but none have worked:
> 
> - updating the problem app to 4.0
> - deleting the app; cloning it from Git; and rebuilding it
> - shutting down NetBeans, removing ~/Library/Caches/NetBeans/21, and 
> restarting NetBeans
> - copying the META-INF/context.xml to the Tomcat conf/Catalina/localhost with 
> the appropriate name, and docBase having the full path to the app in the 
> project's target directory. On starting Tomcat, the file is deleted (which is 
> the only time the app appears in any of the Tomcat logs; there are no errors).

Reply via email to