从tomcat管理器部署springboot应用程序war文件,但每次都会收到404错误

时间:2017-11-16 09:57:06

标签: java tomcat spring-boot gradle

我想使用tomcat主机管理器war部署面板在Digital Ocean Tomcat实例上部署我的springboot应用程序,但每次我都收到错误在这里我将提供我的文件和日志的所有详细信息,请查看详细信息并提供解决方案。 我使用此链接在服务器上安装tomcat - > this
这是我的catalina.out文件日志......

6-Nov-2017 08:54:14.353 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Server version:        Apache Tomcat/8.5.23
16-Nov-2017 08:54:14.357 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Server built:          Sep 28 2017 10:30:11 UTC
16-Nov-2017 08:54:14.357 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Server number:         8.5.23.0
16-Nov-2017 08:54:14.361 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log OS Name:               Linux
16-Nov-2017 08:54:14.361 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log OS Version:            4.4.0-98-generic
16-Nov-2017 08:54:14.362 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Architecture:          amd64
16-Nov-2017 08:54:14.362 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Java Home:             /usr/lib/jvm/java-8-oracle/jre
16-Nov-2017 08:54:14.362 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log JVM Version:           1.8.0_151-b12
16-Nov-2017 08:54:14.363 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log JVM Vendor:            Oracle Corporation
16-Nov-2017 08:54:14.363 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log CATALINA_BASE:         /opt/tomcat
16-Nov-2017 08:54:14.363 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log CATALINA_HOME:         /opt/tomcat
16-Nov-2017 08:54:14.364 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.util.logging.config.file=/opt/tomcat/conf/logging.properties
16-Nov-2017 08:54:14.365 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager
16-Nov-2017 08:54:14.366 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.awt.headless=true
16-Nov-2017 08:54:14.367 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.security.egd=file:/dev/./urandom
16-Nov-2017 08:54:14.367 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djdk.tls.ephemeralDHKeySize=2048
16-Nov-2017 08:54:14.367 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.protocol.handler.pkgs=org.apache.catalina.webresources
16-Nov-2017 08:54:14.368 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Xms512M
16-Nov-2017 08:54:14.368 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Xmx1024M
16-Nov-2017 08:54:14.368 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -XX:+UseParallelGC
16-Nov-2017 08:54:14.369 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dcatalina.base=/opt/tomcat
16-Nov-2017 08:54:14.370 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dcatalina.home=/opt/tomcat
16-Nov-2017 08:54:14.373 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.io.tmpdir=/opt/tomcat/temp
16-Nov-2017 08:54:14.373 INFO [main] org.apache.catalina.core.AprLifecycleListener.lifecycleEvent The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: [/usr/java/packages/lib/amd64:/usr/lib64:/lib64:/lib:/usr/lib]
16-Nov-2017 08:54:14.728 INFO [main] org.apache.coyote.AbstractProtocol.init Initializing ProtocolHandler ["http-nio-8080"]
16-Nov-2017 08:54:14.772 INFO [main] org.apache.tomcat.util.net.NioSelectorPool.getSharedSelector Using a shared selector for servlet write/read
16-Nov-2017 08:54:14.789 INFO [main] org.apache.coyote.AbstractProtocol.init Initializing ProtocolHandler ["ajp-nio-8009"]
16-Nov-2017 08:54:14.794 INFO [main] org.apache.tomcat.util.net.NioSelectorPool.getSharedSelector Using a shared selector for servlet write/read
16-Nov-2017 08:54:14.795 INFO [main] org.apache.catalina.startup.Catalina.load Initialization processed in 1451 ms
16-Nov-2017 08:54:14.875 INFO [main] org.apache.catalina.core.StandardService.startInternal Starting service [Catalina]
16-Nov-2017 08:54:14.876 INFO [main] org.apache.catalina.core.StandardEngine.startInternal Starting Servlet Engine: Apache Tomcat/8.5.23
16-Nov-2017 08:54:14.893 SEVERE [Catalina-startStop-1] org.apache.catalina.startup.HostConfig.beforeStart Unable to create directory for deployment: [/opt/tomcat/conf/Catalina/localhost]
16-Nov-2017 08:54:14.941 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployWAR Deploying web application archive [/opt/tomcat/webapps/petsearch.war]
16-Nov-2017 08:54:15.849 FINE [localhost-startStop-1] org.apache.jasper.servlet.TldScanner.scanResourcePaths No TLD files were found in resource path [/WEB-INF/].
16-Nov-2017 08:54:15.923 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployWAR Deployment of web application archive [/opt/tomcat/webapps/petsearch.war] has finished in [982] ms
16-Nov-2017 08:54:15.926 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deploying web application directory [/opt/tomcat/webapps/host-manager]
16-Nov-2017 08:54:15.993 FINE [localhost-startStop-1] org.apache.jasper.servlet.TldScanner.scanResourcePaths No TLD files were found in resource path [/WEB-INF/jsp/].
16-Nov-2017 08:54:15.995 FINE [localhost-startStop-1] org.apache.jasper.servlet.TldScanner.scanResourcePaths No TLD files were found in resource path [/WEB-INF/].
16-Nov-2017 08:54:16.024 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deployment of web application directory [/opt/tomcat/webapps/host-manager] has finished in [91] ms
16-Nov-2017 08:54:16.029 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deploying web application directory [/opt/tomcat/webapps/manager]
16-Nov-2017 08:54:16.067 FINE [localhost-startStop-1] org.apache.jasper.servlet.TldScanner.scanResourcePaths No TLD files were found in resource path [/WEB-INF/jsp/].
16-Nov-2017 08:54:16.070 FINE [localhost-startStop-1] org.apache.jasper.servlet.TldScanner.scanResourcePaths No TLD files were found in resource path [/WEB-INF/].
16-Nov-2017 08:54:16.288 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deployment of web application directory [/opt/tomcat/webapps/manager] has finished in [259] ms
16-Nov-2017 08:54:16.289 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deploying web application directory [/opt/tomcat/webapps/docs]
16-Nov-2017 08:54:16.334 FINE [localhost-startStop-1] org.apache.jasper.servlet.TldScanner.scanResourcePaths No TLD files were found in resource path [/WEB-INF/].
16-Nov-2017 08:54:16.342 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deployment of web application directory [/opt/tomcat/webapps/docs] has finished in [53] ms
16-Nov-2017 08:54:16.342 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deploying web application directory [/opt/tomcat/webapps/examples]
16-Nov-2017 08:54:16.624 FINE [localhost-startStop-1] org.apache.jasper.servlet.TldScanner.scanResourcePaths No TLD files were found in resource path [/WEB-INF/jsp/applet/].
16-Nov-2017 08:54:16.626 FINE [localhost-startStop-1] org.apache.jasper.servlet.TldScanner.scanResourcePaths TLD files were found in resource path [/WEB-INF/jsp/].
16-Nov-2017 08:54:16.628 FINE [localhost-startStop-1] org.apache.jasper.servlet.TldScanner.scanResourcePaths No TLD files were found in resource path [/WEB-INF/tags/].
16-Nov-2017 08:54:16.629 FINE [localhost-startStop-1] org.apache.jasper.servlet.TldScanner.scanResourcePaths TLD files were found in resource path [/WEB-INF/jsp2/].
16-Nov-2017 08:54:16.629 FINE [localhost-startStop-1] org.apache.jasper.servlet.TldScanner.scanResourcePaths No TLD files were found in resource path [/WEB-INF/].
16-Nov-2017 08:54:16.651 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deployment of web application directory [/opt/tomcat/webapps/examples] has finished in [309] ms
16-Nov-2017 08:54:16.653 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deploying web application directory [/opt/tomcat/webapps/ROOT]
16-Nov-2017 08:54:16.683 FINE [localhost-startStop-1] org.apache.jasper.servlet.TldScanner.scanResourcePaths No TLD files were found in resource path [/WEB-INF/].
16-Nov-2017 08:54:16.686 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deployment of web application directory [/opt/tomcat/webapps/ROOT] has finished in [33] ms
16-Nov-2017 08:54:16.692 INFO [main] org.apache.coyote.AbstractProtocol.start Starting ProtocolHandler ["http-nio-8080"]
16-Nov-2017 08:54:16.730 INFO [main] org.apache.coyote.AbstractProtocol.start Starting ProtocolHandler ["ajp-nio-8009"]
16-Nov-2017 08:54:16.754 INFO [main] org.apache.catalina.startup.Catalina.start Server startup in 1958 ms

