Spring Hibernate and gradle tomcat deploy issue












0















I am working on Spring application using Gradle.i can able run my Spring application without using gradle.But when building with Gradle,i am getting 404 issue.Below is log from Tomcat catalina and gradle build.



plugins {
id 'java'
id 'war'
}

sourceSets {
main {
java {
srcDir 'src'
}
}
}

webAppDirName = 'WebContent'


sourceCompatibility = 1.8
targetCompatibility = 1.8

project.ext.tomcatHome = 'H:/Tomcat'
project.ext.tomcatWebapps = "$tomcatHome/webapps"

repositories {
mavenCentral()
}

dependencies {
implementation 'org.apache.commons:commons-math3:3.6.1'
implementation 'org.springframework:spring-web:5.0.0.RELEASE'
implementation 'org.springframework:spring-webmvc:5.0.0.RELEASE'
implementation 'org.springframework:spring-context:5.0.0.RELEASE'
implementation 'org.springframework:spring-core:5.0.0.RELEASE'
implementation 'org.springframework:spring-beans:5.0.0.RELEASE'
implementation 'org.springframework:spring-aop:5.0.0.RELEASE'
implementation 'org.springframework:spring-jdbc:5.0.0.RELEASE'
implementation 'org.springframework:spring-orm:5.0.0.RELEASE'
implementation 'mysql:mysql-connector-java:8.0.13'
implementation 'javax.servlet:jstl:1.2'
implementation 'javax.servlet.jsp.jstl:jstl-api:1.2'
implementation 'org.hibernate:hibernate-core:5.2.17.Final'
implementation 'com.mchange:c3p0:0.9.5.2'
implementation 'org.hibernate:hibernate-c3p0:5.2.17.Final'

implementation "javax.servlet:javax.servlet-api:4.0.1"
testImplementation 'junit:junit:4.12'
}

war {
archiveName = 'customer.war'
}

task deployToTomcat(type: Copy) {
from war.archivePath
into "$tomcatWebapps"
}


Below is log from Tomcat




24-Nov-2018 09:11:27.905 INFO [main]
org.apache.catalina.core.StandardEngine.startInternal Starting Servlet
Engine: Apache Tomcat/9.0.13 24-Nov-2018 09:11:27.948 INFO [main]
org.apache.catalina.startup.HostConfig.deployWAR Deploying web
application archive [H:tomcatwebappscustomer.war] 24-Nov-2018
09:11:27.992 INFO [main] org.apache.catalina.startup.ExpandWar.expand
An expanded directory [H:tomcatwebappscustomer] was found with a
last modified time that did not match the associated WAR. It will be
deleted. 24-Nov-2018 09:11:30.823 INFO [main]
org.apache.jasper.servlet.TldScanner.scanJars 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. 24-Nov-2018 09:11:31.163 INFO
[main]
org.springframework.web.servlet.FrameworkServlet.initServletBean
FrameworkServlet 'dispatcher': initialization started 24-Nov-2018
09:11:31.201 INFO [main]
org.springframework.context.support.AbstractApplicationContext.prepareRefresh
Refreshing WebApplicationContext for namespace 'dispatcher-servlet':
startup date [Sat Nov 24 09:11:31 IST 2018]; root of context hierarchy
24-Nov-2018 09:11:31.277 INFO [main]
org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions
Loading XML bean definitions from ServletContext resource
[/WEB-INF/spring-mvc-crud-demo-servlet.xml] 24-Nov-2018 09:11:32.091
INFO [MLog-Init-Reporter] com.mchange.v2.log.MLog. MLog clients using
java 1.4+ standard logging. 24-Nov-2018 09:11:32.160 INFO [main]
com.mchange.v2.c3p0.C3P0Registry. Initializing c3p0-0.9.5.2 [built
08-December-2015 22:06:04 -0800; debug? true; trace: 10] 24-Nov-2018
09:11:32.702 INFO [main] org.hibernate.Version.logVersion HHH000412:
Hibernate Core {5.2.17.Final} 24-Nov-2018 09:11:32.704 INFO [main]
org.hibernate.cfg.Environment. HHH000206: hibernate.properties
not found 24-Nov-2018 09:11:32.763 INFO [main]
org.hibernate.annotations.common.reflection.java.JavaReflectionManager.
HCANN000001: Hibernate Commons Annotations {5.0.1.Final} 24-Nov-2018
09:11:32.912 INFO [main]
com.mchange.v2.c3p0.impl.AbstractPoolBackedDataSource. Initializing
c3p0 pool... com.mchange.v2.c3p0.ComboPooledDataSource [
acquireIncrement -> 3, acquireRetryAttempts -> 30, acquireRetryDelay
-> 1000, autoCommitOnClose -> false, automaticTestTable -> null, breakAfterAcquireFailure -> false, checkoutTimeout -> 0,
connectionCustomizerClassName -> null, connectionTesterClassName ->
com.mchange.v2.c3p0.impl.DefaultConnectionTester,
contextClassLoaderSource -> caller, dataSourceName ->
1hgekg19zitbf5fa5wwym|6d4c18b8, debugUnreturnedConnectionStackTraces
-> false, description -> null, driverClass -> com.mysql.cj.jdbc.Driver, extensions -> {}, factoryClassLocation ->
null, forceIgnoreUnresolvedTransactions -> false,
forceSynchronousCheckins -> false, forceUseNamedDriverClass -> false,
identityToken -> 1hgekg19zitbf5fa5wwym|6d4c18b8,
idleConnectionTestPeriod -> 0, initialPoolSize -> 5, jdbcUrl ->
jdbc:mysql://localhost:3306/web_customer_tracker?useSSL=false&serverTimezone=UTC,
maxAdministrativeTaskTime -> 0, maxConnectionAge -> 0, maxIdleTime ->
30000, maxIdleTimeExcessConnections -> 0, maxPoolSize -> 20,
maxStatements -> 0, maxStatementsPerConnection -> 0, minPoolSize -> 5,
numHelperThreads -> 3, preferredTestQuery -> null,
privilegeSpawnedThreads -> false, properties -> {user=******,
password=******}, propertyCycle -> 0,
statementCacheNumDeferredCloseThreads -> 0, testConnectionOnCheckin ->
false, testConnectionOnCheckout -> false, unreturnedConnectionTimeout
-> 0, userOverrides -> {}, usesTraditionalReflectiveProxies -> false ] 24-Nov-2018 09:11:33.181 INFO [main]
org.hibernate.dialect.Dialect. HHH000400: Using dialect:
org.hibernate.dialect.MySQLDialect 24-Nov-2018 09:11:34.239 INFO
[main]
org.springframework.web.servlet.handler.AbstractHandlerMethodMapping$MappingRegistry.register
Mapped "{[/customer/list]}" onto public java.lang.String
com.springdemo.controller.Customercontroller.listCustomers(org.springframework.ui.Model)
24-Nov-2018 09:11:34.913 INFO [main]
org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.initControllerAdviceCache
Looking for @ControllerAdvice: WebApplicationContext for namespace
'dispatcher-servlet': startup date [Sat Nov 24 09:11:31 IST 2018];
root of context hierarchy 24-Nov-2018 09:11:35.011 INFO [main]
org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.initControllerAdviceCache
Looking for @ControllerAdvice: WebApplicationContext for namespace
'dispatcher-servlet': startup date [Sat Nov 24 09:11:31 IST 2018];
root of context hierarchy 24-Nov-2018 09:11:35.122 INFO [main]
org.springframework.orm.hibernate5.HibernateTransactionManager.afterPropertiesSet
Using DataSource [com.mchange.v2.c3p0.ComboPooledDataSource[
identityToken -> 1hgekg19zitbf5fa5wwym|6d4c18b8, dataSourceName ->
1hgekg19zitbf5fa5wwym|6d4c18b8 ]] of Hibernate SessionFactory for
HibernateTransactionManager 24-Nov-2018 09:11:35.176 INFO [main]
org.springframework.web.servlet.handler.AbstractUrlHandlerMapping.registerHandler
Mapped URL path [/resources/**] onto handler
'org.springframework.web.servlet.resource.ResourceHttpRequestHandler#0'
24-Nov-2018 09:11:35.305 INFO [main]
org.springframework.web.servlet.FrameworkServlet.initServletBean
FrameworkServlet 'dispatcher': initialization completed in 4142 ms
24-Nov-2018 09:11:35.351 INFO [main]
org.apache.catalina.startup.HostConfig.deployWAR Deployment of web
application archive [H:tomcatwebappscustomer.war] has finished in
[7,400] ms 24-Nov-2018 09:11:35.352 INFO [main]
org.apache.catalina.startup.HostConfig.deployDirectory Deploying web
application directory [H:tomcatwebappsdocs] 24-Nov-2018
09:11:35.385 INFO [main]
org.apache.catalina.startup.HostConfig.deployDirectory Deployment of
web application directory [H:tomcatwebappsdocs] has finished in
[32] ms 24-Nov-2018 09:11:35.385 INFO [main]
org.apache.catalina.startup.HostConfig.deployDirectory Deploying web
application directory [H:tomcatwebappsexamples] 24-Nov-2018
09:11:37.858 INFO [main]
org.apache.catalina.startup.HostConfig.deployDirectory Deployment of
web application directory [H:tomcatwebappsexamples] has finished in
[2,473] ms 24-Nov-2018 09:11:37.858 INFO [main]
org.apache.catalina.startup.HostConfig.deployDirectory Deploying web
application directory [H:tomcatwebappshost-manager] 24-Nov-2018
09:11:37.917 INFO [main]
org.apache.catalina.startup.HostConfig.deployDirectory Deployment of
web application directory [H:tomcatwebappshost-manager] has
finished in [59] ms 24-Nov-2018 09:11:37.918 INFO [main]
org.apache.catalina.startup.HostConfig.deployDirectory Deploying web
application directory [H:tomcatwebappsmanager] 24-Nov-2018
09:11:37.977 INFO [main]
org.apache.catalina.startup.HostConfig.deployDirectory Deployment of
web application directory [H:tomcatwebappsmanager] has finished in
[59] ms 24-Nov-2018 09:11:37.977 INFO [main]
org.apache.catalina.startup.HostConfig.deployDirectory Deploying web
application directory [H:tomcatwebappsROOT] 24-Nov-2018
09:11:37.993 INFO [main]
org.apache.catalina.startup.HostConfig.deployDirectory Deployment of
web application directory [H:tomcatwebappsROOT] has finished in
[15] ms 24-Nov-2018 09:11:37.994 INFO [main]
org.apache.coyote.AbstractProtocol.start Starting ProtocolHandler
["http-nio-8081"] 24-Nov-2018 09:11:38.024 INFO [main]
org.apache.coyote.AbstractProtocol.start Starting ProtocolHandler
["ajp-nio-8009"] 24-Nov-2018 09:11:38.026 INFO [main]
org.apache.catalina.startup.Catalina.start Server startup in 10204 ms




Unable to find any errors in that log ,can someone let me know if there is anything missing in Gradle build or any errors ?










share|improve this question



























    0















    I am working on Spring application using Gradle.i can able run my Spring application without using gradle.But when building with Gradle,i am getting 404 issue.Below is log from Tomcat catalina and gradle build.



    plugins {
    id 'java'
    id 'war'
    }

    sourceSets {
    main {
    java {
    srcDir 'src'
    }
    }
    }

    webAppDirName = 'WebContent'


    sourceCompatibility = 1.8
    targetCompatibility = 1.8

    project.ext.tomcatHome = 'H:/Tomcat'
    project.ext.tomcatWebapps = "$tomcatHome/webapps"

    repositories {
    mavenCentral()
    }

    dependencies {
    implementation 'org.apache.commons:commons-math3:3.6.1'
    implementation 'org.springframework:spring-web:5.0.0.RELEASE'
    implementation 'org.springframework:spring-webmvc:5.0.0.RELEASE'
    implementation 'org.springframework:spring-context:5.0.0.RELEASE'
    implementation 'org.springframework:spring-core:5.0.0.RELEASE'
    implementation 'org.springframework:spring-beans:5.0.0.RELEASE'
    implementation 'org.springframework:spring-aop:5.0.0.RELEASE'
    implementation 'org.springframework:spring-jdbc:5.0.0.RELEASE'
    implementation 'org.springframework:spring-orm:5.0.0.RELEASE'
    implementation 'mysql:mysql-connector-java:8.0.13'
    implementation 'javax.servlet:jstl:1.2'
    implementation 'javax.servlet.jsp.jstl:jstl-api:1.2'
    implementation 'org.hibernate:hibernate-core:5.2.17.Final'
    implementation 'com.mchange:c3p0:0.9.5.2'
    implementation 'org.hibernate:hibernate-c3p0:5.2.17.Final'

    implementation "javax.servlet:javax.servlet-api:4.0.1"
    testImplementation 'junit:junit:4.12'
    }

    war {
    archiveName = 'customer.war'
    }

    task deployToTomcat(type: Copy) {
    from war.archivePath
    into "$tomcatWebapps"
    }


    Below is log from Tomcat




    24-Nov-2018 09:11:27.905 INFO [main]
    org.apache.catalina.core.StandardEngine.startInternal Starting Servlet
    Engine: Apache Tomcat/9.0.13 24-Nov-2018 09:11:27.948 INFO [main]
    org.apache.catalina.startup.HostConfig.deployWAR Deploying web
    application archive [H:tomcatwebappscustomer.war] 24-Nov-2018
    09:11:27.992 INFO [main] org.apache.catalina.startup.ExpandWar.expand
    An expanded directory [H:tomcatwebappscustomer] was found with a
    last modified time that did not match the associated WAR. It will be
    deleted. 24-Nov-2018 09:11:30.823 INFO [main]
    org.apache.jasper.servlet.TldScanner.scanJars 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. 24-Nov-2018 09:11:31.163 INFO
    [main]
    org.springframework.web.servlet.FrameworkServlet.initServletBean
    FrameworkServlet 'dispatcher': initialization started 24-Nov-2018
    09:11:31.201 INFO [main]
    org.springframework.context.support.AbstractApplicationContext.prepareRefresh
    Refreshing WebApplicationContext for namespace 'dispatcher-servlet':
    startup date [Sat Nov 24 09:11:31 IST 2018]; root of context hierarchy
    24-Nov-2018 09:11:31.277 INFO [main]
    org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions
    Loading XML bean definitions from ServletContext resource
    [/WEB-INF/spring-mvc-crud-demo-servlet.xml] 24-Nov-2018 09:11:32.091
    INFO [MLog-Init-Reporter] com.mchange.v2.log.MLog. MLog clients using
    java 1.4+ standard logging. 24-Nov-2018 09:11:32.160 INFO [main]
    com.mchange.v2.c3p0.C3P0Registry. Initializing c3p0-0.9.5.2 [built
    08-December-2015 22:06:04 -0800; debug? true; trace: 10] 24-Nov-2018
    09:11:32.702 INFO [main] org.hibernate.Version.logVersion HHH000412:
    Hibernate Core {5.2.17.Final} 24-Nov-2018 09:11:32.704 INFO [main]
    org.hibernate.cfg.Environment. HHH000206: hibernate.properties
    not found 24-Nov-2018 09:11:32.763 INFO [main]
    org.hibernate.annotations.common.reflection.java.JavaReflectionManager.
    HCANN000001: Hibernate Commons Annotations {5.0.1.Final} 24-Nov-2018
    09:11:32.912 INFO [main]
    com.mchange.v2.c3p0.impl.AbstractPoolBackedDataSource. Initializing
    c3p0 pool... com.mchange.v2.c3p0.ComboPooledDataSource [
    acquireIncrement -> 3, acquireRetryAttempts -> 30, acquireRetryDelay
    -> 1000, autoCommitOnClose -> false, automaticTestTable -> null, breakAfterAcquireFailure -> false, checkoutTimeout -> 0,
    connectionCustomizerClassName -> null, connectionTesterClassName ->
    com.mchange.v2.c3p0.impl.DefaultConnectionTester,
    contextClassLoaderSource -> caller, dataSourceName ->
    1hgekg19zitbf5fa5wwym|6d4c18b8, debugUnreturnedConnectionStackTraces
    -> false, description -> null, driverClass -> com.mysql.cj.jdbc.Driver, extensions -> {}, factoryClassLocation ->
    null, forceIgnoreUnresolvedTransactions -> false,
    forceSynchronousCheckins -> false, forceUseNamedDriverClass -> false,
    identityToken -> 1hgekg19zitbf5fa5wwym|6d4c18b8,
    idleConnectionTestPeriod -> 0, initialPoolSize -> 5, jdbcUrl ->
    jdbc:mysql://localhost:3306/web_customer_tracker?useSSL=false&serverTimezone=UTC,
    maxAdministrativeTaskTime -> 0, maxConnectionAge -> 0, maxIdleTime ->
    30000, maxIdleTimeExcessConnections -> 0, maxPoolSize -> 20,
    maxStatements -> 0, maxStatementsPerConnection -> 0, minPoolSize -> 5,
    numHelperThreads -> 3, preferredTestQuery -> null,
    privilegeSpawnedThreads -> false, properties -> {user=******,
    password=******}, propertyCycle -> 0,
    statementCacheNumDeferredCloseThreads -> 0, testConnectionOnCheckin ->
    false, testConnectionOnCheckout -> false, unreturnedConnectionTimeout
    -> 0, userOverrides -> {}, usesTraditionalReflectiveProxies -> false ] 24-Nov-2018 09:11:33.181 INFO [main]
    org.hibernate.dialect.Dialect. HHH000400: Using dialect:
    org.hibernate.dialect.MySQLDialect 24-Nov-2018 09:11:34.239 INFO
    [main]
    org.springframework.web.servlet.handler.AbstractHandlerMethodMapping$MappingRegistry.register
    Mapped "{[/customer/list]}" onto public java.lang.String
    com.springdemo.controller.Customercontroller.listCustomers(org.springframework.ui.Model)
    24-Nov-2018 09:11:34.913 INFO [main]
    org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.initControllerAdviceCache
    Looking for @ControllerAdvice: WebApplicationContext for namespace
    'dispatcher-servlet': startup date [Sat Nov 24 09:11:31 IST 2018];
    root of context hierarchy 24-Nov-2018 09:11:35.011 INFO [main]
    org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.initControllerAdviceCache
    Looking for @ControllerAdvice: WebApplicationContext for namespace
    'dispatcher-servlet': startup date [Sat Nov 24 09:11:31 IST 2018];
    root of context hierarchy 24-Nov-2018 09:11:35.122 INFO [main]
    org.springframework.orm.hibernate5.HibernateTransactionManager.afterPropertiesSet
    Using DataSource [com.mchange.v2.c3p0.ComboPooledDataSource[
    identityToken -> 1hgekg19zitbf5fa5wwym|6d4c18b8, dataSourceName ->
    1hgekg19zitbf5fa5wwym|6d4c18b8 ]] of Hibernate SessionFactory for
    HibernateTransactionManager 24-Nov-2018 09:11:35.176 INFO [main]
    org.springframework.web.servlet.handler.AbstractUrlHandlerMapping.registerHandler
    Mapped URL path [/resources/**] onto handler
    'org.springframework.web.servlet.resource.ResourceHttpRequestHandler#0'
    24-Nov-2018 09:11:35.305 INFO [main]
    org.springframework.web.servlet.FrameworkServlet.initServletBean
    FrameworkServlet 'dispatcher': initialization completed in 4142 ms
    24-Nov-2018 09:11:35.351 INFO [main]
    org.apache.catalina.startup.HostConfig.deployWAR Deployment of web
    application archive [H:tomcatwebappscustomer.war] has finished in
    [7,400] ms 24-Nov-2018 09:11:35.352 INFO [main]
    org.apache.catalina.startup.HostConfig.deployDirectory Deploying web
    application directory [H:tomcatwebappsdocs] 24-Nov-2018
    09:11:35.385 INFO [main]
    org.apache.catalina.startup.HostConfig.deployDirectory Deployment of
    web application directory [H:tomcatwebappsdocs] has finished in
    [32] ms 24-Nov-2018 09:11:35.385 INFO [main]
    org.apache.catalina.startup.HostConfig.deployDirectory Deploying web
    application directory [H:tomcatwebappsexamples] 24-Nov-2018
    09:11:37.858 INFO [main]
    org.apache.catalina.startup.HostConfig.deployDirectory Deployment of
    web application directory [H:tomcatwebappsexamples] has finished in
    [2,473] ms 24-Nov-2018 09:11:37.858 INFO [main]
    org.apache.catalina.startup.HostConfig.deployDirectory Deploying web
    application directory [H:tomcatwebappshost-manager] 24-Nov-2018
    09:11:37.917 INFO [main]
    org.apache.catalina.startup.HostConfig.deployDirectory Deployment of
    web application directory [H:tomcatwebappshost-manager] has
    finished in [59] ms 24-Nov-2018 09:11:37.918 INFO [main]
    org.apache.catalina.startup.HostConfig.deployDirectory Deploying web
    application directory [H:tomcatwebappsmanager] 24-Nov-2018
    09:11:37.977 INFO [main]
    org.apache.catalina.startup.HostConfig.deployDirectory Deployment of
    web application directory [H:tomcatwebappsmanager] has finished in
    [59] ms 24-Nov-2018 09:11:37.977 INFO [main]
    org.apache.catalina.startup.HostConfig.deployDirectory Deploying web
    application directory [H:tomcatwebappsROOT] 24-Nov-2018
    09:11:37.993 INFO [main]
    org.apache.catalina.startup.HostConfig.deployDirectory Deployment of
    web application directory [H:tomcatwebappsROOT] has finished in
    [15] ms 24-Nov-2018 09:11:37.994 INFO [main]
    org.apache.coyote.AbstractProtocol.start Starting ProtocolHandler
    ["http-nio-8081"] 24-Nov-2018 09:11:38.024 INFO [main]
    org.apache.coyote.AbstractProtocol.start Starting ProtocolHandler
    ["ajp-nio-8009"] 24-Nov-2018 09:11:38.026 INFO [main]
    org.apache.catalina.startup.Catalina.start Server startup in 10204 ms




    Unable to find any errors in that log ,can someone let me know if there is anything missing in Gradle build or any errors ?










    share|improve this question

























      0












      0








      0








      I am working on Spring application using Gradle.i can able run my Spring application without using gradle.But when building with Gradle,i am getting 404 issue.Below is log from Tomcat catalina and gradle build.



      plugins {
      id 'java'
      id 'war'
      }

      sourceSets {
      main {
      java {
      srcDir 'src'
      }
      }
      }

      webAppDirName = 'WebContent'


      sourceCompatibility = 1.8
      targetCompatibility = 1.8

      project.ext.tomcatHome = 'H:/Tomcat'
      project.ext.tomcatWebapps = "$tomcatHome/webapps"

      repositories {
      mavenCentral()
      }

      dependencies {
      implementation 'org.apache.commons:commons-math3:3.6.1'
      implementation 'org.springframework:spring-web:5.0.0.RELEASE'
      implementation 'org.springframework:spring-webmvc:5.0.0.RELEASE'
      implementation 'org.springframework:spring-context:5.0.0.RELEASE'
      implementation 'org.springframework:spring-core:5.0.0.RELEASE'
      implementation 'org.springframework:spring-beans:5.0.0.RELEASE'
      implementation 'org.springframework:spring-aop:5.0.0.RELEASE'
      implementation 'org.springframework:spring-jdbc:5.0.0.RELEASE'
      implementation 'org.springframework:spring-orm:5.0.0.RELEASE'
      implementation 'mysql:mysql-connector-java:8.0.13'
      implementation 'javax.servlet:jstl:1.2'
      implementation 'javax.servlet.jsp.jstl:jstl-api:1.2'
      implementation 'org.hibernate:hibernate-core:5.2.17.Final'
      implementation 'com.mchange:c3p0:0.9.5.2'
      implementation 'org.hibernate:hibernate-c3p0:5.2.17.Final'

      implementation "javax.servlet:javax.servlet-api:4.0.1"
      testImplementation 'junit:junit:4.12'
      }

      war {
      archiveName = 'customer.war'
      }

      task deployToTomcat(type: Copy) {
      from war.archivePath
      into "$tomcatWebapps"
      }


      Below is log from Tomcat




      24-Nov-2018 09:11:27.905 INFO [main]
      org.apache.catalina.core.StandardEngine.startInternal Starting Servlet
      Engine: Apache Tomcat/9.0.13 24-Nov-2018 09:11:27.948 INFO [main]
      org.apache.catalina.startup.HostConfig.deployWAR Deploying web
      application archive [H:tomcatwebappscustomer.war] 24-Nov-2018
      09:11:27.992 INFO [main] org.apache.catalina.startup.ExpandWar.expand
      An expanded directory [H:tomcatwebappscustomer] was found with a
      last modified time that did not match the associated WAR. It will be
      deleted. 24-Nov-2018 09:11:30.823 INFO [main]
      org.apache.jasper.servlet.TldScanner.scanJars 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. 24-Nov-2018 09:11:31.163 INFO
      [main]
      org.springframework.web.servlet.FrameworkServlet.initServletBean
      FrameworkServlet 'dispatcher': initialization started 24-Nov-2018
      09:11:31.201 INFO [main]
      org.springframework.context.support.AbstractApplicationContext.prepareRefresh
      Refreshing WebApplicationContext for namespace 'dispatcher-servlet':
      startup date [Sat Nov 24 09:11:31 IST 2018]; root of context hierarchy
      24-Nov-2018 09:11:31.277 INFO [main]
      org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions
      Loading XML bean definitions from ServletContext resource
      [/WEB-INF/spring-mvc-crud-demo-servlet.xml] 24-Nov-2018 09:11:32.091
      INFO [MLog-Init-Reporter] com.mchange.v2.log.MLog. MLog clients using
      java 1.4+ standard logging. 24-Nov-2018 09:11:32.160 INFO [main]
      com.mchange.v2.c3p0.C3P0Registry. Initializing c3p0-0.9.5.2 [built
      08-December-2015 22:06:04 -0800; debug? true; trace: 10] 24-Nov-2018
      09:11:32.702 INFO [main] org.hibernate.Version.logVersion HHH000412:
      Hibernate Core {5.2.17.Final} 24-Nov-2018 09:11:32.704 INFO [main]
      org.hibernate.cfg.Environment. HHH000206: hibernate.properties
      not found 24-Nov-2018 09:11:32.763 INFO [main]
      org.hibernate.annotations.common.reflection.java.JavaReflectionManager.
      HCANN000001: Hibernate Commons Annotations {5.0.1.Final} 24-Nov-2018
      09:11:32.912 INFO [main]
      com.mchange.v2.c3p0.impl.AbstractPoolBackedDataSource. Initializing
      c3p0 pool... com.mchange.v2.c3p0.ComboPooledDataSource [
      acquireIncrement -> 3, acquireRetryAttempts -> 30, acquireRetryDelay
      -> 1000, autoCommitOnClose -> false, automaticTestTable -> null, breakAfterAcquireFailure -> false, checkoutTimeout -> 0,
      connectionCustomizerClassName -> null, connectionTesterClassName ->
      com.mchange.v2.c3p0.impl.DefaultConnectionTester,
      contextClassLoaderSource -> caller, dataSourceName ->
      1hgekg19zitbf5fa5wwym|6d4c18b8, debugUnreturnedConnectionStackTraces
      -> false, description -> null, driverClass -> com.mysql.cj.jdbc.Driver, extensions -> {}, factoryClassLocation ->
      null, forceIgnoreUnresolvedTransactions -> false,
      forceSynchronousCheckins -> false, forceUseNamedDriverClass -> false,
      identityToken -> 1hgekg19zitbf5fa5wwym|6d4c18b8,
      idleConnectionTestPeriod -> 0, initialPoolSize -> 5, jdbcUrl ->
      jdbc:mysql://localhost:3306/web_customer_tracker?useSSL=false&serverTimezone=UTC,
      maxAdministrativeTaskTime -> 0, maxConnectionAge -> 0, maxIdleTime ->
      30000, maxIdleTimeExcessConnections -> 0, maxPoolSize -> 20,
      maxStatements -> 0, maxStatementsPerConnection -> 0, minPoolSize -> 5,
      numHelperThreads -> 3, preferredTestQuery -> null,
      privilegeSpawnedThreads -> false, properties -> {user=******,
      password=******}, propertyCycle -> 0,
      statementCacheNumDeferredCloseThreads -> 0, testConnectionOnCheckin ->
      false, testConnectionOnCheckout -> false, unreturnedConnectionTimeout
      -> 0, userOverrides -> {}, usesTraditionalReflectiveProxies -> false ] 24-Nov-2018 09:11:33.181 INFO [main]
      org.hibernate.dialect.Dialect. HHH000400: Using dialect:
      org.hibernate.dialect.MySQLDialect 24-Nov-2018 09:11:34.239 INFO
      [main]
      org.springframework.web.servlet.handler.AbstractHandlerMethodMapping$MappingRegistry.register
      Mapped "{[/customer/list]}" onto public java.lang.String
      com.springdemo.controller.Customercontroller.listCustomers(org.springframework.ui.Model)
      24-Nov-2018 09:11:34.913 INFO [main]
      org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.initControllerAdviceCache
      Looking for @ControllerAdvice: WebApplicationContext for namespace
      'dispatcher-servlet': startup date [Sat Nov 24 09:11:31 IST 2018];
      root of context hierarchy 24-Nov-2018 09:11:35.011 INFO [main]
      org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.initControllerAdviceCache
      Looking for @ControllerAdvice: WebApplicationContext for namespace
      'dispatcher-servlet': startup date [Sat Nov 24 09:11:31 IST 2018];
      root of context hierarchy 24-Nov-2018 09:11:35.122 INFO [main]
      org.springframework.orm.hibernate5.HibernateTransactionManager.afterPropertiesSet
      Using DataSource [com.mchange.v2.c3p0.ComboPooledDataSource[
      identityToken -> 1hgekg19zitbf5fa5wwym|6d4c18b8, dataSourceName ->
      1hgekg19zitbf5fa5wwym|6d4c18b8 ]] of Hibernate SessionFactory for
      HibernateTransactionManager 24-Nov-2018 09:11:35.176 INFO [main]
      org.springframework.web.servlet.handler.AbstractUrlHandlerMapping.registerHandler
      Mapped URL path [/resources/**] onto handler
      'org.springframework.web.servlet.resource.ResourceHttpRequestHandler#0'
      24-Nov-2018 09:11:35.305 INFO [main]
      org.springframework.web.servlet.FrameworkServlet.initServletBean
      FrameworkServlet 'dispatcher': initialization completed in 4142 ms
      24-Nov-2018 09:11:35.351 INFO [main]
      org.apache.catalina.startup.HostConfig.deployWAR Deployment of web
      application archive [H:tomcatwebappscustomer.war] has finished in
      [7,400] ms 24-Nov-2018 09:11:35.352 INFO [main]
      org.apache.catalina.startup.HostConfig.deployDirectory Deploying web
      application directory [H:tomcatwebappsdocs] 24-Nov-2018
      09:11:35.385 INFO [main]
      org.apache.catalina.startup.HostConfig.deployDirectory Deployment of
      web application directory [H:tomcatwebappsdocs] has finished in
      [32] ms 24-Nov-2018 09:11:35.385 INFO [main]
      org.apache.catalina.startup.HostConfig.deployDirectory Deploying web
      application directory [H:tomcatwebappsexamples] 24-Nov-2018
      09:11:37.858 INFO [main]
      org.apache.catalina.startup.HostConfig.deployDirectory Deployment of
      web application directory [H:tomcatwebappsexamples] has finished in
      [2,473] ms 24-Nov-2018 09:11:37.858 INFO [main]
      org.apache.catalina.startup.HostConfig.deployDirectory Deploying web
      application directory [H:tomcatwebappshost-manager] 24-Nov-2018
      09:11:37.917 INFO [main]
      org.apache.catalina.startup.HostConfig.deployDirectory Deployment of
      web application directory [H:tomcatwebappshost-manager] has
      finished in [59] ms 24-Nov-2018 09:11:37.918 INFO [main]
      org.apache.catalina.startup.HostConfig.deployDirectory Deploying web
      application directory [H:tomcatwebappsmanager] 24-Nov-2018
      09:11:37.977 INFO [main]
      org.apache.catalina.startup.HostConfig.deployDirectory Deployment of
      web application directory [H:tomcatwebappsmanager] has finished in
      [59] ms 24-Nov-2018 09:11:37.977 INFO [main]
      org.apache.catalina.startup.HostConfig.deployDirectory Deploying web
      application directory [H:tomcatwebappsROOT] 24-Nov-2018
      09:11:37.993 INFO [main]
      org.apache.catalina.startup.HostConfig.deployDirectory Deployment of
      web application directory [H:tomcatwebappsROOT] has finished in
      [15] ms 24-Nov-2018 09:11:37.994 INFO [main]
      org.apache.coyote.AbstractProtocol.start Starting ProtocolHandler
      ["http-nio-8081"] 24-Nov-2018 09:11:38.024 INFO [main]
      org.apache.coyote.AbstractProtocol.start Starting ProtocolHandler
      ["ajp-nio-8009"] 24-Nov-2018 09:11:38.026 INFO [main]
      org.apache.catalina.startup.Catalina.start Server startup in 10204 ms




      Unable to find any errors in that log ,can someone let me know if there is anything missing in Gradle build or any errors ?










      share|improve this question














      I am working on Spring application using Gradle.i can able run my Spring application without using gradle.But when building with Gradle,i am getting 404 issue.Below is log from Tomcat catalina and gradle build.



      plugins {
      id 'java'
      id 'war'
      }

      sourceSets {
      main {
      java {
      srcDir 'src'
      }
      }
      }

      webAppDirName = 'WebContent'


      sourceCompatibility = 1.8
      targetCompatibility = 1.8

      project.ext.tomcatHome = 'H:/Tomcat'
      project.ext.tomcatWebapps = "$tomcatHome/webapps"

      repositories {
      mavenCentral()
      }

      dependencies {
      implementation 'org.apache.commons:commons-math3:3.6.1'
      implementation 'org.springframework:spring-web:5.0.0.RELEASE'
      implementation 'org.springframework:spring-webmvc:5.0.0.RELEASE'
      implementation 'org.springframework:spring-context:5.0.0.RELEASE'
      implementation 'org.springframework:spring-core:5.0.0.RELEASE'
      implementation 'org.springframework:spring-beans:5.0.0.RELEASE'
      implementation 'org.springframework:spring-aop:5.0.0.RELEASE'
      implementation 'org.springframework:spring-jdbc:5.0.0.RELEASE'
      implementation 'org.springframework:spring-orm:5.0.0.RELEASE'
      implementation 'mysql:mysql-connector-java:8.0.13'
      implementation 'javax.servlet:jstl:1.2'
      implementation 'javax.servlet.jsp.jstl:jstl-api:1.2'
      implementation 'org.hibernate:hibernate-core:5.2.17.Final'
      implementation 'com.mchange:c3p0:0.9.5.2'
      implementation 'org.hibernate:hibernate-c3p0:5.2.17.Final'

      implementation "javax.servlet:javax.servlet-api:4.0.1"
      testImplementation 'junit:junit:4.12'
      }

      war {
      archiveName = 'customer.war'
      }

      task deployToTomcat(type: Copy) {
      from war.archivePath
      into "$tomcatWebapps"
      }


      Below is log from Tomcat




      24-Nov-2018 09:11:27.905 INFO [main]
      org.apache.catalina.core.StandardEngine.startInternal Starting Servlet
      Engine: Apache Tomcat/9.0.13 24-Nov-2018 09:11:27.948 INFO [main]
      org.apache.catalina.startup.HostConfig.deployWAR Deploying web
      application archive [H:tomcatwebappscustomer.war] 24-Nov-2018
      09:11:27.992 INFO [main] org.apache.catalina.startup.ExpandWar.expand
      An expanded directory [H:tomcatwebappscustomer] was found with a
      last modified time that did not match the associated WAR. It will be
      deleted. 24-Nov-2018 09:11:30.823 INFO [main]
      org.apache.jasper.servlet.TldScanner.scanJars 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. 24-Nov-2018 09:11:31.163 INFO
      [main]
      org.springframework.web.servlet.FrameworkServlet.initServletBean
      FrameworkServlet 'dispatcher': initialization started 24-Nov-2018
      09:11:31.201 INFO [main]
      org.springframework.context.support.AbstractApplicationContext.prepareRefresh
      Refreshing WebApplicationContext for namespace 'dispatcher-servlet':
      startup date [Sat Nov 24 09:11:31 IST 2018]; root of context hierarchy
      24-Nov-2018 09:11:31.277 INFO [main]
      org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions
      Loading XML bean definitions from ServletContext resource
      [/WEB-INF/spring-mvc-crud-demo-servlet.xml] 24-Nov-2018 09:11:32.091
      INFO [MLog-Init-Reporter] com.mchange.v2.log.MLog. MLog clients using
      java 1.4+ standard logging. 24-Nov-2018 09:11:32.160 INFO [main]
      com.mchange.v2.c3p0.C3P0Registry. Initializing c3p0-0.9.5.2 [built
      08-December-2015 22:06:04 -0800; debug? true; trace: 10] 24-Nov-2018
      09:11:32.702 INFO [main] org.hibernate.Version.logVersion HHH000412:
      Hibernate Core {5.2.17.Final} 24-Nov-2018 09:11:32.704 INFO [main]
      org.hibernate.cfg.Environment. HHH000206: hibernate.properties
      not found 24-Nov-2018 09:11:32.763 INFO [main]
      org.hibernate.annotations.common.reflection.java.JavaReflectionManager.
      HCANN000001: Hibernate Commons Annotations {5.0.1.Final} 24-Nov-2018
      09:11:32.912 INFO [main]
      com.mchange.v2.c3p0.impl.AbstractPoolBackedDataSource. Initializing
      c3p0 pool... com.mchange.v2.c3p0.ComboPooledDataSource [
      acquireIncrement -> 3, acquireRetryAttempts -> 30, acquireRetryDelay
      -> 1000, autoCommitOnClose -> false, automaticTestTable -> null, breakAfterAcquireFailure -> false, checkoutTimeout -> 0,
      connectionCustomizerClassName -> null, connectionTesterClassName ->
      com.mchange.v2.c3p0.impl.DefaultConnectionTester,
      contextClassLoaderSource -> caller, dataSourceName ->
      1hgekg19zitbf5fa5wwym|6d4c18b8, debugUnreturnedConnectionStackTraces
      -> false, description -> null, driverClass -> com.mysql.cj.jdbc.Driver, extensions -> {}, factoryClassLocation ->
      null, forceIgnoreUnresolvedTransactions -> false,
      forceSynchronousCheckins -> false, forceUseNamedDriverClass -> false,
      identityToken -> 1hgekg19zitbf5fa5wwym|6d4c18b8,
      idleConnectionTestPeriod -> 0, initialPoolSize -> 5, jdbcUrl ->
      jdbc:mysql://localhost:3306/web_customer_tracker?useSSL=false&serverTimezone=UTC,
      maxAdministrativeTaskTime -> 0, maxConnectionAge -> 0, maxIdleTime ->
      30000, maxIdleTimeExcessConnections -> 0, maxPoolSize -> 20,
      maxStatements -> 0, maxStatementsPerConnection -> 0, minPoolSize -> 5,
      numHelperThreads -> 3, preferredTestQuery -> null,
      privilegeSpawnedThreads -> false, properties -> {user=******,
      password=******}, propertyCycle -> 0,
      statementCacheNumDeferredCloseThreads -> 0, testConnectionOnCheckin ->
      false, testConnectionOnCheckout -> false, unreturnedConnectionTimeout
      -> 0, userOverrides -> {}, usesTraditionalReflectiveProxies -> false ] 24-Nov-2018 09:11:33.181 INFO [main]
      org.hibernate.dialect.Dialect. HHH000400: Using dialect:
      org.hibernate.dialect.MySQLDialect 24-Nov-2018 09:11:34.239 INFO
      [main]
      org.springframework.web.servlet.handler.AbstractHandlerMethodMapping$MappingRegistry.register
      Mapped "{[/customer/list]}" onto public java.lang.String
      com.springdemo.controller.Customercontroller.listCustomers(org.springframework.ui.Model)
      24-Nov-2018 09:11:34.913 INFO [main]
      org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.initControllerAdviceCache
      Looking for @ControllerAdvice: WebApplicationContext for namespace
      'dispatcher-servlet': startup date [Sat Nov 24 09:11:31 IST 2018];
      root of context hierarchy 24-Nov-2018 09:11:35.011 INFO [main]
      org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.initControllerAdviceCache
      Looking for @ControllerAdvice: WebApplicationContext for namespace
      'dispatcher-servlet': startup date [Sat Nov 24 09:11:31 IST 2018];
      root of context hierarchy 24-Nov-2018 09:11:35.122 INFO [main]
      org.springframework.orm.hibernate5.HibernateTransactionManager.afterPropertiesSet
      Using DataSource [com.mchange.v2.c3p0.ComboPooledDataSource[
      identityToken -> 1hgekg19zitbf5fa5wwym|6d4c18b8, dataSourceName ->
      1hgekg19zitbf5fa5wwym|6d4c18b8 ]] of Hibernate SessionFactory for
      HibernateTransactionManager 24-Nov-2018 09:11:35.176 INFO [main]
      org.springframework.web.servlet.handler.AbstractUrlHandlerMapping.registerHandler
      Mapped URL path [/resources/**] onto handler
      'org.springframework.web.servlet.resource.ResourceHttpRequestHandler#0'
      24-Nov-2018 09:11:35.305 INFO [main]
      org.springframework.web.servlet.FrameworkServlet.initServletBean
      FrameworkServlet 'dispatcher': initialization completed in 4142 ms
      24-Nov-2018 09:11:35.351 INFO [main]
      org.apache.catalina.startup.HostConfig.deployWAR Deployment of web
      application archive [H:tomcatwebappscustomer.war] has finished in
      [7,400] ms 24-Nov-2018 09:11:35.352 INFO [main]
      org.apache.catalina.startup.HostConfig.deployDirectory Deploying web
      application directory [H:tomcatwebappsdocs] 24-Nov-2018
      09:11:35.385 INFO [main]
      org.apache.catalina.startup.HostConfig.deployDirectory Deployment of
      web application directory [H:tomcatwebappsdocs] has finished in
      [32] ms 24-Nov-2018 09:11:35.385 INFO [main]
      org.apache.catalina.startup.HostConfig.deployDirectory Deploying web
      application directory [H:tomcatwebappsexamples] 24-Nov-2018
      09:11:37.858 INFO [main]
      org.apache.catalina.startup.HostConfig.deployDirectory Deployment of
      web application directory [H:tomcatwebappsexamples] has finished in
      [2,473] ms 24-Nov-2018 09:11:37.858 INFO [main]
      org.apache.catalina.startup.HostConfig.deployDirectory Deploying web
      application directory [H:tomcatwebappshost-manager] 24-Nov-2018
      09:11:37.917 INFO [main]
      org.apache.catalina.startup.HostConfig.deployDirectory Deployment of
      web application directory [H:tomcatwebappshost-manager] has
      finished in [59] ms 24-Nov-2018 09:11:37.918 INFO [main]
      org.apache.catalina.startup.HostConfig.deployDirectory Deploying web
      application directory [H:tomcatwebappsmanager] 24-Nov-2018
      09:11:37.977 INFO [main]
      org.apache.catalina.startup.HostConfig.deployDirectory Deployment of
      web application directory [H:tomcatwebappsmanager] has finished in
      [59] ms 24-Nov-2018 09:11:37.977 INFO [main]
      org.apache.catalina.startup.HostConfig.deployDirectory Deploying web
      application directory [H:tomcatwebappsROOT] 24-Nov-2018
      09:11:37.993 INFO [main]
      org.apache.catalina.startup.HostConfig.deployDirectory Deployment of
      web application directory [H:tomcatwebappsROOT] has finished in
      [15] ms 24-Nov-2018 09:11:37.994 INFO [main]
      org.apache.coyote.AbstractProtocol.start Starting ProtocolHandler
      ["http-nio-8081"] 24-Nov-2018 09:11:38.024 INFO [main]
      org.apache.coyote.AbstractProtocol.start Starting ProtocolHandler
      ["ajp-nio-8009"] 24-Nov-2018 09:11:38.026 INFO [main]
      org.apache.catalina.startup.Catalina.start Server startup in 10204 ms




      Unable to find any errors in that log ,can someone let me know if there is anything missing in Gradle build or any errors ?







      spring hibernate tomcat gradle






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Nov 24 '18 at 4:38









      samsam

      265




      265
























          0






          active

          oldest

          votes











          Your Answer






          StackExchange.ifUsing("editor", function () {
          StackExchange.using("externalEditor", function () {
          StackExchange.using("snippets", function () {
          StackExchange.snippets.init();
          });
          });
          }, "code-snippets");

          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "1"
          };
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function() {
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled) {
          StackExchange.using("snippets", function() {
          createEditor();
          });
          }
          else {
          createEditor();
          }
          });

          function createEditor() {
          StackExchange.prepareEditor({
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader: {
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          },
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          });


          }
          });














          draft saved

          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53455180%2fspring-hibernate-and-gradle-tomcat-deploy-issue%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          0






          active

          oldest

          votes








          0






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes
















          draft saved

          draft discarded




















































          Thanks for contributing an answer to Stack Overflow!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53455180%2fspring-hibernate-and-gradle-tomcat-deploy-issue%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          Costa Masnaga

          Fotorealismo

          Sidney Franklin