You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@sqoop.apache.org by "Jarek Jarcec Cecho (JIRA)" <ji...@apache.org> on 2012/06/15 18:55:42 UTC

[jira] [Commented] (SQOOP-504) Windows bug: unable to load jar

    [ https://issues.apache.org/jira/browse/SQOOP-504?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13295762#comment-13295762 ] 

Jarek Jarcec Cecho commented on SQOOP-504:
------------------------------------------

Hi Alban,
could you please attach your patch as a file and select "Grant license to ASF for inclusion in ASF works (as per the Apache License ยง5)" option? I'm afraid that our hands are tighten up without that.

Jarcec
                
> Windows bug: unable to load jar
> -------------------------------
>
>                 Key: SQOOP-504
>                 URL: https://issues.apache.org/jira/browse/SQOOP-504
>             Project: Sqoop
>          Issue Type: Bug
>          Components: codegen
>    Affects Versions: 1.4.2
>         Environment: Windows
>            Reporter: Alban Perillat
>   Original Estimate: 1h
>  Remaining Estimate: 1h
>
> A piece of code was unix specific for loading a jar.
> Here is the patch for a generic implementation (works for windows too):
> (Or see github pull request : https://github.com/apache/sqoop/pull/1)
> src/java/org/apache/sqoop/util/ClassLoaderStack.java
> old	new	
> ...	...	@@ -75,10 +75,10 @@ public final class ClassLoaderStack {
> 75	75	       }
> 76	76	     }
> 77	77	 
> 78		-    String urlPath = "jar:file://" + new File(jarFile).getAbsolutePath() + "!/";
> 79		-    LOG.debug("Attempting to load jar through URL: " + urlPath);
> 	78	+    URL url = new File(jarFile).toURI().toURL();
> 	79	+    LOG.debug("Attempting to load jar through URL: " + url);
> 80	80	     LOG.debug("Previous classloader is " + prevClassLoader);
> 81		-    URL [] jarUrlArray = {new URL(urlPath)};
> 	81	+    URL[] jarUrlArray = { url };
> 82	82	     URLClassLoader cl = URLClassLoader.newInstance(jarUrlArray,
> 83	83	         prevClassLoader);
> 84	84	     try {
> ...	...	@@ -87,7 +87,7 @@ public final class ClassLoaderStack {
> 87	87	         LOG.debug("Testing class in jar: " + testClassName);
> 88	88	         Class.forName(testClassName, true, cl);
> 89	89	       }
> 90		-      LOG.debug("Loaded jar into current JVM: " + urlPath);
> 	90	+      LOG.debug("Loaded jar into current JVM: " + url);
> 91	91	     } catch (ClassNotFoundException cnfe) {
> 92	92	       throw new IOException("Could not load jar " + jarFile
> 93	93	           + " into JVM. (Could not find class "

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira