首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >带Jetty 8.xxx的Hbase 0.94.xxx

带Jetty 8.xxx的Hbase 0.94.xxx
EN

Stack Overflow用户
提问于 2013-03-05 23:54:35
回答 1查看 1.7K关注 0票数 1

首先,我是HBase和Jetty8的新手。

我一直在尝试让Hbase 0.94.xx和embedded Jetty 8.x能够很好地结合在一起。

我从Lars获取了示例代码,并将Hush更新为使用0.94。这是我所做的HBase 0.94更新。Jetty版本从"7.3.1.v20110307“改为"8.1.4.v20120524”时https://github.com/yepher/hbase-book/blob/master/hush/pom.xml。"Credential“的编译错误很容易通过更改导入来解决。Hush服务器将正常启动,但最终我会得到以下异常:

代码语言:javascript
运行
复制
Exception in thread "main" java.lang.NoSuchMethodError:
org.slf4j.spi.LocationAwareLogger.log(Lorg/slf4j/Marker;Ljava/lang/String;ILjava/lang/String;[Ljava/lang/Object;Ljava/lang/Throwable;)V
    at
org.eclipse.jetty.util.log.JettyAwareLogger.log(JettyAwareLogger.java:601)
    at
org.eclipse.jetty.util.log.JettyAwareLogger.warn(JettyAwareLogger.java:425)
    at org.eclipse.jetty.util.log.Slf4jLog.warn(Slf4jLog.java:64)   at
org.eclipse.jetty.util.component.AbstractLifeCycle.setFailed(AbstractLifeCycle.java:199)
    at
org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:69)
    at com.hbasebook.hush.HushMain.main(HushMain.java:112)

这是maven对"includes sl4j“的输出

代码语言:javascript
运行
复制
[hush (master)]$ mvn dependency:tree -Dincludes=org.slf4j
Unable to find a $JAVA_HOME at "/usr", continuing with system-provided Java...
[INFO] Scanning for projects...
Downloading: http://repo1.maven.org/maven2/org/mortbay/jetty/jetty-maven-plugin/8.1.4.v20120524/jetty-maven-plugin-8.1.4.v20120524.pom
Downloaded: http://repo1.maven.org/maven2/org/mortbay/jetty/jetty-maven-plugin/8.1.4.v20120524/jetty-maven-plugin-8.1.4.v20120524.pom (7 KB at 14.5 KB/sec)
Downloading: http://repo1.maven.org/maven2/org/mortbay/jetty/jetty-integration-project/8.1.4.v20120524/jetty-integration-project-8.1.4.v20120524.pom
Downloaded: http://repo1.maven.org/maven2/org/mortbay/jetty/jetty-integration-project/8.1.4.v20120524/jetty-integration-project-8.1.4.v20120524.pom (12 KB at 298.1 KB/sec)
Downloading: http://repo1.maven.org/maven2/org/mortbay/jetty/jetty-maven-plugin/8.1.4.v20120524/jetty-maven-plugin-8.1.4.v20120524.jar
Downloaded: http://repo1.maven.org/maven2/org/mortbay/jetty/jetty-maven-plugin/8.1.4.v20120524/jetty-maven-plugin-8.1.4.v20120524.jar (70 KB at 758.4 KB/sec)
[INFO]                                                                         
[INFO] ------------------------------------------------------------------------
[INFO] Building HBase URL Shortener 1.0
[INFO] ------------------------------------------------------------------------
[INFO] 
[INFO] --- maven-dependency-plugin:2.1:tree (default-cli) @ hush ---
[INFO] com.hbasebook:hush:war:1.0
[INFO] \- org.apache.hbase:hbase:jar:0.94.3:compile
[INFO]    +- org.slf4j:slf4j-api:jar:1.4.3:compile
[INFO]    \- org.slf4j:slf4j-log4j12:jar:1.4.3:compile
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 2.987s
[INFO] Finished at: Tue Mar 05 09:51:40 CST 2013
[INFO] Final Memory: 8M/81M
[INFO] ------------------------------------------------------------------------

我尝试了很多方法,比如排除SL4J,显式地包含SL4j。我确信我错过了一些简单的东西,但不太确定它是什么。

作为另一个参考点,我尝试了这个项目核心,但是当我向pom.xml添加HBase/ https://github.com/steveliles/jetty-embedded-spring-mvc-noxml/blob/master/pom.xml时,我开始得到与上面相同的问题。

有没有人有支持Jetty8.x和HBase 0.94.xx的pom.xml?

编辑:

我添加了更多的slf4j排除,然后显式地包含了slf4j

代码语言:javascript
运行
复制
<dependency>
    <groupId>org.slf4j</groupId>
    <artifactId>slf4j-log4j12</artifactId>
    <version>1.6.4</version>                        
</dependency>

我在这里更新了Huch项目的工作代码:https://github.com/yepher/hbase-book

EN

Stack Overflow用户

回答已采纳

发布于 2013-03-06 00:18:49

当类路径中有多个版本不同的LocationAwareLogger类时,会引发此异常。您可以简单地在lib目录中执行一个grep -R LocationAwareLogger *.jar,并找出包含该类的jar。然后,您可以在您的pom.xml中排除它。

编辑:我已经下载了你的repo,并将其安装在我的机器上。在我运行grep命令之后,我得到了以下输出:

代码语言:javascript
运行
复制
eric@localhost:hbase-book$ grep -R 'org/slf4j/spi/LocationAwareLogger' hush/target/hush/WEB-INF/lib/*.jar
Binary file hush/target/hush/WEB-INF/lib/slf4j-api-1.6.4.jar matches
eric@localhost:hbase-book$ grep -R 'org/slf4j/LoggerFactory' hush/target/hush/WEB-INF/lib/*.jar
Binary file hush/target/hush/WEB-INF/lib/slf4j-api-1.6.4.jar matches

看起来您并没有通过使用错误的groupId/artifactId组合来完全排除slf4j。您需要更新您的pom并再次测试。

注意jetty中包含的日志记录库版本可能与hbase冲突,没有通用的解决方案,您需要确定使用哪个版本并排除其他版本。

票数 1
EN
查看全部 1 条回答
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/15228287

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档