IBM Support

PI56831: Classloader.getResource("") does not return url to WEB-INF/class es

Subscribe

You can track all active APARs for this component.

 

APAR status

  • Closed as program error.

Error description

  • Open source frameworks such as Spring expect getResource("")
    to return a file or jar url to WEB-INF/classes. In Liberty
    this returns a reference to a bundleresource url. This can
    cause these frameworks some problems such as this stack
    trace from Spring Framework:
    
    
    
    
    
    java.io.FileNotFoundException: class path resource [] cannot
    be resolved to absolute file path because it does not reside
    in the file system: bundleresource://189.fwk1571932254/
    
    at
    org.springframework.util.ResourceUtils.getFile(ResourceUtils
    .java:205)
    
    at
    org.springframework.core.io.AbstractFileResolvingResource.ge
    tFile(AbstractFileResolvingResource.java:52)
    
    at
    org.springframework.core.io.support.PathMatchingResourcePatt
    ernResolver.doFindPathMatchingFileResources(PathMatchingReso
    urcePatternResolver.java:526)
    
    at
    org.springframework.web.context.support.ServletContextResour
    cePatternResolver.doFindPathMatchingFileResources(ServletCon
    textResourcePatternResolver.java:92)
    
    at
    org.springframework.core.io.support.PathMatchingResourcePatt
    ernResolver.findPathMatchingResources(PathMatchingResourcePa
    tternResolver.java:347)
    

Local fix

Problem summary

  • ****************************************************************
    * USERS AFFECTED:  All users of IBM WebSphere Application      *
    *                  Server Liberty Profile                      *
    ****************************************************************
    * PROBLEM DESCRIPTION: Classloader.getResource("") does not    *
    *                      return url to WEB-INF/classes           *
    ****************************************************************
    * RECOMMENDATION:                                              *
    ****************************************************************
    Open source frameworks such as Spring expect getResource("") to
    return a file or jar url to WEB-INF/classes. In Liberty this
    returns a reference to a bundleresource url. This can cause
    these frameworks some problems such as this stack trace from
    Spring Framework:
    
    
    java.io.FileNotFoundException: class path resource [] cannot be
    resolved to absolute file path because it does not reside in the
    file system: bundleresource://189.fwk1571932254/
    at
    org.springframework.util.ResourceUtils.getFile(ResourceUtils.jav
    a:205)
    at
    org.springframework.core.io.AbstractFileResolvingResource.getFil
    e(AbstractFileResolvingResource.java:52)
    at
    org.springframework.core.io.support.PathMatchingResourcePatternR
    esolver.doFindPathMatchingFileResources(PathMatchingResourcePatt
    ernResolver.java:526)
    at
    org.springframework.web.context.support.ServletContextResourcePa
    tternResolver.doFindPathMatchingFileResources(ServletContextReso
    urcePatternResolver.java:92)
    at
    org.springframework.core.io.support.PathMatchingResourcePatternR
    esolver.findPathMatchingResources(PathMatchingResourcePatternRes
    olver.java:347)
    

Problem conclusion

  • The runtime was updated so requests for "" and "/" result in
    resources from the application being returned rather than the
    runtime. The classloader order of items was also updated to be
    consistent with the traditional application server, and to
    ensure that WEB-INF/classes is at the start of the classpath, in
    common with other application servers.
    
    The fix for this APAR is currently targeted for inclusion in fix
    pack 8.5.5.9.  Please refer to the Recommended Updates page for
    delivery information:
    http://www.ibm.com/support/docview.wss?rs=180&uid=swg27004980
    

Temporary fix

Comments

APAR Information

  • APAR number

    PI56831

  • Reported component name

    LIBERTY PROFILE

  • Reported component ID

    5724J0814

  • Reported release

    855

  • Status

    CLOSED PER

  • PE

    NoPE

  • HIPER

    NoHIPER

  • Special Attention

    NoSpecatt / Xsystem

  • Submitted date

    2016-02-08

  • Closed date

    2016-02-25

  • Last modified date

    2016-02-25

  • APAR is sysrouted FROM one or more of the following:

  • APAR is sysrouted TO one or more of the following:

Fix information

  • Fixed component name

    LIBERTY PROFILE

  • Fixed component ID

    5724J0814

Applicable component levels

  • R855 PSY

       UP

[{"Business Unit":{"code":"BU053","label":"Cloud \u0026 Data Platform"},"Product":{"code":"SSEQTP","label":"WebSphere Application Server"},"Platform":[{"code":"PF025","label":"Platform Independent"}],"Version":"855","Line of Business":{"code":"LOB36","label":"IBM Automation"}}]

Document Information

Modified date:
16 October 2021