我试图在tomcat上使用bmuschko tomcat插件(https://github.com/bmuschko/gradle-tomcat-plugin)部署spring应用程序。使用Tomcat gradle插件部署Spring应用程序
我的webapp文件夹中有一个index.jsp显示正确。问题是我的应用程序没有被部署。 (但Tomcat工作正常,因为我的index.jsp显示正确)。我认为这可能与它是一个春季应用程序有关,但我不知道如何克服这个问题(我没有得到任何错误,我不确定在哪里可以找到我的卡塔利娜日志)。
我班的build.gradle:
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath("org.springframework.boot:spring-boot-gradle-plugin:1.3.3.RELEASE")
}
}
apply plugin: 'java'
apply plugin: 'eclipse'
apply plugin: 'idea'
apply plugin: 'spring-boot'
apply plugin: 'war'
apply plugin: 'com.bmuschko.tomcat'
jar {
baseName = 'gs-accessing-data-jpa'
version = '0.1.0'
manifest {
attributes 'Main-Class': 'tutorialDatabaseServer.Application'
}
}
repositories {
mavenCentral()
maven {
url "https://repository.jboss.org/nexus/content/repositories/releases"
}
}
sourceCompatibility = 1.8
targetCompatibility = 1.8
dependencies {
compile("org.springframework.boot:spring-boot-starter-data-jpa")
compile("org.postgresql:postgresql")
testCompile("junit:junit")
compile("org.springframework.boot:spring-boot-starter-web")
compile("org.springframework.boot:spring-boot-starter-actuator")
// compile("org.postgresql:postgresql:9.4-1201-jdbc41")
compile("com.fasterxml.jackson.core:jackson-databind")
compile("org.liquibase:liquibase-core:3.3.3")
compile("org.springframework.boot:spring-boot-starter-data-mongodb")
compile 'org.springframework.boot:spring-boot-starter-thymeleaf'
compile("org.springframework.boot:spring-boot-starter-web")
compile group: 'org.hibernate', name: 'hibernate-validator', version:'4.2.0.Final'
compile group: 'javax.el', name: 'el-api', version: '2.2.1-b04'
compile group: 'org.postgresql', name: 'postgresql', version: '9.4.1212'
def tomcatVersion = '8.5.16'
tomcat "org.apache.tomcat.embed:tomcat-embed-core:${tomcatVersion}",
"org.apache.tomcat.embed:tomcat-embed-logging-juli:8.5.2",
"org.apache.tomcat.embed:tomcat-embed-jasper:${tomcatVersion}"
}
tomcat {
httpProtocol = 'org.apache.coyote.http11.Http11Nio2Protocol'
ajpProtocol = 'org.apache.coyote.ajp.AjpNio2Protocol'
}
task wrapper(type: Wrapper) {
gradleVersion = '2.3'
}
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.bmuschko:gradle-tomcat-plugin:2.3'
}
}
和我的应用程序:
@SpringBootApplication
public class Application {
private static final Logger log =
LoggerFactory.getLogger(Application.class);
public static void main(String[] args) {
SpringApplication.run(Application.class);
}
}
非常感谢。
编辑:改变的建议我的应用程序类后,tomcat的日志是下列之一:
jul 25, 2017 8:53:37 AM org.apache.coyote.AbstractProtocol init
INFORMACIÓN: Initializing ProtocolHandler ["http-nio2-8080"]
jul 25, 2017 8:53:37 AM org.apache.coyote.AbstractProtocol init
INFORMACIÓN: Initializing ProtocolHandler ["ajp-nio2-8009"]
jul 25, 2017 8:53:37 AM org.apache.catalina.core.StandardService startInternal
INFORMACIÓN: Starting service [Tomcat]
jul 25, 2017 8:53:37 AM org.apache.catalina.core.StandardEngine startInternal
INFORMACIÓN: Starting Servlet Engine: Apache Tomcat/8.5.16
jul 25, 2017 8:53:37 AM org.apache.catalina.startup.ContextConfig getDefaultWebXmlFragment
INFORMACIÓN: No global web.xml found
jul 25, 2017 8:54:08 AM org.apache.jasper.servlet.TldScanner scanJars
INFORMACIÓN: At least one JAR was scanned for TLDs yet contained no TLDs. Enable debug logging for this logger for a complete list of JARs that were scanned but no TLDs were found in them. Skipping unneeded JARs during scanning can improve startup time and JSP compilation time.
jul 25, 2017 8:54:09 AM org.apache.jasper.servlet.TldScanner scanJars
INFORMACIÓN: At least one JAR was scanned for TLDs yet contained no TLDs. Enable debug logging for this logger for a complete list of JARs that were scanned but no TLDs were found in them. Skipping unneeded JARs during scanning can improve startup time and JSP compilation time.
jul 25, 2017 8:54:09 AM org.apache.catalina.core.ApplicationContext log
INFORMACIÓN: Spring WebApplicationInitializers detected on classpath: [org.springframework.boot.autoconfigure[email protected]1f014eaa]
jul 25, 2017 8:54:09 AM org.apache.coyote.AbstractProtocol start
INFORMACIÓN: Starting ProtocolHandler ["http-nio2-8080"]
jul 25, 2017 8:54:09 AM org.apache.coyote.AbstractProtocol start
INFORMACIÓN: Starting ProtocolHandler ["ajp-nio2-8009"]
jul 25, 2017 8:55:31 AM org.apache.coyote.AbstractProtocol init
INFORMACIÓN: Initializing ProtocolHandler ["http-nio2-8080"]
jul 25, 2017 8:55:31 AM org.apache.coyote.AbstractProtocol init
INFORMACIÓN: Initializing ProtocolHandler ["ajp-nio2-8009"]
jul 25, 2017 8:55:31 AM org.apache.catalina.core.StandardService startInternal
INFORMACIÓN: Starting service [Tomcat]
jul 25, 2017 8:55:31 AM org.apache.catalina.core.StandardEngine startInternal
INFORMACIÓN: Starting Servlet Engine: Apache Tomcat/8.5.16
jul 25, 2017 8:55:31 AM org.apache.catalina.startup.ContextConfig getDefaultWebXmlFragment
INFORMACIÓN: No global web.xml found
jul 25, 2017 8:56:02 AM org.apache.jasper.servlet.TldScanner scanJars
INFORMACIÓN: At least one JAR was scanned for TLDs yet contained no TLDs. Enable debug logging for this logger for a complete list of JARs that were scanned but no TLDs were found in them. Skipping unneeded JARs during scanning can improve startup time and JSP compilation time.
jul 25, 2017 8:56:03 AM org.apache.jasper.servlet.TldScanner scanJars
INFORMACIÓN: At least one JAR was scanned for TLDs yet contained no TLDs. Enable debug logging for this logger for a complete list of JARs that were scanned but no TLDs were found in them. Skipping unneeded JARs during scanning can improve startup time and JSP compilation time.
jul 25, 2017 8:56:03 AM org.apache.catalina.core.ApplicationContext log
INFORMACIÓN: Spring WebApplicationInitializers detected on classpath: [org.springframework.boot.autoconfigure[email protected]4988a907, [email protected]]
现在我得到错误:失败:生成失败,出现异常。 *发生了什么问题: 任务':tomcatRun'的执行失败。 > java.lang.StackOverflowError(无错误消息) *尝试: 使用--stacktrace选项运行以获取堆栈跟踪。使用--info或--debug选项运行以获取更多日志输出。 @taner –
你能设置outputFile的插件来查看tomcat日志中打印的内容吗? – taner
我已经添加了tomcat日志@taner。再次感谢 –