1.好久没用log4j了,转到logback好多年了,hbase程序运行时,报缺少log4j配置,那么,就转去logback吧(以下的XXX表示版本号)。

  原先lib包里面有log4j-XXX.jar、slf4j-api-XXX.jar、slf4j-log4j12-XXX.jar,干掉log4j-XXX.jar和slf4j-log4j12-XXX.jar,加入jcl-over-slf4j-XXX.jar,log4j-over-slf4j-XXX.jar、logback-classic-XXX.jar、logback-core-XXX.jar,至于原先的slf4j-api这个包,可以顺手替换成新的,然后,加入一个logback.xml到classpath下

<?xml version="1.0" encoding="UTF-8"?>

<!-- For assistance related to logback-translator or configuration  -->
<!-- files in general, please contact the logback user mailing list -->
<!-- at http://www.qos.ch/mailman/listinfo/logback-user -->
<!-- -->
<!-- For professional support please see -->
<!-- http://www.qos.ch/shop/products/professionalSupport -->
<!-- -->
<configuration scan="true" scanPeriod="120 seconds" debug="false">
<appender name="FileApp" class="ch.qos.logback.core.rolling.RollingFileAppender">
<!--See also http://logback.qos.ch/manual/appenders.html#RollingFileAppender-->
<filter class="ch.qos.logback.classic.filter.ThresholdFilter">
<level>WARN</level>
</filter>
<File>log/HBaseClient.log</File>
<encoder>
<pattern>%d [%t] %-5p %c - %m%n</pattern>
</encoder>
<rollingPolicy class="ch.qos.logback.core.rolling.FixedWindowRollingPolicy">
<maxIndex>10</maxIndex>
<FileNamePattern>log/HBaseClient.log.%i</FileNamePattern>
</rollingPolicy>
<triggeringPolicy class="ch.qos.logback.core.rolling.SizeBasedTriggeringPolicy">
<MaxFileSize>1024KB</MaxFileSize>
</triggeringPolicy>
</appender>
<appender name="ConApp" class="ch.qos.logback.core.ConsoleAppender">
<encoder>
<pattern>%d [%t] %-5p %c - %m%n</pattern>
</encoder>
</appender>
<root level="ERROR">
<appender-ref ref="ConApp"/>
<appender-ref ref="FileApp"/>
</root>
</configuration>

  这样,log4j和系统的日志系统就被logback接管了,至于为啥不用log4j,用logback,这个。。。自己去看吧,有空我可能会写点啥,logback有点小bug,就是有的linux系统下会找不到配置文件,以前修复过,不知道新版本有处理掉没。

  2.Could not locate executable null\bin\winutils.exe in the Hadoop binaries

  老掉牙的问题了,系统变量设置HADOOP_HOME,我还是不想去设置环境变量,还是一行代码来得快

System.setProperty("hadoop.home.dir", "G:/hadoop/hadoop-2.4.1");

  3.Unable to load native-hadoop library for your platform... using builtin-java classes where applicable

  本地库是为了提高性能和包含一些java不支持的实现,比如集群中设置支持gzip lzo压缩后,在对压缩文件进行读取或者对输入文件压缩的时候要使用到hadoop的本地库。

  找不到本地库,linux下可以自己编译一下,官方文档中也有介绍http://hadoop.apache.org/docs/r2.4.1/hadoop-project-dist/hadoop-common/NativeLibraries.html

  windows下。。。。我以前是在https://github.com/srccodes/hadoop-common-2.2.0-bin/tree/master/bin下载的,但是我win7 64位,就用不了,注册dll文件的时候,就报错了。官方文档中写着“The native hadoop library is supported on *nix platforms only.”。。。

  找到一个windows下编译hadoop本地库的地址http://www.srccodes.com/p/article/38/build-install-configure-run-apache-hadoop-2.2.0-microsoft-windows-os

  看了一遍,想想不划算,算了,到时候肯定是丢去linux系统下跑的,折腾这个干嘛啊,linux下又没有问题。

  4.程序运行正常,但是当log级别改为Info时,突然发现了这么一条

2014-08-04 16:19:22,942 [main-SendThread(Master:2222)] INFO  org.apache.zookeeper.ClientCnxn - Opening socket connection to server Master/192.168.117.128:2222. Will not attempt to authenticate using SASL (java.lang.SecurityException: 无法定位登录配置)

  看到个Exception,什么情况?觉得哪里不对,但是程序又是一切正常的。

  搜索了一通,发现好多一样的问题,但是貌似和我的没啥关系,别人是程序跑不通,我是程序正常得很。

  有说是zookeeper版本不一致的,我看了下hadoop和hbase中的确实有区别,一个zookeeper-3.4.5.jar,一个zookeeper-3.4.6.jar,但是我总觉得不对,新旧怎么可能会不兼容啊。那就直接统一了试试,连客户端程序的都统一了,结果那个info信息还是存在,就和不换是一样的,果然不是这里的问题!

  有说是配置和hosts的,我这里都没这问题的,都配置过了的。加参数?我在配置中都写好的,直接打印一看就知道有了。

  这只是一个info信息,很奇怪为啥是个info,照说info级别的都是不影响啥的信息,程序确实是很正常的跑,但是看到这个信息就是不舒服。

  自己查代码去算了,根据日志,是在ClientCnxn.java中出现的信息,好吧,查看源码

