axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Alex G (JIRA)" <j...@apache.org>
Subject [jira] Created: (AXIS2-2679) DeploymentClassloader unable to access resources from parent classloader
Date Wed, 16 May 2007 22:30:16 GMT
DeploymentClassloader unable to access resources from parent classloader
------------------------------------------------------------------------

                 Key: AXIS2-2679
                 URL: https://issues.apache.org/jira/browse/AXIS2-2679
             Project: Axis 2.0 (Axis2)
          Issue Type: Bug
          Components: kernel
    Affects Versions: 1.2
            Reporter: Alex G


The following code does not work:
                AxisService serv = <GET SERVICE SOMEHOW>
                _log.debug("DEPLOYED SERVICE: " + serv.getName());
                _log.info("************* SPRING LOAD *****************");

                ClassPathXmlApplicationContext appContext = new ClassPathXmlApplicationContext(
                        new String[] { "/META-INF/spring/web-components.xml" },
                        false,
                       parentContext);
                appContext.setClassLoader(serv.getClassLoader());
                appContext.refresh();


It complains about missing schemas (since web-components.xml is using spring schemas).
I tracked the problem down to Axis2 DeploymentClassloader and discovered that this classloader
would not load any resource that is located in the parent classloader dues to the following
code:

    public InputStream getResourceAsStream(String name) {
       URL url =findResource(name);
        if(url!=null){
            try {
                return url.openStream();
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }
        return null;
    }

Acoording to J2SE API spec (in my interpretaion), first line should be
URL url =getResource(name); and not URL url =findResource(name);

Changing findResource to getResource - fixes the problem.



Formal diff:

==== modules/kernel/src/org/apache/axis2/deployment/DeploymentClassLoader.java#1 - modules/kernel/src/org/apache/axis2/deployment/DeploymentClassLoader.java
====252c252
<         URL url =findResource(name);
---
>         URL url =getResource(name);





-- 
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


Mime
View raw message