Spring Boot integrated hbase will start an error
The main reason is that the Web container is embedded in spring boot to facilitate microservices development and deployment of applications. So it is intended to develop and publish HBase's business applications as a single service, and other related subsystems are accessed through restful APIs.
Things to note when building a project environment:
Because spring boot embeds the Web container, the framework imports dependencies by default: Tomcat-embed-core-8.5.5.jar, Tomcat-embed-el-8.5.5.jar, and so on. The jar of HBase contains: Servlet-api-2.5.jar, Servlet-api-2.5-6.1.14.jar. When you add a dependent dependency on HBase, the application starts to report an exception and the boot does not start. When setting up the project environment, record not to import the two jar packages of Servlet-api-2.5.jar, Servlet-api-2.5-6.1.14.jar.
You may also encounter: HBase java.io.IOException:No FileSystem for Scheme:hdfs errors
To resolve this error, add hadoo-client to Pom.xml, and also remove Servlet-api, refer to Pom.xml
<dependency> <groupId>org.apache.hbase</groupId> <artifactid>hbase-client< ;/artifactid> <version> corresponding version number </version> <exclusions> <exclusio N> <groupId>org.slf4j</groupId> <artifactid>slf4j-log4j12</a rtifactid> </exclusion> <exclusion> <GROUPID>LOG4J&L T;/groupid> <artifactId>log4j</artifactId> </exclusion> <exclusion> <groupId>javax.servlet</groupId> <artifactid> ;servlet-api</artifactid> </exclusion> </exclusions> </dependency> ; <dependency> <groupId>org.apache.hadoop</groupId> <artifactid>hadoop-client& lt;/artifactid&Gt <version> corresponding version number </version> <exclusions> <exclusion> < ;groupid>org.slf4j</groupid> <artifactId>slf4j-log4j12</artifactId> </exclusion> <exclusion> <groupId>log4j</groupId> <artifactId>log4j</artifactId> </exclusion> <exclusion> <groupId>javax.servlet</groupId> <artifactid>servlet-api</artifactid& Gt </exclusion> </exclusions> </dependency>
Original link: http://blog.csdn.net/veechange/article/details/52955599
Spring Boot Integrated HBase