spring boot war deployment to tomcat with status:OK But gives 404 on access

 

Questions


My configration class looks as follow

@Configuration
@EnableAutoConfiguration
@ComponentScan(basePackages = "com.projectx")

public class Application extends SpringBootServletInitializer{

    public static void main(String[] args) {

        SpringApplication.run(applicationClass, args);

    }

    @Override
    protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
        return application.sources(Application.class);
    }
}

Also build.gradle file looks like this

apply plugin: 'java'
sourceCompatibility=1.8
targetCompatibility=1.8

apply plugin: 'eclipse'
apply plugin: 'idea'
apply plugin: 'spring-boot'
apply plugin: 'war'


mainClassName = 'com.projectx.data.config.Application'

buildscript {
    repositories {
        maven { url "http://repo.spring.io/libs-release" }
        mavenLocal()
        mavenCentral()
    }
    dependencies {
        classpath("org.springframework.boot:spring-boot-gradle-plugin:1.2.1.RELEASE")
    }
}




war {
    baseName = 'gs-accessing-data-jpa'
    version =  '0.1.0'
}

repositories {
    mavenLocal()
    mavenCentral()
    maven { url "http://repo.spring.io/libs-release" }
    maven { url "https://repository.jboss.org/nexus/content/repositories/releases" }
}

configurations {

    providedRuntime

}

dependencies {
    compile("org.springframework.boot:spring-boot-starter-web")
    providedRuntime("org.springframework.boot:spring-boot-starter-tomcat")

}

So wherever i am deploying this project to tomcat it is showing following error. As I have mate all requirement to convert jar to war in spring not sure what is wrong this my project.

It gives 404 NOT FOUND.(I am using STS 3.6.0 with Gradle plugin)

 

 

————————————————-

Answer

gradle,spring-boot

Facebook Comments

Post a comment