这里是我的catalina.properties文件

#     "foo/bar.jar": Add bar.jar as a class repository
# Please note that for single jars, e.g. bar.jar, you need the URL form
# starting with file:.
#
# Note: Values may be enclosed in double quotes ("...") in case either the
#       ${catalina.base} path or the ${catalina.home} path contains a comma.
#       Because double quotes are used for quoting, the double quote character
#       may not appear in a path.
shared.loader=

# Default list of JAR files that should not be scanned using the JarScanner
# functionality. This is typically used to scan JARs for configuration
# information. JARs that do not contain such information may be excluded from
# the scan to speed up the scanning process. This is the default list. JARs on
# this list are excluded from all scans. The list must be a comma separated list
# of JAR file names.
# The list of JARs to skip may be over-ridden at a Context level for individual
# scan types by configuring a JarScanner with a nested JarScanFilter.
# The JARs listed below include:
# - Tomcat Bootstrap JARs
# - Tomcat API JARs
# - Catalina JARs
# - Jasper JARs
# - Tomcat JARs
# - Common non-Tomcat JARs
# - Test JARs (JUnit, Cobertura and dependencies)
tomcat.util.scan.StandardJarScanFilter.jarsToSkip=\
bootstrap.jar,commons-daemon.jar,tomcat-juli.jar,\
annotations-api.jar,el-api.jar,jsp-api.jar,servlet-api.jar,websocket-api.jar,\
jaspic-api.jar,\
catalina.jar,catalina-ant.jar,catalina-ha.jar,catalina-storeconfig.jar,\
catalina-tribes.jar,\
jasper.jar,jasper-el.jar,ecj-*.jar,\
tomcat-api.jar,tomcat-util.jar,tomcat-util-scan.jar,tomcat-coyote.jar,\
tomcat-dbcp.jar,tomcat-jni.jar,tomcat-websocket.jar,\
tomcat-i18n-en.jar,tomcat-i18n-es.jar,tomcat-i18n-fr.jar,tomcat-i18n-ja.jar,\
tomcat-juli-adapters.jar,catalina-jmx-remote.jar,catalina-ws.jar,\
tomcat-jdbc.jar,\
tools.jar,\
commons-beanutils*.jar,commons-codec*.jar,commons-collections*.jar,\
commons-dbcp*.jar,commons-digester*.jar,commons-fileupload*.jar,\
commons-httpclient*.jar,commons-io*.jar,commons-lang*.jar,commons-logging*.jar,\
commons-math*.jar,commons-pool*.jar,\
jstl.jar,taglibs-standard-spec-*.jar,\
geronimo-spec-jaxrpc*.jar,wsdl4j*.jar,\
ant.jar,ant-junit*.jar,aspectj*.jar,jmx.jar,h2*.jar,hibernate*.jar,httpclient*.jar,\
jmx-tools.jar,jta*.jar,log4j*.jar,mail*.jar,slf4j*.jar,\
xercesImpl.jar,xmlParserAPIs.jar,xml-apis.jar,\
junit.jar,junit-*.jar,hamcrest-*.jar,easymock-*.jar,cglib-*.jar,\
objenesis-*.jar,ant-launcher.jar,\
cobertura-*.jar,asm-*.jar,dom4j-*.jar,icu4j-*.jar,jaxen-*.jar,jdom-*.jar,\
jetty-*.jar,oro-*.jar,servlet-api-*.jar,tagsoup-*.jar,xmlParserAPIs-*.jar,\
xom-*.jar


# Added this line in my catalina.properties file

tomcat.util.scan.StandardJarScanFilter.jarsToSkip=*

# Default list of JAR files that should be scanned that overrides the default
# jarsToSkip list above. This is typically used to include a specific JAR that
# has been excluded by a broad file name pattern in the jarsToSkip list.
# The list of JARs to scan may be over-ridden at a Context level for individual
# scan types by configuring a JarScanner with a nested JarScanFilter.
tomcat.util.scan.StandardJarScanFilter.jarsToScan=\
log4j-web*.jar,log4j-taglib*.jar,log4javascript*.jar,slf4j-taglib*.jar

# String cache configuration.
tomcat.util.buf.StringCache.byte.enabled=true
#tomcat.util.buf.StringCache.char.enabled=true
#tomcat.util.buf.StringCache.trainThreshold=500000
#tomcat.util.buf.StringCache.cacheSize=5000

# Allow for changes to HTTP request validation
# WARNING: Using this option will expose the server to CVE-2016-6816
#tomcat.util.http.parser.HttpParser.requestTargetAllow=|

以下是具有权限的服务器上所有目录的屏幕截图 snapshot

这是我的build.grdle文件

buildscript {
    ext {
        springBootVersion = '1.4.1.RELEASE'
    }
    repositories {
        mavenCentral()
    }
    dependencies {
        classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}")
        classpath 'org.hidetake:gradle-ssh-plugin:1.1.3'
    }
}

