Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

WebLogic 12c getRealPath

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.

like image 869
krstf Avatar asked Feb 16 '23 16:02

krstf


1 Answers

Updating weblogic.xml did the trick:

<container-descriptor>
    <show-archived-real-path-enabled>true</show-archived-real-path-enabled>
</container-descriptor>
like image 134
krstf Avatar answered May 14 '23 14:05

krstf