Google+ ServletContext.getRealPath() returns null ? Here is the solution ~ Java Geek Zone

Friday 1 August 2014

On 03:34 by Unknown in , ,    1 comment
If your code is using Servlet.getRealPath() and Weblogic Server[WLS] returns null . You might be thinking that it's one more weblogic server bug but it's not a bug.

It depends on how you deploy your application. If the application was deployed using exploded mode, getRealPath returns occured, valid value. But if you deploy application as an archive having extentions like ear, war etc. you will get "null pointer" Exception.

Good news is,There are two simple way to solve this exception.

1. you can solve this issue in domain level, setting weblogic Admin Console option Domain | Web Application | Archived Real Path Enabled to true, as mentioned below:



You can also correct this issue in application level by configuring below mentioned entry to weblogic.xml file in your application:


true


Cheers!!!

1 comment: