Frage

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.

War es hilfreich?

Lösung

Updating weblogic.xml did the trick:

<container-descriptor>
    <show-archived-real-path-enabled>true</show-archived-real-path-enabled>
</container-descriptor>
Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top