private void logStartConnect(InetSocketAddress addr) {
String msg = "Opening socket connection to server " + addr;
if (zooKeeperSaslClient != null) {
msg += ". " + zooKeeperSaslClient.getConfigStatus();
}
LOG.info(msg);
}

  汗,还得换去查ZooKeeperSaslClient.java,继续吧

public ZooKeeperSaslClient(final String serverPrincipal)
throws LoginException {
/**
* ZOOKEEPER-1373: allow system property to specify the JAAS
* configuration section that the zookeeper client should use.
* Default to "Client".
*/
String clientSection = System.getProperty(ZooKeeperSaslClient.LOGIN_CONTEXT_NAME_KEY, "Client");
// Note that 'Configuration' here refers to javax.security.auth.login.Configuration.
AppConfigurationEntry entries[] = null;
RuntimeException runtimeException = null;
try {
entries = Configuration.getConfiguration().getAppConfigurationEntry(clientSection);
} catch (SecurityException e) {
// handle below: might be harmless if the user doesn't intend to use JAAS authentication.
runtimeException = e;
} catch (IllegalArgumentException e) {
// third party customized getAppConfigurationEntry could throw IllegalArgumentException when JAAS
// configuration isn't set. We can reevaluate whether to catch RuntimeException instead when more
// different types of RuntimeException found
runtimeException = e;
}
if (entries != null) {
this.configStatus = "Will attempt to SASL-authenticate using Login Context section '" + clientSection + "'";
this.saslClient = createSaslClient(serverPrincipal, clientSection);
} else {
// Handle situation of clientSection's being null: it might simply because the client does not intend to
// use SASL, so not necessarily an error.
saslState = SaslState.FAILED;
String explicitClientSection = System.getProperty(ZooKeeperSaslClient.LOGIN_CONTEXT_NAME_KEY);
if (explicitClientSection != null) {
// If the user explicitly overrides the default Login Context, they probably expected SASL to
// succeed. But if we got here, SASL failed.
if (runtimeException != null) {
throw new LoginException("Zookeeper client cannot authenticate using the " + explicitClientSection +
" section of the supplied JAAS configuration: '" +
System.getProperty(Environment.JAAS_CONF_KEY) + "' because of a " +
"RuntimeException: " + runtimeException);
} else {
throw new LoginException("Client cannot SASL-authenticate because the specified JAAS configuration " +
"section '" + explicitClientSection + "' could not be found.");
}
} else {
// The user did not override the default context. It might be that they just don't intend to use SASL,
// so log at INFO, not WARN, since they don't expect any SASL-related information.
String msg = "Will not attempt to authenticate using SASL ";
if (runtimeException != null) {
msg += "(" + runtimeException + ")";
} else {
msg += "(unknown error)";
}
this.configStatus = msg;
this.isSASLConfigured = false;
}
if (System.getProperty(Environment.JAAS_CONF_KEY) != null) {
// Again, the user explicitly set something SASL-related, so they probably expected SASL to succeed.
if (runtimeException != null) {
throw new LoginException("Zookeeper client cannot authenticate using the '" +
System.getProperty(ZooKeeperSaslClient.LOGIN_CONTEXT_NAME_KEY, "Client") +
"' section of the supplied JAAS configuration: '" +
System.getProperty(Environment.JAAS_CONF_KEY) + "' because of a " +
"RuntimeException: " + runtimeException);
} else {
throw new LoginException("No JAAS configuration section named '" +
System.getProperty(ZooKeeperSaslClient.LOGIN_CONTEXT_NAME_KEY, "Client") +
"' was found in specified JAAS configuration file: '" +
System.getProperty(Environment.JAAS_CONF_KEY) + "'.");
}
}
}
}

  根据上面的代码,可知问题在于红色部分,再注意一下上面的注释,我靠,果然只是一个普通的说明文字,但是,尼玛能不能不在info信息里面搞个Exception提示出来???

  好吧,那确实是一个info信息,是无关紧要的info信息,其实只是说明了。。。。。由于客户端没用SASL,所以不使用SASL进行验证。。。

  能不能换个好点的说明文字?我这些操作都是多余的了!人家就那样显示的,唉。看得不爽也没办法了,难道为了这点东西还去改源码不成?够汗的。  

  解决办法,客户端添加SASL信息,然后服务端也改掉,添加验证,这个官方文档http://hbase.apache.org/book.html#security有说明了,直接看去就是了,这里不说明了。

  唉,处女座追求完美的心,果然是不变的。。。加上,看不到烦心的文字,舒坦了。。

  

