junegunn / hbase-jruby

A JRuby binding for HBase
MIT License
38 stars 14 forks source link

HBase 0.96 dependency resolution doesn't seem to work #28

Closed ajwootto closed 10 years ago

ajwootto commented 10 years ago

The POM file the gem generates when given '0.96' as a parameter doesn't properly execute in Maven, giving the error:

failed to execute goal on project hbase-project: Could not resolve dependencies for project hbase-jruby:hbase-project:jar:0.4.4: Failure to find org.apache.hbase:hbase:jar:0.96.1.1-hadoop2 in http://repo.maven.apache.org/maven2

I'm not experienced with Maven but could it be caused by there being no jar files in the repo it's looking in? This seems to be the difference between the 0.96 and 0.94 repos.

junegunn commented 10 years ago

Hi, thanks for the report. I haven't been able to pay enough attention to 0.96 since I'm still running 0.94. My mistake, the dependency should be "hbase-client" instead of "hbase" starting from 0.95.

I've just updated the pom.xml file and ran the test, but it looks like hbase-jruby is not quite yet ready to be used with 0.96. Some of the methods and classes internally used are deprecated or renamed in 0.96. Hopefully I'll try to have it ready for 0.96 in a few days.

junegunn commented 10 years ago

Hey, I've just released a new version, 0.4.5. Please update the gem and let me know if it works for you.

ajwootto commented 10 years ago

Hi, thanks for fixing that it works great now. The only issue I'm having now is a log4j related error: log4j:WARN No appenders could be found for logger (org.apache.hadoop.conf.Configuration.deprecation). log4j:WARN Please initialize the log4j system properly.

This only appears when using 0.96, the logger works fine in 0.94. I'm setting the configuration as follows: HBase.log4j = { 'log4j.threshold' => 'WARNING' } with no .xml configuration file. The error appears whether this line is included or not. This may be caused by something I'm doing and not by the gem and if so, I apologize. Thought I should bring it up though.

junegunn commented 10 years ago

The message appears when you don't have a proper log4j configuration file in your classpath. In that case Log4j warns about the fact and uses the default configuration. HBase.log4j= in this case just allows you to override some of the properties after that. So in order to avoid the message, you need a log4j configuration file anyway. A very simple example can be found here.

Once we have a configuration file, we can think of two approaches here.

1. Properly set up log4j configuration

# Log4j configuration file in resources directory
require 'hbase-jruby'
$CLASSPATH << 'resources/'
HBase.resolve_dependency! '0.96'
# ...

2. Use HBase.log4j = config_file_path

require 'hbase-jruby'
HBase.log4j = 'resources/log4j.properties'
HBase.resolve_dependency! '0.96'

However, this doesn't work since HBase.log4j is only callable when the dependencies are resolved by using either $CLASSPATH or HBase.resolve_dependency!. I'll create a separate issue for this.

junegunn commented 10 years ago

The issue is resolved in 0.4.6. Either way should work fine.