[MAGNOLIA-1754] weblogic: ServletContext.getRealPath doesn't work in older weblogic version Created: 01/Oct/07  Updated: 23/Jan/13  Resolved: 18/Dec/07

Status: Closed
Project: Magnolia
Component/s: core
Affects Version/s: 3.1 M3
Fix Version/s: 3.5 RC1

Type: Bug Priority: Blocker
Reporter: Sameer Charles Assignee: Jan Haderka
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
relation
is related to MGNLWLS-1 weblogic: ServletContext.getRealPath ... Closed
Template:
Acceptance criteria:
Empty
Task DoD:
[ ]* Doc/release notes changes? Comment present?
[ ]* Downstream builds green?
[ ]* Solution information and context easily available?
[ ]* Tests
[ ]* FixVersion filled and not yet released
[ ]  Architecture Decision Record (ADR)
Bug DoR:
[ ]* Steps to reproduce, expected, and actual results filled
[ ]* Affected version filled
Date of First Response:

 Description   

ServletContext.getRealPath only works where war is exploded on the file system.
in case of weblogic getRealPath always returns null.

PropertyInitializer.java (line 278) results in a NullPointerException
String rootPath = StringUtils.replace(context.getRealPath(StringUtils.EMPTY), "
", "/");



 Comments   
Comment by Jan Haderka [ 10/Oct/07 ]

From BEA:
Issue tracking number: CR299135

Status:
Solved for Weblogic version 10 and higher

Description:
If you deploy a web app as an archive war file, then
context.getRealPath() returns null. This behavior can lead to certain
failures in cases where the web app is dependent on the path.

Solution:
Use the <show-archived-real-path-enabled> flag to specify that
context.getRealPath() returns the path of the resource from the Server's
internal webapp extraction directory for archived web applications. The
flag can be configured in two ways:

  • At domain level in config.xml. For example:
    <web-app-container>
    <show-archived-real-path-enabled>true
    </show-archived-real-path-enabled>
    </web-app-container>
  • At the web app level in weblogic.xml. For example:
    <container-descriptor>
    <show-archived-real-path-enabled>true
    </show-archived-real-path-enabled>
    </container-descriptor>
    The value of <show-archived-real-path-enabled> set in the web app has
    precedence over the value set at the domain level. The default value of
    this property is false.
    Note that, if this path is used to dynamically copy some content to this
    directory location, the content will end up in the Server's internal web
    app extraction directory. When the web app is recompiled for any reason,
    the web app may be re-extracted and previously copied content will be
    lost.
Comment by Boris Kraft [ 13/Nov/07 ]

Does this mean we do not support weblogic before version 10? Or is this workaround good enough to deploy on earlier versions (which?). We do have people asking to run on Weblogic 8.1 I believe...

Comment by Jan Haderka [ 18/Dec/07 ]

Described workaround is good only for WLS 10.0 and higher. If we have to support older versions then WLS 10.0 this issue have to be solved in some other manner.
Reopening to work out solution for WLS 9.2.

Comment by Jan Haderka [ 18/Dec/07 ]

Will be taken care of by MAGNOLIA-1965

Generated at Mon Feb 12 03:30:00 CET 2024 using Jira 9.4.2#940002-sha1:46d1a51de284217efdcb32434eab47a99af2938b.