gradle-tomcat-plugin icon indicating copy to clipboard operation
gradle-tomcat-plugin copied to clipboard

tomcatRun successfully kicks off server, but webapp gives 404 error

Open alexg313 opened this issue 10 years ago • 1 comments

I'm running into a similar issue as found at the bottom of: https://github.com/bmuschko/gradle-tomcat-plugin/issues/80

When I run tomcatRun, it successfully kicks off the server, but when I go to the server's URL, I get a 404 "The requested resource is not available" error. When I run tomcatRunWar, everything works as expected. Any idea why this happens? I've seen a few folks run into the same issue, but no solution as of yet.

I've included my build.gradle below

apply plugin: 'war' apply plugin: 'com.bmuschko.tomcat' apply plugin: 'java' apply plugin: 'propdeps' apply plugin: 'propdeps-maven' apply plugin: 'propdeps-idea' apply plugin: 'propdeps-eclipse' apply plugin: 'eclipse' apply plugin: 'idea'

buildscript { repositories { mavenCentral() maven { url "http://download.java.net/maven/2" } maven { url 'http://repo.spring.io/plugins-release' }

jcenter()

}

dependencies { classpath 'org.springframework.build.gradle:propdeps-plugin:0.0.7' classpath 'com.bmuschko:gradle-tomcat-plugin:2.0' } }

repositories { mavenCentral() maven { url 'http://repo.spring.io/milestone/'} }

dependencies {

compile fileTree(dir: 'lib', include: '*.jar')

def tomcatVersion = '7.0.57'
tomcat "org.apache.tomcat.embed:tomcat-embed-core:${tomcatVersion}",
        "org.apache.tomcat.embed:tomcat-embed-logging-juli:${tomcatVersion}"
tomcat("org.apache.tomcat.embed:tomcat-embed-jasper:${tomcatVersion}") {
  exclude group: 'org.eclipse.jdt.core.compiler', module: 'ecj'
}

compile 'org.springframework:spring-core:4.1.4.RELEASE'
compile 'org.springframework:spring-webmvc:4.1.4.RELEASE'
compile 'com.jayway.jsonpath:json-path:0.8.1'

// {!begin hateoas}
compile 'org.springframework.hateoas:spring-hateoas:0.16.0.RELEASE'
// {!end hateoas}

compile 'org.springframework.security:spring-security-web:3.2.5.RELEASE'
compile 'org.springframework.security:spring-security-core:3.2.5.RELEASE'
compile 'org.springframework.security:spring-security-config:3.2.5.RELEASE'

compile 'org.slf4j:slf4j-api:1.7.5'
runtime 'org.slf4j:slf4j-log4j12:1.7.5'

providedCompile 'javax.servlet:javax.servlet-api:3.1.0'


testCompile 'com.jayway.jsonpath:json-path-assert:0.8.1'
testCompile 'org.springframework:spring-test:3.2.3.RELEASE'
testCompile 'junit:junit:4.+'
testCompile "org.mockito:mockito-all:1.9.5"

compile 'org.springframework:spring-jdbc:4.1.4.RELEASE'
compile 'mysql:mysql-connector-java:5.1.26'

compile 'com.google.guava:guava:16.0.1' 

}

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

tomcatRunWar.contextPath = '' tomcatRun.contextPath = ''

tomcatRun.outputFile = file('tomcatRunLog.txt') tomcatRunWar.outputFile = file('tomcatRunWarLog.txt')

alexg313 avatar Feb 04 '15 23:02 alexg313

It's likely that newer versions of Tomcat 7 changed the internal behavior. This might be solely an issue with their implementation. Would you be interested in looking into it?

bmuschko avatar Feb 05 '15 00:02 bmuschko