2011-09-18 64 views
1

我想用tomcat設置一個簡單的hbase webapp。據我所知,我知道我需要包含hbase jar和hadoop jar以便使用hbase和zoopkeeper jar。tomcat hbase jar收錄

問題是,當我在我的maven pom中包含hbase jar時,它下載了所有不需要的傳遞依賴jar(例如jetty,servlet-api等),因爲hbase本身在內置的jetty web app用於監視。我相信這與Tomcat的包裝衝突和啓動的結果中有以下異常我:

HTTP Status 500 - 

type Exception report 

message 

description The server encountered an internal error() that prevented it from fulfilling this request. 

exception 

javax.servlet.ServletException: Servlet.init() for servlet jersey-serlvet threw exception 
    org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102) 
    org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298) 
    org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:857) 
    org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:588) 
    org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489) 
    java.lang.Thread.run(Thread.java:619) 

root cause 

com.sun.jersey.api.container.ContainerException: No WebApplication provider is present 
    com.sun.jersey.spi.container.WebApplicationFactory.createWebApplication(WebApplicationFactory.java:69) 
    com.sun.jersey.spi.container.servlet.ServletContainer.create(ServletContainer.java:391) 
    com.sun.jersey.spi.container.servlet.ServletContainer$InternalWebComponent.create(ServletContainer.java:306) 
    com.sun.jersey.spi.container.servlet.WebComponent.load(WebComponent.java:607) 
    com.sun.jersey.spi.container.servlet.WebComponent.init(WebComponent.java:210) 
    com.sun.jersey.spi.container.servlet.ServletContainer.init(ServletContainer.java:373) 
    com.sun.jersey.spi.container.servlet.ServletContainer.init(ServletContainer.java:556) 
    javax.servlet.GenericServlet.init(GenericServlet.java:212) 
    org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102) 
    org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298) 
    org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:857) 
    org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:588) 
    org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489) 
    java.lang.Thread.run(Thread.java:619) 

note The full stack trace of the root cause is available in the Apache Tomcat/6.0.28 logs. 

當我註釋掉從我的POM HBase的罐子(全部爲HBase的依賴罐子消失得如預期),以及tomcat部署得很好,我可以訪問我的rest/spring servlet。

我曾嘗試使用排除到excluse HBase的直接依賴下列要求:

<dependency> 
      <groupId>org.apache.hbase</groupId> 
      <artifactId>hbase</artifactId> 
      <version>0.90.3-cdh3u1 </version> 
      <exclusions> 
       <exclusion> 
        <groupId>org.mortbay.jetty</groupId> 
        <artifactId>servlet-api</artifactId> 
       </exclusion> 
       <exclusion> 
        <groupId>org.mortbay.jetty</groupId> 
        <artifactId>jetty</artifactId> 
       </exclusion> 
       <exclusion> 
        <groupId>org.mortbay.jetty</groupId> 
        <artifactId>jetty-util</artifactId> 
        <!-- <version>1.4</version> --> 
       </exclusion> 
       <exclusion> 
        <groupId>org.mortbay.jetty</groupId> 
        <artifactId>jsp-2.1</artifactId> 
        <!-- <version>6.1.14</version> --> 
       </exclusion> 
       <exclusion> 
        <groupId>org.apache.thrift</groupId> 
        <artifactId>thrift</artifactId> 
       </exclusion> 
       <exclusion> 
        <groupId>com.google.guava</groupId> 
        <artifactId>guava</artifactId> 
       </exclusion> 
       <exclusion> 
        <groupId>org.jruby</groupId> 
        <artifactId>jruby-complete</artifactId> 
       </exclusion> 
       <exclusion> 
        <groupId>org.mortbay.jetty</groupId> 
        <artifactId>jsp-api-2.1</artifactId> 
       </exclusion> 
       <exclusion> 
        <groupId>org.mortbay.jetty</groupId> 
        <artifactId>servlet-api-2.5</artifactId> 
       </exclusion> 
       <exclusion> 
        <groupId>commons-httpclient</groupId> 
        <artifactId>commons-httpclient</artifactId> 
       </exclusion> 
       <exclusion> 
        <groupId>commons-lang</groupId> 
        <artifactId>commons-lang</artifactId> 
       </exclusion> 
       <exclusion> 
        <groupId>org.apache.hadoop</groupId> 
        <artifactId>avro</artifactId> 
       </exclusion> 
       <exclusion> 
        <groupId>org.mortbay.jetty</groupId> 
        <artifactId>jsp-2.1</artifactId> 
       </exclusion> 
       <exclusion> 
        <groupId>tomcat</groupId> 
        <artifactId>jasper-compiler</artifactId> 
       </exclusion> 
       <exclusion> 
        <groupId>tomcat</groupId> 
        <artifactId>jasper-runtime</artifactId> 
       </exclusion> 
       <exclusion> 
        <groupId>com.google.protobuf</groupId> 
        <artifactId>protobuf-java</artifactId> 
       </exclusion> 

       <exclusion> 
        <groupId>javax.servlet</groupId> 
        <artifactId>servlet-api</artifactId> 
       </exclusion> 
       <exclusion> 
        <groupId>log4j</groupId> 
        <artifactId>log4j</artifactId> 
       </exclusion> 

      </exclusions> 
     </dependency> 

但無濟於事我仍然有問題。

那麼,有沒有人有一個退出的POM,他們有包括hbase和hadoop,並以某種方式讓tomcat工作也許使用澤西島呢?

我知道以上不詳細我會補充更多細節。我將粘貼maven全部pom。

感謝這麼多

+0

如果任何人有一個使用maven的tomcat hbase設置示例,請您指教如何將hbase jar包括在tomcat web-inf lib中。 – amak

+0

由此產生的戰爭是怎樣的? (即包含哪些庫?)您使用的是什麼版本的澤西島?據我所知,HBase也取決於澤西島。也許在HBase的情況下,你正在拉澤西島的另一個版本,這是什麼原因造成的問題? –

+0

嗨馬丁,我使用的是tomcat 6. Jersey-server-1.8.jar,jersey-core-1.8.jar,jersey-spring-1.8.jar。我沒有意識到HBase也取決於澤西島,也許我需要排除這個呢?我會給這個鏡頭。感謝您的意見。我會回來的更新。 – amak

回答

1

HBase的依賴於新澤西州一樣,所以你需要確保你不與你的應用程序的兩個不同版本的新澤西結束。