Java App fails to start because property files not found

Answered

Hi,

I'm new to IntelliJ & java development, so excuse me if I use the wrong terminology.

Whenever, I try to debug a web app, the build completes successfully and the war package deploys.
However, when the app fails to start and the web page appears with an HTTP Status 500 error
 

I've checked my setup with a colleague who does not have this problem and we are appear to be running the same configuration.

The details are:
"Type Exception Report

Message C:\Program Files\Apache Software Foundation\Tomcat 9.0\webapps\ROOT\WEB-INF\classes\environment.properties (The system cannot find the path specified)

Description The server encountered an unexpected condition that prevented it from fulfilling the request.

Exception

java.io.FileNotFoundException: C:\Program Files\Apache Software Foundation\Tomcat 9.0\webapps\ROOT\WEB-INF\classes\environment.properties (The system cannot find the path specified)"

I've checked the ROOT\WEB-INF directory and there is no “classes” sub directory, The only content is a file called web.xml

However, if I check for the classes sub directory of the deployed application  as “C:\…\webapps\{web-app-name}\WEB-INF\classes” I do see the missing file, plus several other files.

If I try running the deployed web app from the Tomcat Manager app, I get the same result except the “C:\Program Files\Apache Software Foundation\Tomcat 9.0” gets replaced with “null” (i.e. “null\webapps\ROOT\WEB-INF\classes\environment.properties (The system cannot find the path specified)”)

I have uninstalled and re-installed IntelliJ and Tomcat several times and always get the same result.

Is there a setting in IntelliJ (or Tomcat/Windows) that needs to be set which causes the {web-app} directory to be used to search for files rather than the top level Tomcat directories?

Windows: Version 24H2 (Build 26100.2894)
IntelliJ : 2024.2.3 (Build 243.23654.117) 
Tomcat: 9.0.82

Sorry to be so vague.

Thanks very much for any help 


 

0
3 comments

Hello,

Does the Web app run well directly via Windows Command Prompt using C:\Program Files\Apache Software Foundation\Tomcat 9.0\startup.bat? What's the output?

BTW, please attach the IDEA logs via the menu Help > Collect logs and Diagnostic Data if possible, please upload it to https://uploads.jetbrains.com/ and paste the upload id here, the uploaded file is only visible to JetBrains employees.

 

 java.io.FileNotFoundException: C:\Program Files\Apache Software Foundation\Tomcat 9.0\webapps\ROOT\WEB-INF\classes\environment.properties (The system cannot find the path specified)"

Please share the full stacktrace of above log.

0

Hello,

Thanks very much for your reply. I've uploaded the logs.

Upload id: 2025_01_27_CABMqQxExvFVN25aiPBEMv (file: idea-logs-20250127-07492812045118640152812758.zip)

I've raised a ticket with support (#7199134) and have replied with more details on that.

Kind regards

0

Found out that this was a PICNIC* problem.

I had missed setting up  something specific to the apps I was working on.

This meant the sub-directory was missing when Intellij copied my local Tomcat installation to generate the build.

Once I created the missing items, it all worked perfectly.

Thanks very much and I'll now go and hide in the cupboard until my embarrassment subsides.

Kind regards

(*Problem In Chair Not In Computer)

0

Please sign in to leave a comment.