我正在运行一个jar文件,它显示如下错误

时间:2017-06-23 16:00:46

标签: java spring tomcat gradle

我在gradle中运行..我也会发送build.gradle文件。请帮我调试这个错误。我正在运行一个名为java -jar的命令然后我得到了以下错误。我正在使gradle构建成功。

ionConfigEmbeddedWebApplicationContext@4f0f29: startup date [Fri Jun 23 20:59:11
     IST 2017]; root of context hierarchy
    2017-06-23 20:59:16.428  INFO 4756 --- [           main] o.s.b.f.s.DefaultListab
    leBeanFactory     : Overriding bean definition for bean 'requestContextFilter' w
    ith a different definition: replacing [Root bean: class [null]; scope=; abstract
    =false; lazyInit=false; autowireMode=3; dependencyCheck=0; autowireCandidate=tru
    e; primary=false; factoryBeanName=org.springframework.boot.autoconfigure.jersey.
    JerseyAutoConfiguration; factoryMethodName=requestContextFilter; initMethodName=
    null; destroyMethodName=(inferred); defined in class path resource [org/springfr
    amework/boot/autoconfigure/jersey/JerseyAutoConfiguration.class]] with [Root bea
    n: class [org.springframework.boot.autoconfigure.web.WebMvcAutoConfiguration$Web
    MvcAutoConfigurationAdapter]; scope=; abstract=false; lazyInit=false; autowireMo
    de=3; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=
    null; factoryMethodName=requestContextFilter; initMethodName=null; destroyMethod
    Name=(inferred); defined in class path resource [org/springframework/boot/autoco
    nfigure/web/WebMvcAutoConfiguration$WebMvcAutoConfigurationAdapter.class]]
    2017-06-23 20:59:17.091  INFO 4756 --- [           main] f.a.AutowiredAnnotation
    BeanPostProcessor : JSR-330 'javax.inject.Inject' annotation found and supported
     for autowiring
    2017-06-23 20:59:19.060  INFO 4756 --- [           main] s.b.c.e.t.TomcatEmbedde
    dServletContainer : Tomcat initialized with port(s): 8080 (http)
    2017-06-23 20:59:19.188  INFO 4756 --- [           main] o.apache.catalina.core.
    StandardService   : Starting service Tomcat
    2017-06-23 20:59:19.195  INFO 4756 --- [           main] org.apache.catalina.cor
    e.StandardEngine  : Starting Servlet Engine: Apache Tomcat/8.5.14
    2017-06-23 20:59:20.055 ERROR 4756 --- [cat-startStop-1] org.apache.catalina.cor
    e.ContainerBase   : A child container failed during start

    java.util.concurrent.ExecutionException: org.apache.catalina.LifecycleException:
     Failed to start component [StandardEngine[Tomcat].StandardHost[localhost].Tomca
    tEmbeddedContext[]]
            at java.util.concurrent.FutureTask.report(Unknown Source) [na:1.8.0_121]

            at java.util.concurrent.FutureTask.get(Unknown Source) [na:1.8.0_121]
            at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.ja
    va:939) ~[tomcat-embed-core-8.5.14.jar!/:8.5.14]
            at org.apache.catalina.core.StandardHost.startInternal(StandardHost.java
    :872) [tomcat-embed-core-8.5.14.jar!/:8.5.14]
            at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
    [tomcat-embed-core-8.5.14.jar!/:8.5.14]
            at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.
    java:1419) [tomcat-embed-core-8.5.14.jar!/:8.5.14]
            at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.
    java:1409) [tomcat-embed-core-8.5.14.jar!/:8.5.14]
            at java.util.concurrent.FutureTask.run(Unknown Source) [na:1.8.0_121]
            at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) [na
    :1.8.0_121]
            at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) [n
    a:1.8.0_121]
            at java.lang.Thread.run(Unknown Source) [na:1.8.0_121]
    Caused by: org.apache.catalina.LifecycleException: Failed to start component [St
    andardEngine[Tomcat].StandardHost[localhost].TomcatEmbeddedContext[]]
            at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:167)
    [tomcat-embed-core-8.5.14.jar!/:8.5.14]
            ... 6 common frames omitted
    Caused by: java.lang.AbstractMethodError: org.apache.jasper.servlet.TldScanner$T
    ldScannerCallback.scan(Lorg/apache/tomcat/Jar;Ljava/lang/String;Z)V
            at org.apache.tomcat.util.scan.StandardJarScanner.process(StandardJarSca
    nner.java:342) ~[tomcat-embed-core-8.5.14.jar!/:8.5.14]
            at org.apache.tomcat.util.scan.StandardJarScanner.scan(StandardJarScanne
    r.java:288) ~[tomcat-embed-core-8.5.14.jar!/:8.5.14]
            at org.apache.jasper.servlet.TldScanner.scanJars(TldScanner.java:262) ~[
    tomcat-embed-jasper-8.0.30.jar!/:8.0.30]
            at org.apache.jasper.servlet.TldScanner.scan(TldScanner.java:106) ~[tomc
    at-embed-jasper-8.0.30.jar!/:8.0.30]
            at org.apache.jasper.servlet.JasperInitializer.onStartup(JasperInitializ
    er.java:103) ~[tomcat-embed-jasper-8.0.30.jar!/:8.0.30]
            at org.apache.catalina.core.StandardContext.startInternal(StandardContex
    t.java:5196) ~[tomcat-embed-core-8.5.14.jar!/:8.5.14]
            at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
    [tomcat-embed-core-8.5.14.jar!/:8.5.14]
            ... 6 common frames omitted

    2017-06-23 20:59:20.066 ERROR 4756 --- [           main] org.apache.catalina.cor
    e.ContainerBase   : A child container failed during start

    java.util.concurrent.ExecutionException: org.apache.catalina.LifecycleException:
     Failed to start component [StandardEngine[Tomcat].StandardHost[localhost]]
            at java.util.concurrent.FutureTask.report(Unknown Source) ~[na:1.8.0_121
    ]
            at java.util.concurrent.FutureTask.get(Unknown Source) ~[na:1.8.0_121]
            at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.ja
    va:939) ~[tomcat-embed-core-8.5.14.jar!/:8.5.14]
            at org.apache.catalina.core.StandardEngine.startInternal(StandardEngine.
    java:262) [tomcat-embed-core-8.5.14.jar!/:8.5.14]
            at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
    [tomcat-embed-core-8.5.14.jar!/:8.5.14]
            at org.apache.catalina.core.StandardService.startInternal(StandardServic
    e.java:422) [tomcat-embed-core-8.5.14.jar!/:8.5.14]
            at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
    [tomcat-embed-core-8.5.14.jar!/:8.5.14]
            at org.apache.catalina.core.StandardServer.startInternal(StandardServer.
    java:793) [tomcat-embed-core-8.5.14.jar!/:8.5.14]
            at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
    [tomcat-embed-core-8.5.14.jar!/:8.5.14]
            at org.apache.catalina.startup.Tomcat.start(Tomcat.java:344) [tomcat-emb
    ed-core-8.5.14.jar!/:8.5.14]
            at org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServle
    tContainer.initialize(TomcatEmbeddedServletContainer.java:99) [spring-boot-1.5.3
    .RELEASE.jar!/:1.5.3.RELEASE]
            at org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServle
    tContainer.<init>(TomcatEmbeddedServletContainer.java:84) [spring-boot-1.5.3.REL
    EASE.jar!/:1.5.3.RELEASE]
            at org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServle
    tContainerFactory.getTomcatEmbeddedServletContainer(TomcatEmbeddedServletContain
    erFactory.java:554) [spring-boot-1.5.3.RELEASE.jar!/:1.5.3.RELEASE]
            at org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServle
    tContainerFactory.getEmbeddedServletContainer(TomcatEmbeddedServletContainerFact
    ory.java:179) [spring-boot-1.5.3.RELEASE.jar!/:1.5.3.RELEASE]
            at org.springframework.boot.context.embedded.EmbeddedWebApplicationConte
    xt.createEmbeddedServletContainer(EmbeddedWebApplicationContext.java:164) [sprin
    g-boot-1.5.3.RELEASE.jar!/:1.5.3.RELEASE]
            at org.springframework.boot.context.embedded.EmbeddedWebApplicationConte
    xt.onRefresh(EmbeddedWebApplicationContext.java:134) [spring-boot-1.5.3.RELEASE.
    jar!/:1.5.3.RELEASE]
            at org.springframework.context.support.AbstractApplicationContext.refres
    h(AbstractApplicationContext.java:536) [spring-context-4.3.8.RELEASE.jar!/:4.3.8
    .RELEASE]
            at org.springframework.boot.context.embedded.EmbeddedWebApplicationConte
    xt.refresh(EmbeddedWebApplicationContext.java:122) [spring-boot-1.5.3.RELEASE.ja
    r!/:1.5.3.RELEASE]
            at org.springframework.boot.SpringApplication.refresh(SpringApplication.
    java:737) [spring-boot-1.5.3.RELEASE.jar!/:1.5.3.RELEASE]
            at org.springframework.boot.SpringApplication.refreshContext(SpringAppli
    cation.java:370) [spring-boot-1.5.3.RELEASE.jar!/:1.5.3.RELEASE]
            at org.springframework.boot.SpringApplication.run(SpringApplication.java
    :314) [spring-boot-1.5.3.RELEASE.jar!/:1.5.3.RELEASE]
            at org.springframework.boot.SpringApplication.run(SpringApplication.java
    :1162) [spring-boot-1.5.3.RELEASE.jar!/:1.5.3.RELEASE]
            at org.springframework.boot.SpringApplication.run(SpringApplication.java
    :1151) [spring-boot-1.5.3.RELEASE.jar!/:1.5.3.RELEASE]
            at com.anzen.safences.SaFencesApplication.main(SaFencesApplication.java:
    37) [classes!/:na]
            at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.
    0_121]
            at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[na:1.8.
    0_121]
            at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[na:
    1.8.0_121]
            at java.lang.reflect.Method.invoke(Unknown Source) ~[na:1.8.0_121]
            at org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner
    .java:48) [Safences-MV-1.0.6-SNAPSHOT.jar:na]
            at org.springframework.boot.loader.Launcher.launch(Launcher.java:87) [Sa
    fences-MV-1.0.6-SNAPSHOT.jar:na]
            at org.springframework.boot.loader.Launcher.launch(Launcher.java:50) [Sa
    fences-MV-1.0.6-SNAPSHOT.jar:na]
            at org.springframework.boot.loader.JarLauncher.main(JarLauncher.java:51)
     [Safences-MV-1.0.6-SNAPSHOT.jar:na]
    Caused by: org.apache.catalina.LifecycleException: Failed to start component [St
    andardEngine[Tomcat].StandardHost[localhost]]
            at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:167)
    [tomcat-embed-core-8.5.14.jar!/:8.5.14]
            at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.
    java:1419) ~[tomcat-embed-core-8.5.14.jar!/:8.5.14]
            at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.
    java:1409) ~[tomcat-embed-core-8.5.14.jar!/:8.5.14]
            at java.util.concurrent.FutureTask.run(Unknown Source) ~[na:1.8.0_121]
            at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) ~[n
    a:1.8.0_121]
            at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) ~[
    na:1.8.0_121]
            at java.lang.Thread.run(Unknown Source) ~[na:1.8.0_121]
    Caused by: org.apache.catalina.LifecycleException: A child container failed duri
    ng start
            at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.ja
    va:947) ~[tomcat-embed-core-8.5.14.jar!/:8.5.14]
            at org.apache.catalina.core.StandardHost.startInternal(StandardHost.java
    :872) ~[tomcat-embed-core-8.5.14.jar!/:8.5.14]
            at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
    [tomcat-embed-core-8.5.14.jar!/:8.5.14]
            ... 6 common frames omitted

    2017-06-23 20:59:20.081  WARN 4756 --- [           main] ationConfigEmbeddedWebA
    pplicationContext : Exception encountered during context initialization - cancel
    ling refresh attempt: org.springframework.context.ApplicationContextException: U
    nable to start embedded container; nested exception is org.springframework.boot.
    context.embedded.EmbeddedServletContainerException: Unable to start embedded Tom
    cat
    2017-06-23 20:59:20.123 ERROR 4756 --- [           main] o.s.boot.SpringApplicat
    ion               : Application startup failed

    org.springframework.context.ApplicationContextException: Unable to start embedde
    d container; nested exception is org.springframework.boot.context.embedded.Embed
    dedServletContainerException: Unable to start embedded Tomcat
            at org.springframework.boot.context.embedded.EmbeddedWebApplicationConte
    xt.onRefresh(EmbeddedWebApplicationContext.java:137) ~[spring-boot-1.5.3.RELEASE
    .jar!/:1.5.3.RELEASE]
            at org.springframework.context.support.AbstractApplicationContext.refres
    h(AbstractApplicationContext.java:536) ~[spring-context-4.3.8.RELEASE.jar!/:4.3.
    8.RELEASE]
            at org.springframework.boot.context.embedded.EmbeddedWebApplicationConte
    xt.refresh(EmbeddedWebApplicationContext.java:122) ~[spring-boot-1.5.3.RELEASE.j
    ar!/:1.5.3.RELEASE]
            at org.springframework.boot.SpringApplication.refresh(SpringApplication.
    java:737) [spring-boot-1.5.3.RELEASE.jar!/:1.5.3.RELEASE]
            at org.springframework.boot.SpringApplication.refreshContext(SpringAppli
    cation.java:370) [spring-boot-1.5.3.RELEASE.jar!/:1.5.3.RELEASE]
            at org.springframework.boot.SpringApplication.run(SpringApplication.java
    :314) [spring-boot-1.5.3.RELEASE.jar!/:1.5.3.RELEASE]
            at org.springframework.boot.SpringApplication.run(SpringApplication.java
    :1162) [spring-boot-1.5.3.RELEASE.jar!/:1.5.3.RELEASE]
            at org.springframework.boot.SpringApplication.run(SpringApplication.java
    :1151) [spring-boot-1.5.3.RELEASE.jar!/:1.5.3.RELEASE]
            at com.anzen.safences.SaFencesApplication.main(SaFencesApplication.java:
    37) [classes!/:na]
            at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.
    0_121]
            at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[na:1.8.
    0_121]
            at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[na:
    1.8.0_121]
            at java.lang.reflect.Method.invoke(Unknown Source) ~[na:1.8.0_121]
            at org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner
    .java:48) [Safences-MV-1.0.6-SNAPSHOT.jar:na]
            at org.springframework.boot.loader.Launcher.launch(Launcher.java:87) [Sa
    fences-MV-1.0.6-SNAPSHOT.jar:na]
            at org.springframework.boot.loader.Launcher.launch(Launcher.java:50) [Sa
    fences-MV-1.0.6-SNAPSHOT.jar:na]
            at org.springframework.boot.loader.JarLauncher.main(JarLauncher.java:51)
     [Safences-MV-1.0.6-SNAPSHOT.jar:na]
    Caused by: org.springframework.boot.context.embedded.EmbeddedServletContainerExc
    eption: Unable to start embedded Tomcat
            at org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServle
    tContainer.initialize(TomcatEmbeddedServletContainer.java:123) ~[spring-boot-1.5
    .3.RELEASE.jar!/:1.5.3.RELEASE]
            at org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServle
    tContainer.<init>(TomcatEmbeddedServletContainer.java:84) ~[spring-boot-1.5.3.RE
    LEASE.jar!/:1.5.3.RELEASE]
            at org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServle
    tContainerFactory.getTomcatEmbeddedServletContainer(TomcatEmbeddedServletContain
    erFactory.java:554) ~[spring-boot-1.5.3.RELEASE.jar!/:1.5.3.RELEASE]
            at org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServle
    tContainerFactory.getEmbeddedServletContainer(TomcatEmbeddedServletContainerFact
    ory.java:179) ~[spring-boot-1.5.3.RELEASE.jar!/:1.5.3.RELEASE]
            at org.springframework.boot.context.embedded.EmbeddedWebApplicationConte
    xt.createEmbeddedServletContainer(EmbeddedWebApplicationContext.java:164) ~[spri
    ng-boot-1.5.3.RELEASE.jar!/:1.5.3.RELEASE]
            at org.springframework.boot.context.embedded.EmbeddedWebApplicationConte
    xt.onRefresh(EmbeddedWebApplicationContext.java:134) ~[spring-boot-1.5.3.RELEASE
    .jar!/:1.5.3.RELEASE]
            ... 16 common frames omitted
    Caused by: org.apache.catalina.LifecycleException: Failed to start component [St
    andardServer[-1]]
            at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:167)
    ~[tomcat-embed-core-8.5.14.jar!/:8.5.14]
            at org.apache.catalina.startup.Tomcat.start(Tomcat.java:344) ~[tomcat-em
    bed-core-8.5.14.jar!/:8.5.14]
            at org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServle
    tContainer.initialize(TomcatEmbeddedServletContainer.java:99) ~[spring-boot-1.5.
    3.RELEASE.jar!/:1.5.3.RELEASE]
            ... 21 common frames omitted
    Caused by: org.apache.catalina.LifecycleException: Failed to start component [St
    andardService[Tomcat]]
            at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:167)
    ~[tomcat-embed-core-8.5.14.jar!/:8.5.14]
            at org.apache.catalina.core.StandardServer.startInternal(StandardServer.
    java:793) ~[tomcat-embed-core-8.5.14.jar!/:8.5.14]
            at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
    ~[tomcat-embed-core-8.5.14.jar!/:8.5.14]
            ... 23 common frames omitted
    Caused by: org.apache.catalina.LifecycleException: Failed to start component [St
    andardEngine[Tomcat]]
            at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:167)
    ~[tomcat-embed-core-8.5.14.jar!/:8.5.14]
            at org.apache.catalina.core.StandardService.startInternal(StandardServic
    e.java:422) ~[tomcat-embed-core-8.5.14.jar!/:8.5.14]
            at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
    ~[tomcat-embed-core-8.5.14.jar!/:8.5.14]
            ... 25 common frames omitted
    Caused by: org.apache.catalina.LifecycleException: A child container failed duri
    ng start
            at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.ja
    va:947) ~[tomcat-embed-core-8.5.14.jar!/:8.5.14]
            at org.apache.catalina.core.StandardEngine.startInternal(StandardEngine.
    java:262) ~[tomcat-embed-core-8.5.14.jar!/:8.5.14]
            at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
    ~[tomcat-embed-core-8.5.14.jar!/:8.5.14]
            ... 27 common frames omitted

