accumulo-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jim Klucar (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (ACCUMULO-4005) AccumuloClassLoader not finding classes
Date Mon, 21 Sep 2015 10:43:04 GMT

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

Jim Klucar commented on ACCUMULO-4005:
--------------------------------------

If you look at the default general.classpaths at the top of the file, they
all won't get loaded. In my case in particular, /usr/lib/hadoop/[^.].*.jar
never got found. I believe the problem is that that string isn't a file or
a directory. The workaround is adding the environment variable to take a
different code path.

My opinion on this whole class is that it should be refactored. Private
static methods are pretty un-testable and are a bad idea in general.
Without them we could easily write a test case to show what's going on.

Also, a regex in a classpath isn't the Java way. Java will only load every
jar in a directory, using the format /my/class/path/* or complete paths to
a single jar file like /my/class/path/my.jar A directory path like
/my/class/path on the classpath will only load .class files found there or
in the appropriate subdirectories of there. Sticking to the Java convention
would be a better idea. If we want to support regex, we should do so
explicitly somewhere else like general.classpaths.regex




> AccumuloClassLoader not finding classes
> ---------------------------------------
>
>                 Key: ACCUMULO-4005
>                 URL: https://issues.apache.org/jira/browse/ACCUMULO-4005
>             Project: Accumulo
>          Issue Type: Bug
>          Components: start
>    Affects Versions: 1.7.0
>            Reporter: Jim Klucar
>
> org.apache.accumulo.start.classloader.AccumuloClassLoader is not correctly loading classes
described in the general.classpaths property. Is appears that if a classpath contains an environment
variable for substitution, the class/regex will get loaded. The offending line of code is
a boolean logic error on line 198.
> if (extDir.isDirectory())
>   urls.add(extDir.toURI().toURL());
> else {
> ...
> the correction should be 
> if(extDir.isFile())
> but I have not tested this. 
> A workaround is to add a bogus environment variable that will substitute to the empty
string in general.classpaths For example
> $DOESNT_EXIST/usr/lib/hadoop/[^.].*.jar 



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Mime
View raw message