Developed project using grails-3.3.1 and generated a Runnable WAR file. When I run using the command:
java -jar build/libs/myproject-0.1.war
It is returning null
for the following line:
serveltContext.getRealPath("/someSource");
But it is working fine when deployed in a Tomcat Container.
Then tried the following way:
servletContext.getResource("someSource").getPath();
It is returning, but not the one as expected and not what getRealPath()
returns.
It is returning like this:
D:/myprojects/myproject/build/libs/myproject-01.war*/
which serves no use for me. Found answers suggesting to use getResourceAsStream()
but I don't want a resource, I want only String
.