Not able to load resources folder file | Community
Skip to main content
Level 2
Oct 25, 2018 2:26 PM UTC
Solved

Not able to load resources folder file

Hi Team,

We are trying to load "geodb.mmdb" which is present in resources folder in our AEM bundle code.
Maxmind uses this mmdb file.
Code for loading the file:

File database = new File(classLoader.getResource("geodb.mmdb").getFile());
dbReader = new DatabaseReader.Builder(database).build();

We are pretty sure that the file exists in the resources folder in our maven project. When we build our package and upload it in AEM we get "java.io.FileNotFoundException: \geodb.mmdb (The system cannot find the file specified)" exception when we hit the servlet.

Thanks,

Mohit

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
mohitaemAccepted solution
Level 2
Oct 26, 2018 6:14 AM UTC

Thanks so much for the quick response smacdonald2008

The stackoverflow post was really useful to find the right solution.

This is the code for loading the inputStream from the file which is inside the resources folder in bundle jar.

Thanks,

Mohit

2 replies

mohitaemAuthorAccepted solution
Level 2
Oct 26, 2018 6:14 AM UTC

Thanks so much for the quick response smacdonald2008

The stackoverflow post was really useful to find the right solution.

This is the code for loading the inputStream from the file which is inside the resources folder in bundle jar.

Thanks,

Mohit

Translate
smacdonald2008
Level 10
Oct 25, 2018 4:22 PM UTC