是否有示例 Apache Phoenix + Spring Boot + Gradle 示例项目?

Is there a sample Apache Phoenix + Spring Boot + Gradle sample project?

没有 Phoenix 内核,spring 引导可以正确启动 tomcat。

问题:添加 compile('org.apache.phoenix:phoenix-core:4.7.0-HBase-1.1') 到我的 build.gradle Tomcat 的 dependencies 部分无法启动

dependencies {
    compile('org.apache.phoenix:phoenix-core:4.7.0-HBase-1.1')
    compile("org.springframework.data:spring-data-commons")
    compile("org.springframework.boot:spring-boot-starter-jdbc:1.3.2.RELEASE")
    compile('org.springframework.boot:spring-boot-starter-web:1.3.2.RELEASE')
    compile("org.springframework:spring-test:4.2.4.RELEASE")
}

有以下例外,

org.apache.catalina.core.ContainerBase startInternal
SEVERE: A child container failed during start
java.util.concurrent.ExecutionException: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Tomcat].StandardHost[localhost].StandardContext[/phoenix]]
    at java.util.concurrent.FutureTask.report(FutureTask.java:122)
    at java.util.concurrent.FutureTask.get(FutureTask.java:192)
    at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:1123)
    at org.apache.catalina.core.StandardHost.startInternal(StandardHost.java:816)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
    at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1575)
    at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1565)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at java.lang.Thread.run(Thread.java:745)
Caused by: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Tomcat].StandardHost[localhost].StandardContext[/phoenix]]
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:154)
    ... 6 more
Caused by: java.lang.NoSuchMethodError: javax.servlet.ServletContext.addServlet(Ljava/lang/String;Ljavax/servlet/Servlet;)Ljavax/servlet/ServletRegistration$Dynamic;
    at org.springframework.boot.context.embedded.ServletRegistrationBean.onStartup(ServletRegistrationBean.java:190)
    at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.selfInitialize(EmbeddedWebApplicationContext.java:225)
    at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.access[=13=]0(EmbeddedWebApplicationContext.java:85)
    at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.onStartup(EmbeddedWebApplicationContext.java:209)
    at org.springframework.boot.contex2016-03-07 23:40:29.048  WARN 71400 --- [           main] ationConfigEmbeddedWebApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.context.ApplicationContextException: Unable to start embedded container; nested exception is org.springframework.boot.context.embedded.EmbeddedServletContainerException: Unable to start embedded Tomcat
ded.tomcat.TomcatStarter.onStartup(TomcatStarter.java:55)
    at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5513)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
    ... 6 more

添加到依赖项中的以下行有助于解决问题。

providedCompile "javax.servlet:javax.servlet-api:3.0.1"

dependencies {
    providedCompile "javax.servlet:javax.servlet-api:3.0.1"
    compile('org.apache.phoenix:phoenix-core:4.7.0-HBase-1.1')
    compile("org.springframework.data:spring-data-commons")
    compile("org.springframework.boot:spring-boot-starter-jdbc:1.3.2.RELEASE")
    compile('org.springframework.boot:spring-boot-starter-web:1.3.2.RELEASE')
    compile("org.springframework:spring-test:4.2.4.RELEASE")
}