gradle升级后的LifecycleException

时间:2014-05-06 14:00:54

标签: exception tomcat gradle

我将gradle从1.7升级到1.11后,我的tomcat不再启动了:我总是得到一个LifecycleException:

Caused by: org.gradle.api.GradleException: An error occurred starting the Tomcat server.
    at org.gradle.api.plugins.tomcat.tasks.AbstractTomcatRun.startTomcat(AbstractTomcatRun.groovy:364)
    at org.gradle.api.plugins.tomcat.tasks.AbstractTomcatRun$_validateConfigurationAndStartTomcat_closure1.doCall(AbstractTomcatR
)at org.gradle.api.plugins.tomcat.tasks.AbstractTomcatRun$_validateConfigurationAndStartTomcat_closure1.doCall(AbstractTomcatR
    at org.gradle.api.plugins.tomcat.internal.LoggingHandler.withJdkFileLogger(LoggingHandler.groovy:43)
    at org.gradle.api.plugins.tomcat.internal.LoggingHandler$withJdkFileLogger.callStatic(Unknown Source)
    at org.gradle.api.plugins.tomcat.tasks.AbstractTomcatRun.validateConfigurationAndStartTomcat(AbstractTomcatRun.groovy:254)
    at org.gradle.api.plugins.tomcat.tasks.AbstractTomcatRun.start(AbstractTomcatRun.groovy:216)
    at org.gradle.internal.reflect.JavaMethod.invoke(JavaMethod.java:63)
    at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$StandardTaskAction.doExecute(AnnotationProcess
y.java:219)
at  org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$StandardTaskAction.execute(AnnotationProcessin
java:212)
    at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$StandardTaskAction.execute(AnnotationProcessin
java:201)
    at org.gradle.api.internal.AbstractTask$TaskActionWrapper.execute(AbstractTask.java:533)
    at org.gradle.api.internal.AbstractTask$TaskActionWrapper.execute(AbstractTask.java:516)
    at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeAction(ExecuteActionsTaskExecuter.java:80)
    at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:61)
    ... 46 more
Caused by: org.apache.catalina.LifecycleException: Failed to start component [StandardServer[-1]]
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:154)
    at org.apache.catalina.startup.Tomcat.start(Tomcat.java:335)
    at org.apache.catalina.startup.Tomcat$start.call(Unknown Source)
    at org.gradle.api.plugins.tomcat.embedded.BaseTomcatServerImpl.start(BaseTomcatServerImpl.groovy:37)
    at org.gradle.api.plugins.tomcat.embedded.TomcatServer$start.call(Unknown Source)
    at org.gradle.api.plugins.tomcat.tasks.AbstractTomcatRun.startTomcat(AbstractTomcatRun.groovy:349)
    ... 60 more
 Caused by: org.apache.catalina.LifecycleException: Failed to start component [StandardService[Tomcat]]
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:154)
    at org.apache.catalina.core.StandardServer.startInternal(StandardServer.java:732)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
    ... 65 more
Caused by: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Tomcat]]
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:154)
    at org.apache.catalina.core.StandardService.startInternal(StandardService.java:443)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
    ... 67 more
Caused by: org.apache.catalina.LifecycleException: A child container failed during start
    at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:1131)
    at org.apache.catalina.core.StandardEngine.startInternal(StandardEngine.java:302)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
    ... 69 more
Caused by: java.lang.LinkageError: loader constraint violation: loader (instance of org/apache    /catalina/loader/WebappClassLoader) previously initi
ated loading for a different type with name "javax/servlet/ServletContext"

我正在使用spring mvc和bmuschko gradle-tomcat-plugin以及最新版本。 我已经发现当导入的jar之间存在冲突时会出现LinkageError,但是我不知道哪些对此冲突有反应。 这是我的构建gradle的一部分,其中说明了依赖关系:

 dependencies {
    compile (
            "org.slf4j:jcl-over-slf4j:$slf4jVersion",
            "org.slf4j:jul-to-slf4j:${slf4jVersion}",
            "javax.servlet:jstl:1.1.2",
            "taglibs:standard:1.1.2",
            'javax.inject:javax.inject:1',

            'org.hibernate:hibernate-validator:4.2.0.Final',

            "org.springframework:spring-webmvc:${springVersion}",
            "org.springframework:spring-aop:${springVersion}",
            "org.springframework:spring-jms:${springVersion}",
            "org.springframework:spring-context-support:${springVersion}",

            "org.springframework.security:spring-security-core:${springSecurityVersion}",
            "org.springframework.security:spring-security-web:${springSecurityVersion}",
            "org.springframework.security:spring-security-config:${springSecurityVersion}",
            "org.springframework.security:spring-security-taglibs:${springSecurityVersion}",

            "org.aspectj:aspectjtools:${aspectjVersion}",
            "org.aspectj:aspectjweaver:${aspectjVersion}",
            "org.aspectj:aspectjrt:${aspectjVersion}",
            'joda-time:joda-time:2.1',

            'commons-lang:commons-lang:2.6',

            "com.google.code.findbugs:annotations:$findbugsVersion",
            "com.google.code.findbugs:jsr305:$findbugsVersion"
            )

    runtime (
            "org.slf4j:slf4j-log4j12:${slf4jVersion}",
            "org.springframework:spring-beans:${springVersion}",
            'joda-time:joda-time-jsptags:1.1.1',

            )

    testCompile (                 
            "junit:junit:4.11", // (junit 4.11 exposes a dependency to hamcrest-core 1.3)
            "org.springframework:spring-test:${springVersion}",
            'org.powermock:powermock-module-junit4:1.5.4',
            'org.mockito:mockito-core:1.9.5',
//                'org.powermock:powermock-api-mockito:1.5.4',
            'org.powermock:powermock-release-without-test-and-mock-framework:1.5.1',

            "org.easytesting:fest-assert:$festAssertVersion"
            )
    testCompile(
      'org.powermock:powermock-api-mockito:1.5.4')
      {
//        exclude group: 'junit', module: 'junit'
        transitive = false
      }


    integrationTestCompile (
            // TODO: since Spring 3.2 spring-test-mvc is a part of spring-test. Therefore this dependency might be deleted (all 
            // integration test be refactored to use the new packages). New integration tests should use the spring-test packages.
            "org.springframework:spring-test-mvc:$springTestMVCVersion",
            "com.jayway.jsonpath:json-path:0.5.6",
            "org.dbunit:dbunit:$dbUnitVersion"
            )
    integrationTestRuntime (
            "com.oracle:ojdbc6:11.2.0.3"
    )
}

0 个答案:

没有答案