我正在尝试在Tomcat上部署SpringBoot应用程序。 我在statup上收到以下错误。
ar]
2015-06-21 19:04:26.392 ERROR 7568 --- [apr-8080-exec-4] o.s.boot.SpringApplicat
ion : Application startup failed
org.springframework.context.ApplicationContextException: Unable to start embedde
d container; nested exception is org.springframework.beans.factory.BeanCreationE
xception: Error creating bean with name 'errorPageFilter': Initialization of bea
n failed; nested exception is java.lang.ClassCastException: org.springframework.
boot.context.web.ErrorPageFilter cannot be cast to org.springframework.boot.cont
ext.embedded.tomcat.TomcatEmbeddedServletContainerFactory
at org.springframework.boot.context.embedded.EmbeddedWebApplicationConte
xt.onRefresh(EmbeddedWebApplicationContext.java:133)
at org.springframework.context.support.AbstractApplicationContext.refres
h(AbstractApplicationContext.java:474)
at org.springframework.boot.context.embedded.EmbeddedWebApplicationConte
这是我的春季启动初始化代码。
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.boot.context.web.SpringBootServletInitializer;
public class WebInitializer extends SpringBootServletInitializer {
@Override
protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
return application.sources(Application.class);
}
}
我在这里缺少什么。
这里要求的是gradle。
buildscript {
ext {
springBootVersion1= '1.2.3.RELEASE'
springBootVersion = '1.0.2.RELEASE'
}
repositories {
//maven { url "http://repo.spring.io/libs-snapshot" }
mavenCentral()
}
dependencies {
classpath("org.springframework.boot:spring-boot-gradle-plugin:1.2.3.RELEASE")
}
}
apply plugin: 'java'
apply plugin: 'eclipse'
apply plugin: 'idea'
apply plugin: 'spring-boot'
apply plugin: 'war'
war {
baseName = 'rabbitmq-ws-jar-to-war'
version = '0.1.0'
}
repositories {
mavenCentral()
// maven { url "http://repo.spring.io/libs-snapshot" }
// maven { url "http://maven.springframework.org/milestone" }
// flatDir {
// dirs 'lib'
// }
}
dependencies {
compile("org.springframework.boot:spring-boot-starter-web:${springBootVersion1}")
compile("org.springframework.boot:spring-boot:${springBootVersion1}")
compile("org.springframework.boot:spring-boot-starter-tomcat:${springBootVersion1}")
compile("org.springframework.boot:spring-boot-starter-actuator:${springBootVersion1}")
compile("org.springframework.boot:spring-boot-starter-aop:${springBootVersion1}")
compile("org.springframework.boot:spring-boot-starter-test:${springBootVersion1}")
compile("org.springframework.boot:spring-boot-starter-data-jpa:${springBootVersion1}")
{
exclude module: 'org.springframework.boot:spring-boot-starter-logging'
}
//compile ('org.springframework.boot:spring-boot-starter-log4j')
compile("org.springframework.boot:spring-boot-starter-log4j:${springBootVersion1}")
compile("org.springframework.data:spring-data-rest-webmvc:2.3.0.RELEASE")
providedCompile("org.springframework.boot:spring-boot-starter-security:${springBootVersion1}")
compile("org.springframework.security.oauth:spring-security-oauth2:2.0.7.RELEASE")
compile("org.springframework.security.oauth:spring-security-oauth-parent:2.0.7.RELEASE")
compile("org.hibernate:hibernate:3.3.2.GA")
//compile("org.hibernate:hibernate-annotations:3.5.6-Final")
//compile("org.springframework:spring-hibernate3:2.0.8")
compile("javax.annotation:javax.annotation-api:1.2")
compile("org.hibernate.javax.persistence:hibernate-jpa-2.0-api:1.0.0.Final")
compile("org.hsqldb:hsqldb")
compile("com.google.guava:guava:17.0")
compile("org.apache.commons:commons-lang3:3.3.2")
compile("org.apache.httpcomponents:httpclient:4.3.4")
compile("com.squareup.retrofit:retrofit:1.6.0")
compile("commons-io:commons-io:2.4")
compile("com.github.davidmarquis:fluent-interface-proxy:1.3.0")
compile("org.imgscalr:imgscalr-lib:4.2")
compile("org.springframework.boot:spring-boot-starter-amqp:${springBootVersion1}")
compile("com.rabbitmq:amqp-client:3.5.1")
compile('com.squareup.retrofit:converter-jackson:1.2.2')
//compile("org.nigajuan.rabbit.management.client:rabbit-management-client:1.0-SNAPSHOT")
testCompile("junit:junit")
}
tasks.withType(Test) {
scanForTestClasses = false
include "**/*Test.class" // whatever Ant pattern matches your test class files
}
task wrapper(type: Wrapper) {
gradleVersion = '2.3'
}
由于 Dhiren