I'm migrating a legacy code to weblogic 12c. The code uses getServletContext().getRealPath("/")
which returns null
, because the specification say:
This method returns null if the servlet container cannot translate the virtual path to a real path for any reason (such as when the content is being made available from a .war archive).
Here is a workaround, what I tried, but it didn't worked. I've checked the Accept Context Path In Get Real Path
, restarted the cluster and redeployed the app, but the real path is still null
.
Is there any way to handle this?
I need the real path, because the app gets the images
dir, and put it into a jasper report file, to load a specific image.
Unfortunately the code-rewriting is not an option.
Updating weblogic.xml
did the trick:
<container-descriptor>
<show-archived-real-path-enabled>true</show-archived-real-path-enabled>
</container-descriptor>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With