group 'com.infin.petsearch'
version '1.0.0'


apply plugin: 'java'
apply plugin: 'eclipse'
apply plugin: 'spring-boot'
apply plugin: 'idea'
apply plugin: 'war'
apply plugin: "org.hidetake.ssh"

jar {
    baseName = 'petsearch'
    version = '0.0.1-SNAPSHOT'
}
sourceCompatibility = 1.8
targetCompatibility = 1.8

repositories {
    mavenCentral()
}


dependencies {
    compile('org.springframework.boot:spring-boot-starter')
    compile 'org.springframework.boot:spring-boot-starter-web'
    compile 'org.springframework:spring-jdbc'
    compile 'mysql:mysql-connector-java:5.1.36'
    compile 'org.json:json:20160810'
    compile 'com.google.code.gson:gson:2.6.2'
    compile 'com.amazonaws:aws-java-sdk-s3:1.11.53'
    testCompile('org.springframework.boot:spring-boot-starter-test')
}

eclipse {
    classpath {
        downloadSources = true
        downloadJavadoc = true
    }
}

idea {
    module {
        downloadSources = true
        downloadJavadoc = true
    }
}
war.archiveName "${project.name}.war"
jar.archiveName "${project.name}.jar"

remotes {       
    webServer {     
        host = '139.59.84.100'//"${host}"
        user = 'usernamehere'//"${user}"
        password ='passwordhere'
        //identity = file('ssh-keys/id_rsa.pub')
        //passphrase = 'ubernet@123'//"${passphrase}"
        knownHosts = allowAnyHosts
    }       
}
def artifactPath = "${buildDir}/libs/${project.name}.war" 

task deploy() << {
  ssh.run {
    session(remotes.webServer) {
        put from: artifactPath, into: "${deployment_directory}"
    }
  }
}

def jarPath = "${deployment_directory}/${project.name}.war"

task start(dependsOn: deploy ) << {
    ssh.run {
    session(remotes.webServer) {
     //execute 'chmod +x/home/sitaram/'+jarPath
     execute 'java -jar '+ jarPath
    }
  }
}
task wrapper(type: Wrapper){
    gradleVersion = '2.6'
}

但每次我尝试访问我的应用程序时,它总是会显示此页面

Snapshot

0 个答案:

没有答案