刘青峰 2019-07-02 20:35 采纳率: 0%
浏览 422

关于 spring boot 用gradle打包 war后运行的问题

打包以后 出现错误

2-Jul-2019 16:00:10.516 严重 [localhost-startStop-1] org.apache.catalina.core.StandardContext.startInternal Error during ServletContainerInitializer processing
 javax.servlet.ServletException: Failed to instantiate WebApplicationInitializer class
    at org.springframework.web.SpringServletContainerInitializer.onStartup(SpringServletContainerInitializer.java:155)
    at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5267)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
    at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:754)
    at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:730)
    at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:734)
    at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:1140)
    at org.apache.catalina.startup.HostConfig$DeployDirectory.run(HostConfig.java:1875)
    at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
    at java.util.concurrent.FutureTask.run(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
    at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.InstantiationException: io.j99.app.measure.Application
    at java.lang.Class.newInstance(Unknown Source)
    at org.springframework.web.SpringServletContainerInitializer.onStartup(SpringServletContainerInitializer.java:152)
    ... 12 more
Caused by: java.lang.NoSuchMethodException: io.j99.app.measure.Application.<init>()
    at java.lang.Class.getConstructor0(Unknown Source)
    ... 14 more

02-Jul-2019 16:00:10.516 严重 [localhost-startStop-1] org.apache.catalina.core.StandardContext.startInternal Context [/measure-0.0.1] startup failed due to previous errors
02-Jul-2019 16:00:10.562 警告 [localhost-startStop-1] org.apache.catalina.loader.WebappClassLoaderBase.clearReferencesThreads The web application [measure-0.0.1] appears to have started a thread named [Abandoned connection cleanup thread] but has failed to stop it. This is very likely to create a memory leak. Stack trace of thread:
02-Jul-2019 16:00:10.562 信息 [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deployment of web application directory [D:\Program Files\Apache Software Foundation\Tomcat 8.5\webapps\measure-0.0.1] has finished in [5,484] ms
02-Jul-2019 16:00:10.562 信息 [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deploying web application directory [D:\Program Files\Apache Software Foundation\Tomcat 8.5\webapps\ROOT]
02-Jul-2019 16:00:10.734 信息 [36] org.apache.catalina.loader.WebappClassLoaderBase.checkStateForResourceLoading Illegal access: this web application instance has been stopped already. Could not load []. The following stack trace is thrown for debugging purposes as well as to attempt to terminate the thread which caused the illegal access.
 java.lang.IllegalStateException: Illegal access: this web application instance has been stopped already. Could not load []. The following stack trace is thrown for debugging purposes as well as to attempt to terminate the thread which caused the illegal access.
    at org.apache.catalina.loader.WebappClassLoaderBase.checkStateForResourceLoading(WebappClassLoaderBase.java:1364)
    at org.apache.catalina.loader.WebappClassLoaderBase.getResource(WebappClassLoaderBase.java:1021)
    at com.mysql.cj.jdbc.AbandonedConnectionCleanupThread.checkContextClassLoaders(AbandonedConnectionCleanupThread.java:96)
    at com.mysql.cj.jdbc.AbandonedConnectionCleanupThread.run(AbandonedConnectionCleanupThread.java:69)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
    at java.lang.Thread.run(Unknown Source)


apply plugin: 'java'
apply plugin: 'org.springframework.boot'
//apply plugin: 'spring-boot'

//apply plugin: 'watch'
apply plugin: 'war'
war {
    baseName = 'measure'
    version = '0.0.1'
}
/*apply plugin: 'idea'
idea {
    module {
        inheritOutputDirs = false
        outputDir = file("$buildDir/classes/main/")
    }
}*/
repositories {
    maven { url "http://maven.aliyun.com/nexus/content/repositories/public/" }
    maven { url "http://repo.spring.io/libs-snapshot" }
}

tasks.withType(JavaCompile) {
    options.encoding = 'UTF-8'
}

sourceCompatibility = 1.8
targetCompatibility = 1.8
springBoot {
    executable = true
}
configurations {
    // providedRuntime
     dev
}
/*jar {
    mainClass = "io.j99.app.measure.Application"
}*/
dependencies {
    compile("commons-logging:commons-logging:1.2")
    compile("javax.servlet:javax.servlet-api:4.0.1")

//
     compile group: 'org.apache.tomcat.embed', name: 'tomcat-embed-jasper', version: '9.0.8'
    compile("org.springframework.boot:spring-boot-devtools")
    //


    compile group: 'org.springframework.boot', name: 'spring-boot-dependencies', version: '2.2.0.M4'
   compile group: 'org.springframework.boot', name: 'spring-boot-maven-plugin', version: '2.2.0.M4'


    ///
     compile ("org.springframework.boot:spring-boot-dependencies")
     compile ("org.springframework.boot:spring-boot-maven-plugin")
    ///

    ////
    compile group: 'cn.org.faster', name: 'spring-boot-starter-parent', version: '1.1.1.RELEASE'
    compile ("org.springframework.boot:spring-boot-starter-tomcat")
    compile ("org.springframework.boot:spring-boot-starter-web")
    compile ("org.springframework.boot:spring-boot-devtools")


    //
    compile "org.springframework.boot:spring-boot-configuration-processor"
    compile("mysql:mysql-connector-java:8.0.12")
    ///
    compile fileTree(dir: 'libs', include: ['*.jar'])
   // dev("org.springframework.boot:spring-boot-devtools")
    testCompile("org.springframework.boot:spring-boot-starter-test")
    compile "io.springfox:springfox-swagger2:2.5.0"
    compile("org.springframework.session:spring-session")
    compile("org.simpleframework:simple-xml:2.7")
    compile("org.springframework.boot:spring-boot-starter-thymeleaf")
    compile("org.springframework.boot:spring-boot-starter-data-redis")
    compile("org.springframework.boot:spring-boot-starter-data-rest")
    compile 'io.jsonwebtoken:jjwt:0.6.0'
//    compile("org.springframework.boot:spring-boot-starter-data-mongodb")
    compile("org.springframework.boot:spring-boot-starter-jdbc")
    compile("org.springframework.boot:spring-boot-starter-data-jpa")
    compile("org.springframework.boot:spring-boot-starter-actuator")
   // compile("mysql:mysql-connector-java")
    compile("com.fasterxml.jackson.datatype:jackson-datatype-jsr310:2.6.0")
    compile 'com.squareup.retrofit2:retrofit:2.1.0'
    compile 'com.squareup.retrofit2:converter-jackson:2.1.0'
    compile 'com.squareup.retrofit2:adapter-rxjava:2.1.0'
    compile 'com.squareup.okhttp3:logging-interceptor:3.1.2'
    compile 'com.squareup.okhttp3:okhttp:3.1.2'
    compile("org.springframework.boot:spring-boot-starter-web")
    compile('commons-net:commons-net:3.5')
    compile('com.googlecode.log4jdbc:log4jdbc:1.2')
// https://mvnrepository.com/artifact/org.apache.poi/poi
    compile group: 'org.apache.poi', name: 'poi', version: '3.15'
    compile group: 'org.apache.poi', name: 'poi-ooxml', version: '3.15'
// https://mvnrepository.com/artifact/commons-lang/commons-lang
    compile group: 'commons-lang', name: 'commons-lang', version: '2.6'
    compile 'com.qiniu:qiniu-java-sdk:7.2.2'
    // https://mvnrepository.com/artifact/org.apache.ant/ant
    compile group: 'org.apache.ant', name: 'ant', version: '1.10.1'

}
bootRun {
    // addResources = true
   classpath = sourceSets.main.runtimeClasspath + configurations.dev
}


用gradle打包 war后 放入tomcat运行 报错
不知道是那个jar问题导致的 想问问各位大佬

  • 写回答

1条回答 默认 最新

  • dabocaiqq 2019-07-04 00:12
    关注
    评论

报告相同问题?

悬赏问题

  • ¥15 求差集那个函数有问题,有无佬可以解决
  • ¥15 【提问】基于Invest的水源涵养
  • ¥20 微信网友居然可以通过vx号找到我绑的手机号
  • ¥15 寻一个支付宝扫码远程授权登录的软件助手app
  • ¥15 解riccati方程组
  • ¥15 display:none;样式在嵌套结构中的已设置了display样式的元素上不起作用?
  • ¥15 使用rabbitMQ 消息队列作为url源进行多线程爬取时,总有几个url没有处理的问题。
  • ¥15 Ubuntu在安装序列比对软件STAR时出现报错如何解决
  • ¥50 树莓派安卓APK系统签名
  • ¥65 汇编语言除法溢出问题