我的gradle文件看起来

apply plugin: 'application'
apply plugin: 'eclipse'
apply plugin: 'war'
apply plugin: 'java'
apply plugin: 'idea'
apply plugin: 'org.springframework.boot'

repositories {
    mavenCentral()   
}

buildscript {
    repositories {
        mavenCentral()
    }
    dependencies {
        classpath("org.springframework.boot:spring-boot-gradle-plugin:1.5.3.RELEASE")
    }
}

jar {
    baseName = 'Safences'
    version =  'MV-1.0.6-SNAPSHOT'
}

sourceCompatibility = 1.8
targetCompatibility = 1.8
dependencies {

    compile 'org.slf4j:slf4j-api:1.7.21'
    compile group: 'javax.ws.rs', name: 'javax.ws.rs-api', version: '2.0.1'
    compile group: 'javax.ws.rs', name: 'jsr311-api', version: '1.1.1'
    testCompile 'junit:junit:4.12'
    compile("org.springframework.boot:spring-boot-starter-web:1.3.5.RELEASE")
    compile("org.springframework.boot:spring-boot-starter-jersey:1.3.5.RELEASE")

    compile group: 'org.aeonbits.owner', name: 'owner', version: '1.0.9'
    compile group: 'com.google.code.gson', name: 'gson', version: '2.7'
    compile 'org.mongodb.morphia:morphia:1.2.1'

    // https://mvnrepository.com/artifact/org.glassfish.jersey.media/jersey-media-multipart
    compile group: 'org.glassfish.jersey.media', name: 'jersey-media-multipart', version: '2.22.2'

    // https://mvnrepository.com/artifact/com.amazonaws/aws-java-sdk
    compile group: 'com.amazonaws', name: 'aws-java-sdk', version: '1.11.105'

    // https://mvnrepository.com/artifact/commons-fileupload/commons-fileupload
    compile group: 'commons-fileupload', name: 'commons-fileupload', version: '1.2.1'

    // https://mvnrepository.com/artifact/commons-io/commons-io
    compile group: 'commons-io', name: 'commons-io', version: '1.2'

    // https://mvnrepository.com/artifact/org.springframework/spring-mock
    compile group: 'org.springframework', name: 'spring-mock', version: '2.0.8'

    // https://mvnrepository.com/artifact/org.neo4j/neo4j-cypher-compiler-2.2
    compile group: 'org.neo4j', name: 'neo4j-cypher-compiler-2.2', version: '2.2.5'

    // https://mvnrepository.com/artifact/com.hazelcast/hazelcast
    compile group: 'com.hazelcast', name: 'hazelcast', version: '3.8.2'


    compile('org.apache.tomcat.embed:tomcat-embed-jasper:8.0.30')


}


task wrapper(type: Wrapper) {
    gradleVersion = '2.3'
}

1 个答案:

答案 0 :(得分:0)

您需要从build.gradle中删除以下内容:

compile('org.apache.tomcat.embed:tomcat-embed-jasper:8.0.30')

Tomcat已作为您spring-boot-starter-web依赖项的依赖项包含在内。

您可以通过运行gradle dependencies

来查看此内容