Damien
Damien

Reputation: 4121

Spring Boot Shutting Down After Adding JPA

I have a spring boot 1.5.2.RELEASE project that was very simple and just had a few Rest Services. When I added spring-boot-starter-data-jpa - all of a sudden the server just wont stay active I have added these logs for example (note - i have commented out the configuration of the datasource and this still happens - tomcat shutsdown after starting up)

2017-04-01 12:10:25 <> DEBUG logging:19 - Logging Provider: org.jboss.logging.Log4jLoggerProvider
2017-04-01 12:10:25 <> INFO  Version:30 - HV000001: Hibernate Validator 5.3.4.Final
2017-04-01 12:10:25 <> DEBUG DefaultTraversableResolver:103 - Found javax.persistence.Persistence on classpath containing 'getPersistenceUtil'. Assuming JPA 2 environment. Trying to instantiate JPA aware TraversableResolver
2017-04-01 12:10:25 <> DEBUG DefaultTraversableResolver:114 - Instantiated JPA aware TraversableResolver of type org.hibernate.validator.internal.engine.resolver.JPATraversableResolver.
2017-04-01 12:10:26 <> DEBUG DefaultTraversableResolver:103 - Found javax.persistence.Persistence on classpath containing 'getPersistenceUtil'. Assuming JPA 2 environment. Trying to instantiate JPA aware TraversableResolver
2017-04-01 12:10:26 <> DEBUG DefaultTraversableResolver:114 - Instantiated JPA aware TraversableResolver of type org.hibernate.validator.internal.engine.resolver.JPATraversableResolver.
2017-04-01 12:10:26 <> DEBUG DefaultTraversableResolver:103 - Found javax.persistence.Persistence on classpath containing 'getPersistenceUtil'. Assuming JPA 2 environment. Trying to instantiate JPA aware TraversableResolver
2017-04-01 12:10:26 <> DEBUG DefaultTraversableResolver:114 - Instantiated JPA aware TraversableResolver of type org.hibernate.validator.internal.engine.resolver.JPATraversableResolver.
2017-04-01 12:10:26 <> DEBUG ConfigurationImpl:163 - Setting custom MessageInterpolator of type org.springframework.validation.beanvalidation.LocaleContextMessageInterpolator
2017-04-01 12:10:26 <> DEBUG ConfigurationImpl:185 - Setting custom ConstraintValidatorFactory of type org.springframework.validation.beanvalidation.SpringConstraintValidatorFactory
2017-04-01 12:10:26 <> DEBUG ConfigurationImpl:199 - Setting custom ParameterNameProvider of type com.sun.proxy.$Proxy44
2017-04-01 12:10:26 <> DEBUG ValidationXmlParser:91 - Trying to load META-INF/validation.xml for XML based Validator configuration.
2017-04-01 12:10:26 <> DEBUG ResourceLoaderHelper:47 - Trying to load META-INF/validation.xml via user class loader
2017-04-01 12:10:26 <> DEBUG ResourceLoaderHelper:54 - Trying to load META-INF/validation.xml via TCCL
2017-04-01 12:10:26 <> DEBUG ResourceLoaderHelper:60 - Trying to load META-INF/validation.xml via Hibernate Validator's class loader
2017-04-01 12:10:26 <> DEBUG ValidationXmlParser:98 - No META-INF/validation.xml found. Using annotation based configuration only.
2017-04-01 12:10:26 <> DEBUG DefaultTraversableResolver:103 - Found javax.persistence.Persistence on classpath containing 'getPersistenceUtil'. Assuming JPA 2 environment. Trying to instantiate JPA aware TraversableResolver
2017-04-01 12:10:26 <> DEBUG DefaultTraversableResolver:114 - Instantiated JPA aware TraversableResolver of type org.hibernate.validator.internal.engine.resolver.JPATraversableResolver.
2017-04-01 12:10:26 <> DEBUG DefaultTraversableResolver:103 - Found javax.persistence.Persistence on classpath containing 'getPersistenceUtil'. Assuming JPA 2 environment. Trying to instantiate JPA aware TraversableResolver
2017-04-01 12:10:26 <> DEBUG DefaultTraversableResolver:114 - Instantiated JPA aware TraversableResolver of type org.hibernate.validator.internal.engine.resolver.JPATraversableResolver.
2017-04-01 12:10:26 <> DEBUG ConfigurationImpl:163 - Setting custom MessageInterpolator of type org.springframework.validation.beanvalidation.LocaleContextMessageInterpolator
2017-04-01 12:10:26 <> DEBUG ConfigurationImpl:185 - Setting custom ConstraintValidatorFactory of type org.springframework.validation.beanvalidation.SpringConstraintValidatorFactory
2017-04-01 12:10:26 <> DEBUG ConfigurationImpl:199 - Setting custom ParameterNameProvider of type com.sun.proxy.$Proxy44
2017-04-01 12:10:26 <> DEBUG ValidationXmlParser:91 - Trying to load META-INF/validation.xml for XML based Validator configuration.
2017-04-01 12:10:26 <> DEBUG ResourceLoaderHelper:47 - Trying to load META-INF/validation.xml via user class loader
2017-04-01 12:10:26 <> DEBUG ResourceLoaderHelper:54 - Trying to load META-INF/validation.xml via TCCL
2017-04-01 12:10:26 <> DEBUG ResourceLoaderHelper:60 - Trying to load META-INF/validation.xml via Hibernate Validator's class loader
2017-04-01 12:10:26 <> DEBUG ValidationXmlParser:98 - No META-INF/validation.xml found. Using annotation based configuration only.
Apr 01, 2017 12:10:27 PM org.apache.catalina.core.StandardService startInternal
INFO: Starting service Tomcat
Apr 01, 2017 12:10:27 PM org.apache.catalina.core.StandardEngine startInternal
INFO: Starting Servlet Engine: Apache Tomcat/8.5.11
Apr 01, 2017 12:10:27 PM org.apache.catalina.core.ApplicationContext log
INFO: Initializing Spring embedded WebApplicationContext
Apr 01, 2017 12:10:27 PM org.apache.catalina.core.StandardService stopInternal
INFO: Stopping service Tomcat

Can anyone offer any insight into how I can stop this behaviour? Full loggign output is available here - https://pastebin.com/3yqkex6i Thanks Damien

Upvotes: 1

Views: 3378

Answers (2)

Senthil
Senthil

Reputation: 1

This error would be shown if profile is not set in AWS Batch Job Definition also. profile should be set to 'prd' or 'stg' based on your environment settings in 'Environment variable' section of Batch Job definition.

Upvotes: 0

Damien
Damien

Reputation: 4121

This was an application error I am deploying my application on Amazon lambda and need to use log4j2

Hence I had the following in my pom

<dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter</artifactId>
        <exclusions>
            <exclusion>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-starter-logging</artifactId>
            </exclusion>
        </exclusions>
    </dependency>

By removing the exclusion - it showed me what the application error was and I was able then to quickly resolve it (damn you log4j2 :) )

Upvotes: 2

Related Questions