Window中调试HBase问题小结的更多相关文章

  1. 在Chrome+Visual Studio中调试asp.net程序很慢的问题(Firefox也有类似问题)

    在Chrome+Visual Studio中调试asp.net程序很慢的问题(Firefox也有类似问题) 今天开始起在Chrome中调试,发现问题主要出在菜单栏(layout文件)中,google了 ...

  2. Window10中利用Windbg与虚拟机(window7)中调试驱动建立方法

    想起自己的windbg配置就转载:eqera的windows内核调试配置,真的是获益良多希望他不会介意我转载他的博客,帮了我很多,记录下来给我也给大家, 其中我主要看的是VMWare的pipe建立,而 ...

  3. Firebug中调试中的js脚本中中文内容显示为乱码

    Firebug中调试中的js脚本中中文内容显示为乱码 设置 页面 UFT-8 编码没用, 解决方法:点击 "Firebug"工具栏 中的"选项"---" ...

  4. 在IIS Express中调试时无法读取配置文件 错误

    在IIS Express中调试代码时,如果出现"无法读取配置文件"的问题(如图),这种情况是IIS Express的"applicationhost.config&quo ...

  5. jquery easyui window中的datagrid,只能显示一次问题

    最近项目中用到easyui 的动态创建window ,window中嵌入了datagruid.第一次打开是能显示数据,但再次打开时确没显示: 注:url已成功返回了数据. 多次查阅easyui帮助文档 ...

  6. 在 Chrome 中调试 Android 浏览器

    最近需要使用 Chrome Developer Tools 调试 Android 浏览器,但是官方指南并不是很好使,经过一番折腾,终于调试成功了,在此把经验分享给需要的朋友. Chrome Devel ...

  7. java系列: 在eclipse中调试时,输入的jsp或者servlet页面的地址要区分大小写

    比如在当前web工程中有一个jsp页面的名字是: Welcome.jsp 在eclipse中调试时,如果在浏览器中输入: http://localhost:8080/MavenWeb/welcome. ...

  8. vs2010 开发过程中调试时 有错误不中断

    出现这个的原因是调试的设置有问题,修改下设置就好了. 修改方法:点击上边工具栏中   调试--异常 出现以下页面,把引发那列复选框全部勾上,点击确定就好了.

  9. 在iis中调试asp.net程序

    第一步,在iis中新建一个网站,名称为Langben,“物理路径”选择你的程序的根目录,端口你可以随便设置一个数,我这里设置为8888(后面要用到哦). 第二步,应用程序池设置一下 第三步,接下来,在 ...

随机推荐

  1. 在ASP.NET 5中显示错误信息

    在 ASP.NET 5 中如果不进行显示错误信息的相关配置,在发生错误时,在浏览器中只能看到空白页面. 显示错误信息的配置方法如下: 1)在 project.json 中添加对 Microsoft.A ...

  2. [汇编] C语言中嵌入汇编

    >_<" 下面是在C语言中嵌入汇编的例子,下面是三点要注意的~ 1.内联式汇编 2._asm关键字 3.并不是所有中断都能被支持 #include<iostream> ...

  3. 趋势型指标——MACD

    1.简要介绍▪ 计算方法▪ DIFF▪ DEA▪ MACD▪ 构造原理▪ 缺点2.实战技巧3.运用技巧▪ 应用原理▪ 经典用法▪ 实战战法▪ 捕捉卖点▪ 买卖策略▪ 短线实战4.组合指标运用5.一般研 ...

  4. js中的hasOwnProperty()和isPrototypeOf()

    js中的hasOwnProperty()和isPrototypeOf() 这两个属性都是Object.prototype所提供:Object.prototype.hasOwnProperty()和Ob ...

  5. [Python爬虫] Selenium自动访问Firefox和Chrome并实现搜索截图

    前两篇文章介绍了安装,此篇文章算是一个简单的进阶应用吧!它是在Windows下通过Selenium+Python实现自动访问Firefox和Chrome并实现搜索截图的功能.        [Pyth ...

  6. 1119 网页布局,css写下拉列表

    <style type="text/css"> *{ margin:0px; padding:0px;} #body{ width:1000px; height:200 ...

  7. H5常用代码:页面框架

    万变不离其宗,道法自然! 虽然H5的小项目一波又一波,但有一个东东基本没什么变化,那就是整个页面的框架结构. 我所常用的H5常用页面框架如下: <!DOCTYPE html> <ht ...

  8. Atitit selenium3 新特性

    Atitit selenium3 新特性     Selenium2.0 支持了webdriver  api,,原来自己的api放弃了. Selenium v2.45.0 发布,支持Firefox 3 ...

  9. PHP cURL模块

    简介: cURL是利用URL语法在命令行方式下工作的文件传输工具,目前苹果机器已经内置了cURL.cURL是一个综合性的传输工具,对HTTP.FTP等协议提供了广泛的支持,它甚至可以实现迅雷.快车等下 ...

  10. C#之读取web上的xml

    一.使用LINQ读取使用Xdocument上的Load方法,可以快速的加载一个XML文档,然后使用LINQ对 加载XML文档进行查询或其他操作,这里仅简单偏历.所以,一旦查询一组元素有返回元素集,就可 ...