You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by "Srinath Perera (JIRA)" <ji...@apache.org> on 2007/06/11 20:21:26 UTC

[jira] Updated: (AXIS2-2738) Resource loading is not properly delegated from DeploymentClassLoader

     [ https://issues.apache.org/jira/browse/AXIS2-2738?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Srinath Perera updated AXIS2-2738:
----------------------------------

    Priority: Blocker  (was: Major)

> Resource loading is not properly delegated from DeploymentClassLoader
> ---------------------------------------------------------------------
>
>                 Key: AXIS2-2738
>                 URL: https://issues.apache.org/jira/browse/AXIS2-2738
>             Project: Axis 2.0 (Axis2)
>          Issue Type: Bug
>          Components: kernel
>    Affects Versions: 1.2
>         Environment: Windows XP, Tomcat 5.5, Java 1.5.0_11
>            Reporter: Fredrik Gustavsson
>            Assignee: Deepal Jayasinghe
>            Priority: Blocker
>
> The getResourceAsStream method (in the DeploymentClassLoader class) fails to find resources available higher up in the classloader hierarchy.
> For example when a service tries to load a resource available in a jar-file located in WEB-INF/lib (which means that it get loaded by the WebApp classloader in Tomcat which is an "grandparent" to the DeplymentClassLoader). 
> In our case we have xmlbean genereated resources common to many services in that jar.
> Reason:
> DeploymentClassLoader .getResourceAsStream  calls DeploymentClassLoader.findResource which delegates to super.findResource (URLClassLoader).
> URLClassLoader.findResource however doesn't delegate its search up the hierarchy.
> A way to get it to work (at least for us) is to first call the getResource (ClassLoader) method in the DeploymentClassLoader .getResourceAsStream as the code below shows.
> ---- Modified DeploymentClassLoader .getResourceAsStream snippet
>    public InputStream getResourceAsStream(String name) {
>       URL url = getResource(name);
>       if (url == null) {
>          url = findResource(name);
>       }
>       if (url != null) {
>          try {
>             return url.openStream();
>          }
>          catch (IOException e) {
>             throw new RuntimeException(e);
>          }
>       }
>       return null;
>    }

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: axis-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-dev-help@ws.apache.org