Issue loading module when classpath is on a network
---------------------------------------------------

                 Key: AXIS2-3756
                 URL: https://issues.apache.org/jira/browse/AXIS2-3756
             Project: Axis 2.0 (Axis2)
          Issue Type: Bug
          Components: kernel
    Affects Versions: 1.3
         Environment: Windows XP, Windows Server 2003
            Reporter: Mikkel T. Jensen



When the classpath of a client application is setup to point to a network (e.g. 
\\servername\share\domain_classpath, for instance in a cluster of application 
servers), axis2 fails to engage modules on the classpath with an AxisFault with 
the message "Unable to engage module". The problem is located in the class 
org.apache.axis2.deployment.RepositoryListener in the method 
loadClassPathModules():

    protected void loadClassPathModules() {
        ModuleDeployer deployer = deploymentEngine.getModuleDeployer();

        // Find Modules on the class path (i.e. if classpath includes 
"addressing.mar" then
        // addressing will be available for engaging)

        ClassLoader loader = Thread.currentThread().getContextClassLoader();
        try {
            Enumeration moduleURLs = loader.getResources("META-INF/module.xml");
            while (moduleURLs.hasMoreElements()) {
                try {
                    URL url = (URL)moduleURLs.nextElement();
                    String fileName = url.toString();
                    if (fileName.startsWith("jar")) {
                        url = ((java.net.JarURLConnection) 
url.openConnection()).getJarFileURL();
                        fileName = url.toString();
                         File f = new File(new URI(fileName));
                        addFileToDeploy(f, deployer ,WSInfo.TYPE_MODULE);
                    } else if (fileName.startsWith("file")) {
                        fileName = fileName.substring(0, 
fileName.lastIndexOf("/META-INF/module.xml"));
                        File f = new File(new URI(fileName));                   
                                      // *** IllegalArgumentException thrown 
here!
                        addFileToDeploy(f, deployer ,WSInfo.TYPE_MODULE);
                    } 

                } catch (URISyntaxException e) {
                    log.info(e);
                }
            }
        } catch (Exception e) {
            // Oh well, log the problem
            log.debug(e);
        }
// rest of method omitted.

The method finds all the module.xml files on the classpath and creates a File 
object for each of them. The use of the File class assumes that the classloader 
is not a network classloader. However, If the classpath is set up as mentioned 
above, the URI created will contain an authority part, and an 
IllegalArgumentException is thrown in the line marked *** above. To make things 
worse, the loop is terminated by the exception, which is debugged to a log 
(meaning it is lost in my system, and probably most others). 

Possible solutions:

As a minimum, error handling should be improved to make it easier to locate 
this problem when it happens.

The use of File instances to load the module.xml files should eliminated 
(replaced by InputStreams?) to make module loading robust to classloaders 
working over a network.


-- 
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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to