I was trying to read in a csv file and import into one of the domain classes. I was doing this action in the bootstrap.groovy file. I stored my csv file in every folder I could think of but the code would always complain that it could not find it.
ERROR context.GrailsContextLoaderListener - Error initializing the application: \MOCK_DATA.csv (The system cannot find the file specified)
I found some resources that I thought would fix my problem, but this error always happened. Hours later I removed all my code and changes that I had made to import this file and discovered I still got the same error!!!! I searched the Grails program directory and confirmed there was no MOCK_DATA.csv file. I searched all my code and confirmed I wasn’t asking for MOCK_DATA.csv anywhere. I cleaned my project, refreshed-dependencies, rebuilt, etc. No luck. So I closed eclipse, copied out my project from the workspace and deleted the workspace’s .metadata. Opened eclipse and imported project, but then I got the following error:
'Update Installed JREs' has encountered a problem. Resource '/.org.eclipse.jdt.core.external.folders' already exists.
To solve this problem I ended up creating a new Grails project in Eclipse and copied over everything in the grails-app folder from my original project. That ended up being the only solution. Moral of the story: Don’t copy files willy nilly in your Grails project. Now onto my original task of importing a csv file and where in the Grails project folder can I put it.