Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3218110
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T15:29:22+00:00 2026-05-17T15:29:22+00:00

I have a webapp running in my local Tomcat. The path is: tomcat/webapps/myproject .

  • 0

I have a webapp running in my local Tomcat. The path is: tomcat/webapps/myproject.
I have some resources in this project all in a folder with this path: tomcat/webapps/myproject/resources

So, I am trying to acces to this resources from a Java project, using a file config.properties. In this file I have something like this:

tomcat.url= http://localhost
tomcat.port=8080
tomcat.resources=/myproject/resources

I tryed also different combinations of / or \ but I get this error running my project:

Trying to acces to a directory that does not exist

My Java code:

Configuration config = new PropertiesConfiguration("config.properties");    
String sourcePath = config.getString("tomcat.resources");
//And I try to list this folder  
File dir = new File(sourcePath);
String[] children = dir.list();         
if (children == null) {          
    // Either dir does not exist or is not a directory
    throw new ServiceExecutionException("Trying to generate Metadata in a directory that does not exist");                  
} 

I don’t know what is wrong, in projects I made before, simliar to this, I had something similar and it found everything.
Any ideas?? Thanks in advance.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-17T15:29:23+00:00Added an answer on May 17, 2026 at 3:29 pm

    the file must be located at tomcat/webapps/myproject/src/main/resources Check update.

    I don’t know how you are accessing the file, but just in case I’d recommend you to use PropertiesConfiguration

     private static final String CONFIGURATION_PATH = "config.properties";
     PropertiesConfiguration configuration = new PropertiesConfiguration(CONFIGURATION_PATH);
    

    Edited

    The problem is that you are trying to open a file located (keeping in mind that “/” is your root file system) at /myproject/resources when your file is located at (probably) /var/lib/tomcat6/webapps/myproject/resources.

    You can get the real path of your file using ServletContext#getRealPath

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

No related questions found

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.