Spring Boot Database config wrong but starting ok - java

i have a problem with springboot, if i put wrong my datasource config (example bad password or user) my service start ok, launch the exception PostgresSQL FATAL .... bad password but not stop service. I try so much options but i can't see the problem.
My dependencies is: (i tried exclude for jdbc (tomcat) from starter-jpa).
My pom:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.5.14</version>
<relativePath /> <!-- lookup parent from repository -->
</parent>
<groupId>foo.foo</groupId>
<artifactId>foo-server</artifactId>
<version>1.0.1-SNAPSHOT</version>
<name>fooSB</name>
<description>Foo Application Server</description>
<packaging>jar</packaging>
<properties>
<ignoreSnapshots>true</ignoreSnapshots>
<maven.javadoc.skip>true</maven.javadoc.skip>
<skipTests>true</skipTests>
<log4j2.version>2.17.1</log4j2.version>
<maven-javadoc-plugin-version>3.1.0</maven-javadoc-plugin-version>
<java.version>1.8</java.version>
<maven-compiler-plugin.version>3.8.1</maven-compiler-plugin.version>
<postgresql.version>42.4.1</postgresql.version>
<jdom2.version>2.0.6.1</jdom2.version>
<glassfish-el.version>3.0.4</glassfish-el.version>
<tomcat.version>9.0.58</tomcat.version>
<jackson-bom.version>2.13.2.1</jackson-bom.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
<exclusions>
<exclusion>
<groupId>org.apache.tomcat</groupId>
<artifactId>tomcat-jdbc</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-rest</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>2.7</version>
</dependency>
<dependency>
<groupId>commons-codec</groupId>
<artifactId>commons-codec</artifactId>
</dependency>
<dependency>
<groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>com.zaxxer</groupId>
<artifactId>HikariCP</artifactId>
</dependency>
<dependency>
<groupId>net.rakugakibox.spring.boot</groupId>
<artifactId>orika-spring-boot-starter</artifactId>
<version>1.8.0</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.json/json -->
<dependency>
<groupId>org.json</groupId>
<artifactId>json</artifactId>
<version>20190722</version>
</dependency>
<dependency>
<groupId>org.jdom</groupId>
<artifactId>jdom2</artifactId>
</dependency>
<!-- Jasper -->
<dependency>
<groupId>net.sf.jasperreports</groupId>
<artifactId>jasperreports</artifactId>
<version>6.4.1</version>
<exclusions>
<exclusion>
<groupId>eclipse</groupId>
<artifactId>jdtcore</artifactId>
</exclusion>
<exclusion>
<groupId>com.lowagie</groupId>
<artifactId>itext</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>ar.com.fdvs</groupId>
<artifactId>DynamicJasper</artifactId>
<version>5.1.2</version>
<exclusions>
<exclusion>
<groupId>com.lowagie</groupId>
<artifactId>itext</artifactId>
</exclusion>
</exclusions>
</dependency>
<!-- https://mvnrepository.com/artifact/javax.xml.ws/jaxws-api -->
<dependency>
<groupId>javax.xml.ws</groupId>
<artifactId>jaxws-api</artifactId>
<version>2.3.1</version>
</dependency>
<!-- https://mvnrepository.com/artifact/javax.jws/javax.jws-api -->
<dependency>
<groupId>javax.jws</groupId>
<artifactId>javax.jws-api</artifactId>
<version>1.1</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>repackage</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>${maven-compiler-plugin.version}</version>
<configuration>
<source>${java.version}</source>
<target>${java.version}</target>
<showDeprecation>${java.showDeprecation}</showDeprecation>
<showWarnings>${java.showWarnings}</showWarnings>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>${maven-javadoc-plugin-version}</version>
<configuration>
<detectJavaApiLink>false</detectJavaApiLink>
<source>8</source>
<encoding>${file-encoding}</encoding>
<docencoding>${file-encoding}</docencoding>
<overview>${basedir}/src/overview.html</overview>
</configuration>
<executions>
<execution>
<id>javadoc-jar</id>
<phase>install</phase>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
#######################################################3
Properties:
########################
#------------START DB DATASOURCE PROPERTIES------------#
spring.datasource.url=jdbc:postgresql://localhost:5432/300-foo
spring.datasource.username=foo
spring.datasource.password=foo
spring.jpa.properties.hibernate.default_schema=public
spring.datasource.driver-class-name=org.postgresql.Driver
spring.jpa.hibernate.ddl-auto=none
spring.datasource.type = com.zaxxer.hikari.HikariDataSource
spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.PostgreSQLDialect
server.port=8088
server.http2.enabled=true
server.compression.enabled=true
server.compression.mime-types=text/html,text/xml,text/plain,text/css,text/javascript,application/javascript,application/json,application/xml
server.compression.min-response-size=1B
server.tomcat.max-threads=200
server.tomcat.min-spare-threads=40
server.tomcat.accesslog.enabled=true
server.tomcat.accesslog.directory=/tmp/logs
server.tomcat.accesslog.pattern=%t %A %r %s - response bytes %b - time (ms) server process %D - time (ms) commit response %F
#------------START HIKARI ------------#
spring.datasource.hikari.connection-timeout=20000
spring.datasource.hikari.minimum-idle=5
spring.datasource.hikari.maximum-pool-size=10
spring.datasource.hikari.idle-timeout=600000
spring.datasource.hikari.max-lifetime=1200000
spring.datasource.hikari.auto-commit=true
logging.level.com.zaxxer.hikari.HikariConfig=DEBUG
logging.level.com.zaxxer.hikari=TRACE
spring.datasource.validation-query=SELECT 1
spring.datasource.max-active=10
spring.datasource.max-idle=8
spring.datasource.min-idle=8
spring.datasource.initial-size=5
spring.datasource.test-on-borrow=true
spring.datasource.test-on-return=true
#-------------END HIKARI -------------#
#------------START SPRING DATA REST ------------#
spring.data.rest.detection-strategy=annotated
#-------------END SPRING DATA REST -------------#
#------------START JPA ------------#
spring.jpa.open-in-view=false
spring.jpa.show-sql=false
spring.jpa.properties.hibernate.format_sql=true
spring.jpa.properties.hibernate.enable_lazy_load_no_trans=true
spring.jpa.properties.hibernate.temp.use_jdbc_metadata_defaults=true
spring.jpa.hibernate.naming.physical-strategy = org.hibernate.boot.model.naming.PhysicalNamingStrategyStandardImpl
spring.jpa.hibernate.naming.implicit-strategy =org.hibernate.boot.model.naming.ImplicitNamingStrategyLegacyJpaImpl
#-------------END JPA -------------#
#------------START LOGGING ------------#
logging.level.root=info
#logging.level.org.springframework.web: trace
#logging.level.org.apache: trace
#-------------END LOGGING -------------#
#------------START PID FILE ------------#
spring.pid.fail-on-write-error=true
spring.pid.file=FooApplication.pid
#-------------END PID FILE -------------#
#------------START ORIKA MAPPING PROPERTIES------------#
orika.mapNulls: false
#-------------END ORIKA MAPPING PROPERTIES-------------#
#---- DISABLE BANNER ----#
spring.main.banner-mode=off
#---- DISABLE BANNER ----#
Error launched when starting app (putting bad password)
Caused by: org.postgresql.util.PSQLException: FATAL: la autentificaci?n password fall? para el usuario ?foo?
at org.postgresql.core.v3.ConnectionFactoryImpl.doAuthentication(ConnectionFactoryImpl.java:646)
at org.postgresql.core.v3.ConnectionFactoryImpl.tryConnect(ConnectionFactoryImpl.java:180)
################################## the service finally started #######################################
11:02:13.237 INFO o.s.o.j.LocalContainerEntityManagerFactoryBean - Initialized JPA EntityManagerFactory for persistence unit 'default'
11:02:21.741 INFO o.s.b.d.a.OptionalLiveReloadServer - LiveReload server is running on port 35729
11:02:21.802 INFO o.a.coyote.http11.Http11NioProtocol - Starting ProtocolHandler ["http-nio-8082"]
11:02:21.834 INFO o.s.b.w.e.tomcat.TomcatWebServer - Tomcat started on port(s): 8082 (http) with context path ''
11:02:21.850 INFO n.t.c.view.FooServicesApplication - Started FooServicesApplication in 40.316 seconds (JVM running for 41.48)

To get the expected behavior, i create a bean that launched request (findAll) for one litle table. This bean have #PostConstruct and if BBDD return error my app will be stop.
Example:
#Component
public class DataBaseCheck {
#Autowired
private FooRepository fooRepository;
#Autowired
private ApplicationContext applicationContext;
private Logger log = LoggerFactory.getLogger(DataBaseCheck.class);
#PostConstruct
public void checkCorrectStatusDataBase() {
try {
log.info("We go check database connection...");
//call findAll from a little table - recommended one table with not more 10 elements.
fooRepository.findAll();
log.info("Checked correct database access");
}
} catch (Exception e) {
log.error("Error found trying connect database, please check your configuration.", e);
int exitCode = SpringApplication.exit(applicationContext, () -> 1);
System.exit(exitCode);
}
}
}

Related

Camel FileConsumer does not handle Exchange but recognizes file

I have a spring-boot-application standalone application which uses apache camel to consume a single file, convert it and send the contents to a rest endpoint.
The current working setup
The pom.xml looks like this:
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.3.2.RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<groupId>com.thehandofnod</groupId>
<artifactId>recommenderclient</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>recommenderclient</name>
<description>Client application which communicates with the different Recommender</description>
<properties>
<java.version>1.8</java.version>
<camel-spring-boot-starter-version>2.25.2</camel-spring-boot-starter-version>
<camel-bindy-version>2.25.2</camel-bindy-version>
<camel-jackson-starter-version>2.25.2</camel-jackson-starter-version>
<camel-http-starter-version>2.25.2</camel-http-starter-version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-validation</artifactId>
</dependency>
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-spring-boot-starter</artifactId>
<version>${camel-spring-boot-starter-version}</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.springframework.boot/spring-boot-starter-web -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<!-- https://mvnrepository.com/artifact/org.apache.camel/camel-bindy-starter -->
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-bindy-starter</artifactId>
<version>${camel-bindy-version}</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.apache.camel/camel-jackson-starter -->
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-jackson-starter</artifactId>
<version>${camel-jackson-starter-version}</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.apache.camel/camel-jetty-starter -->
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-http-starter</artifactId>
<version>${camel-http-starter-version}</version>
</dependency>
<!-- https://mvnrepository.com/artifact/ch.qos.logback/logback-classic -->
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<scope>runtime</scope>
<optional>true</optional>
</dependency>
<!-- DB dependencies
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>
<dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>com.ibm.db2</groupId>
<artifactId>jcc</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>com.oracle.database.jdbc</groupId>
<artifactId>ojdbc8</artifactId>
<scope>runtime</scope>
</dependency>
-->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
<exclusions>
<exclusion>
<groupId>org.junit.vintage</groupId>
<artifactId>junit-vintage-engine</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.springframework.restdocs</groupId>
<artifactId>spring-restdocs-webtestclient</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-enforcer-plugin</artifactId>
<executions>
<execution>
<id>enforce</id>
<configuration>
<rules>
<dependencyConvergence/>
</rules>
</configuration>
<goals>
<goal>enforce</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.asciidoctor</groupId>
<artifactId>asciidoctor-maven-plugin</artifactId>
<version>1.5.8</version>
<executions>
<execution>
<id>generate-docs</id>
<phase>prepare-package</phase>
<goals>
<goal>process-asciidoc</goal>
</goals>
<configuration>
<backend>html</backend>
<doctype>book</doctype>
</configuration>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>org.springframework.restdocs</groupId>
<artifactId>spring-restdocs-asciidoctor</artifactId>
<version>${spring-restdocs.version}</version>
</dependency>
</dependencies>
</plugin>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
As you can see I currently use the dependency spring-boot-starter-web to keep the application and therefore the camel routes running. I do this because otherwise the FileConsumer just recognizes the file, creates the exchange but does not route it to the endpoint for processing. That's where my question starts.
The problem
If I don't use the dependency spring-boot-starter-web but want my standalone application to run just only once the routes are just started and shutdown without doing anything (see 'The wished setup')
The problem seems to be that the method ScheduledBatchPollingConsumer#isBatchAllowed sometimes returns false and sometimes returns true. I can't figure out why but to me it seems a timing problem because if I have luck the file is consumed and processed and if I don't have luck the Exchange is not processed.
The wished setup
So I don't want to use the spring-boot-starter-web dependency and I don't want to keep the application running. This should be my wished configuration:
application.properties
camel.component.properties.encoding=UTF-8
# general spring-boot settings
#camel.springboot.main-run-controller=true
#camel.springboot.name=Recommender
# I don't want to keep it running! Shutdown after file was processed is what I wish for.
#camel.springboot.endpoint-bridge-error-handler=true
#camel.springboot.log-mask=true
# common attributes
projectID=2
# customer data route & properties
customerdata.from=file:D:\\projects\\TMP\\RecommenderClientTests\\source?fileName=CUSTOMER_DATA.csv&move=\..\processed&initialDelay=2000&delay=1000
customerdata.to=direct:TransmitCustomerData
# transmit customer data route & properties
transmitcustomerdata.from=direct:TransmitCustomerData
#transmitcustomerdata.to=file:D:\\projects\\TMP\\Camel\\to\\customer? tempFileName=CustomerRequest_tmp.txt&fileName=Customer.json
transmitcustomerdata.to=http://u086:9002/prioritizer/project/customer/transmit?\
bridgeEndpoint=false&\
throwExceptionOnFailure=false&\
httpMethod=POST
transmitcustomerdata.append=false
# archive
archiv=file:D:\\projects\\TMP\\RecommenderClientTests\\archiv? fileName=$simple{exchangeId}-$simple{date:now:yyyyMMddHHmm}&fileExist=Append
The question
How can I configure the file endpoint so that the file is always consumed and processed and the routes are shutdown afterwards?
There are options you can configure to shutdown after N messages processed, or being idel for more than N seconds, or after N time etc.
For example
camel.springboot.duration-max-messages = 1
See more at the docs: https://camel.apache.org/camel-spring-boot/latest/spring-boot.html

Spark with Hive, Unable to instantiate SparkSession with Hive support because Hive classes are not found

The spark app is to load data from Hive:
SparkSession spark = SparkSession.builder()
.appName(topics)
.config("hive.metastore.uris", "thrift://device1:9083")
.enableHiveSupport()
.getOrCreate();
I start the spark by:
spark-submit --master local[*] --class zhihu.SparkConsumer target/original-kafka-consumer-0.1-SNAPSHOT.jar --jars spark-hive_2.11-2.4.4.jar
maven pom.xml
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.zhihu</groupId>
<artifactId>kafka-consumer</artifactId>
<packaging>jar</packaging>
<version>0.1-SNAPSHOT</version>
<name>kafkadev</name>
<url>http://maven.apache.org</url>
<repositories>
<repository>
<!-- Proper URL for Cloudera maven artifactory -->
<id>cloudera</id>
<url>https://repository.cloudera.com/artifactory/cloudera-repos/</url>
</repository>
</repositories>
<dependencies>
<!-- https://mvnrepository.com/artifact/org.apache.logging.log4j/log4j-core -->
<!-- https://mvnrepository.com/artifact/org.apache.logging.log4j/log4j-api -->
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-api</artifactId>
<version>2.8.2</version>
</dependency>
<dependency> <!-- Spark dependency -->
<groupId>org.apache.spark</groupId>
<artifactId>spark-sql_2.11</artifactId>
<version>2.4.4</version>
<scope>compile</scope>
</dependency>
<dependency> <!-- Spark dependency -->
<groupId>org.apache.spark</groupId>
<artifactId>spark-hive_2.11</artifactId>
<version>2.4.4</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.apache.spark</groupId>
<artifactId>spark-streaming_2.11</artifactId>
<version>2.4.4</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.apache.spark</groupId>
<artifactId>spark-streaming-kafka-0-10_2.11</artifactId>
<version>2.4.4</version>
</dependency>
<dependency>
<groupId>org.apache.kafka</groupId>
<artifactId>kafka-clients</artifactId>
<version>2.1.0</version>
<exclusions>
<exclusion>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-core</artifactId>
</exclusion>
<exclusion>
<groupId>org.apache.log4j</groupId>
<artifactId>log4j-core</artifactId>
</exclusion>
<exclusion>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
</exclusion>
</exclusions>
<scope>compile</scope>
</dependency>
<!-- gson -->
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>2.8.2</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.hive</groupId>
<artifactId>hive-metastore</artifactId>
<version>2.1.1-cdh6.2.0</version>
</dependency>
<dependency>
<groupId>org.apache.hive</groupId>
<artifactId>hive-service</artifactId>
<version>2.1.1-cdh6.2.0</version>
</dependency>
<!-- runtime Hive -->
<dependency>
<groupId>org.apache.hive</groupId>
<artifactId>hive-common</artifactId>
<version>2.1.1-cdh6.2.0</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.apache.hive</groupId>
<artifactId>hive-beeline</artifactId>
<version>2.1.1-cdh6.2.0</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.apache.hive</groupId>
<artifactId>hive-jdbc</artifactId>
<version>2.1.1-cdh6.2.0</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.apache.hive</groupId>
<artifactId>hive-shims</artifactId>
<version>2.1.1-cdh6.2.0</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.apache.hive</groupId>
<artifactId>hive-exec</artifactId>
<version>2.1.1-cdh6.2.0</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.apache.hive</groupId>
<artifactId>hive-serde</artifactId>
<version>2.1.1-cdh6.2.0</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.apache.hive</groupId>
<artifactId>hive-contrib</artifactId>
<version>2.1.1-cdh6.2.0</version>
<scope>runtime</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.7.0</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.2.1</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<filters>
<filter>
<artifact>*:*</artifact>
<excludes>
<exclude>**/Log4j2Plugins.dat</exclude>
</excludes>
</filter>
<filter>
<artifact>*:*</artifact>
<excludes>
<exclude>META-INF/*.SF</exclude>
<exclude>META-INF/*.DSA</exclude>
<exclude>META-INF/*.RSA</exclude>
</excludes>
</filter>
</filters>
<artifactSet>
<excludes>
<exclude>classworlds:classworlds</exclude>
<exclude>junit:junit</exclude>
<exclude>jmock:*</exclude>
<exclude>*:xml-apis</exclude>
<exclude>org.apache.maven:lib:tests</exclude>
</excludes>
</artifactSet>
<skip>true</skip>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
it looks no problem, but it always raised:
20/05/07 12:03:17 INFO spark.SparkContext: Added JAR file:/data/projects/zhihu_scraper/consumers/target/original-kafka-consumer-0.1-SNAPSHOT.jar at spark://device2:42395/jars/original-kafka-consumer-0.1-SNAPSHOT.jar with timestamp 1588824197724
20/05/07 12:03:17 INFO executor.Executor: Starting executor ID driver on host localhost
20/05/07 12:03:17 INFO util.Utils: Successfully started service 'org.apache.spark.network.netty.NettyBlockTransferService' on port 33849.
20/05/07 12:03:17 INFO netty.NettyBlockTransferService: Server created on device2:33849
20/05/07 12:03:17 INFO storage.BlockManager: Using org.apache.spark.storage.RandomBlockReplicationPolicy for block replication policy
20/05/07 12:03:17 INFO storage.BlockManagerMaster: Registering BlockManager BlockManagerId(driver, device2, 33849, None)
20/05/07 12:03:17 INFO storage.BlockManagerMasterEndpoint: Registering block manager device2:33849 with 366.3 MB RAM, BlockManagerId(driver, device2, 33849, None)
20/05/07 12:03:17 INFO storage.BlockManagerMaster: Registered BlockManager BlockManagerId(driver, device2, 33849, None)
20/05/07 12:03:17 INFO storage.BlockManager: Initialized BlockManager: BlockManagerId(driver, device2, 33849, None)
20/05/07 12:03:17 INFO handler.ContextHandler: Started o.s.j.s.ServletContextHandler#63e5e5b4{/metrics/json,null,AVAILABLE,#Spark}
Exception in thread "main" java.lang.IllegalArgumentException: Unable to instantiate SparkSession with Hive support because Hive classes are not found.
at org.apache.spark.sql.SparkSession$Builder.enableHiveSupport(SparkSession.scala:869)
at zhihu.SparkConsumer.main(SparkConsumer.java:72)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.apache.spark.deploy.JavaMainApplication.start(SparkApplication.scala:52)
at org.apache.spark.deploy.SparkSubmit.org$apache$spark$deploy$SparkSubmit$$runMain(SparkSubmit.scala:845)
at org.apache.spark.deploy.SparkSubmit.doRunMain$1(SparkSubmit.scala:161)
at org.apache.spark.deploy.SparkSubmit.submit(SparkSubmit.scala:184)
at org.apache.spark.deploy.SparkSubmit.doSubmit(SparkSubmit.scala:86)
at org.apache.spark.deploy.SparkSubmit$$anon$2.doSubmit(SparkSubmit.scala:920)
at org.apache.spark.deploy.SparkSubmit$.main(SparkSubmit.scala:929)
at org.apache.spark.deploy.SparkSubmit.main(SparkSubmit.scala)
20/05/07 12:03:18 INFO spark.SparkContext: Invoking stop() from shutdown hook
I have tried all answers in this post How to create SparkSession with Hive support. But, none of them work for me.
<dependency> <!-- Spark dependency -->
<groupId>org.apache.spark</groupId>
<artifactId>spark-hive_2.11</artifactId>
<version>2.4.4</version>
<scope>compile</scope>
</dependency>
I dont know why compile is the scope it should be runtime. Since You are using maven shade plugin you can package uber jar(with target/original-kafka-consumer-0.1-SNAPSHOT.jar) with all dependencies in one umbrella/archive and it will be in the classpath so that nothing is missed try this.
Also hive-site.xml should be in classpath. then there is no need to seperately configure metastoreuris. in programatic way.
Further reading

Spring Boot Application immediately shuts down after starting in external TOMCAT

Spring boot immediately shuts down after starting in external TOMCAT. But in Eclipse this runs well and JAR with embed too.
I use Tomcat 7 and JAVA 8.
I read a lot of webs and documentation which do not exist.
My Eclipse POM is:
http://maven.apache.org/xsd/maven-4.0.0.xsd">
4.0.0
<groupId>com.suez.demo</groupId>
<artifactId>Myapp</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>war</packaging>
<name>Myappname</name>
<description>Demo project for Spring Boot</description>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.5.6.RELEASE</version>
<relativePath/>
</parent>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<java.version>1.8</java.version>
<start-class>com.suez.demo.SuezApplication</start-class>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
</dependency>
<dependency>
<groupId>javax.mail</groupId>
<artifactId>mail</artifactId>
<version>1.4.7</version>
</dependency>
<dependency>
<groupId>org.json</groupId>
<artifactId>json</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web-services</artifactId>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>
<dependency>
<groupId>org.apache.xmlbeans</groupId>
<artifactId>xmlbeans</artifactId>
<version>2.3.0</version>
</dependency>
<dependency>
<groupId>com.notnoop.apns</groupId>
<artifactId>apns</artifactId>
<version>1.0.0.Beta6</version>
</dependency>
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-config</artifactId>
</dependency>
<dependency>
<groupId>io.jsonwebtoken</groupId>
<artifactId>jjwt</artifactId>
<version>0.7.0</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<version>2.0.0.RELEASE</version>
</plugin>
<plugin>
<groupId>org.jvnet.jaxb2.maven2</groupId>
<artifactId>maven-jaxb2-plugin</artifactId>
<version>0.13.3</version>
<executions>
<execution>
<goals>
<goal>generate</goal>
</goals>
</execution>
</executions>
<configuration>
<generatePackage>com.suez.demo.ws</generatePackage>
<generateDirectory>${project.basedir}/src/main/java</generateDirectory>
<schemaDirectory>${project.basedir}/src/main/resources</schemaDirectory>
<schemaIncludes>
<include>*.wsdl</include>
</schemaIncludes>
</configuration>
</plugin>
</plugins>
</build>
Tomcat output log last lines are:
2018-06-29 10:27:37.874 INFO 640 --- [ost-startStop-3] com.suez.demo.SuezApplication : Started SuezApplication in 29.104 seconds (JVM running for 91.714)
2018-06-29 10:27:37.905 INFO 640 --- [ost-startStop-3] ationConfigEmbeddedWebApplicationContext : Closing org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext#75e8c829: startup date [Fri Jun 29 10:27:11 CEST 2018]; root of context hierarchy
2018-06-29 10:27:37.936 INFO 640 --- [ost-startStop-3] o.s.j.e.a.AnnotationMBeanExporter : Unregistering JMX-exposed beans on shutdown
2018-06-29 10:27:37.952 INFO 640 --- [ost-startStop-3] j.LocalContainerEntityManagerFactoryBean : Closing JPA EntityManagerFactory for persistence unit 'default'
Can someone help me please?
It's hard to say out of the information you've provided, but what looks suspicious to me is that you're using spring-boot-starter-web which in turn brings tomcat starter transitively.
I see that the packaging of this module is WAR, so its intended to run in an external web container, but on the other hand, you say that it runs fine in "JAR with embed too".
So it's a little bit confusing.
I've never by myself deployed spring boot application as a WAR file, but I believe you can go to Start.spring.io and generate a sample application that will package itself into WAR. This option is not shown by default, so you'll have to click on "switch to the full version" link

Spring boot Google SQL is not working properly

I have developed a spring boot application to run on google app engine with google sql and its working in local perfect. When i deploy the application and the rest url its working for sometime and after an hour i get the following . After deploying the code to google app engine i am able to fetch the records from database and doesnt fetch records after an hour. I am using Spring boot version 2.0.0.RELEASE and java 8
Error
org.hibernate.exception.JDBCConnectionException: Unable to open JDBC Connection for DDL execution
these are the configurations i am working with
POM.XML
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
<exclusions>
<exclusion>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>
<!-- https://mvnrepository.com/artifact/org.springframework.boot/spring-boot-starter-test -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<scope>runtime</scope>
</dependency>
<!-- https://mvnrepository.com/artifact/com.google.code.gson/gson -->
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>2.6.2</version>
</dependency>
<!-- https://mvnrepository.com/artifact/com.googlecode.json-simple/json-simple -->
<dependency>
<groupId>com.googlecode.json-simple</groupId>
<artifactId>json-simple</artifactId>
<version>1.1.1</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.apache.httpcomponents/httpclient -->
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
<version>4.5</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.apache.httpcomponents/httpcore -->
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpcore</artifactId>
<version>4.4.1</version>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>3.1.0</version>
<scope>provided</scope>
</dependency>
<!-- https://mvnrepository.com/artifact/com.google.cloud.sql/mysql-socket-factory -->
<dependency>
<groupId>com.google.cloud.sql</groupId>
<artifactId>mysql-socket-factory</artifactId>
<version>1.0.5</version>
</dependency>
<!-- https://mvnrepository.com/artifact/commons-net/commons-net -->
<dependency>
<groupId>commons-net</groupId>
<artifactId>commons-net</artifactId>
<version>3.6</version>
</dependency>
<dependency>
<groupId>com.google.api-client</groupId>
<artifactId>google-api-client</artifactId>
<version>1.21.0</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<version>2.0.0.RELEASE</version>
</plugin>
<!-- [START cloudplugin] -->
<plugin>
<groupId>com.google.cloud.tools</groupId>
<artifactId>appengine-maven-plugin</artifactId>
<version>1.3.1</version>
</plugin>
<!-- [END cloudplugin] -->
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>versions-maven-plugin</artifactId>
<version>2.4</version>
<executions>
<execution>
<phase>compile</phase>
<goals>
<goal>display-dependency-updates</goal>
<goal>display-plugin-updates</goal>
</goals>
</execution>
</executions>
<configuration>
<excludes>
<exclude>javax.servlet:javax.servlet-api</exclude>
<exclude>com.google.guava:guava</exclude> <!-- avoid android version -->
</excludes>
</configuration>
</plugin>
<plugin>
<artifactId>maven-war-plugin</artifactId>
<version>3.1.0</version>
<configuration>
<failOnMissingWebXml>false</failOnMissingWebXml>
</configuration>
</plugin>
</plugins>
</build>
application.properties
spring.datasource.url=jdbc:mysql://google/fbconferencebot?cloudSqlInstance=conference:us-central1:appconference&socketFactory=com.google.cloud.sql.mysql.SocketFactory&user=root&password=*****
spring.jpa.hibernate.ddl-auto=none
spring.datasource.username=root
spring.datasource.password=*******
spring.datasource.driver-class-name=com.mysql.jdbc.Driver
spring.jpa.database=MYSQL
spring.jpa.properties.hibernate.dialect = org.hibernate.dialect.MySQL5Dialect
It's hard to tell without a more detailed stack trace, but you should replace Hibernate's connection pooling as it's not intended for production. This will handle the underlying connections. There is a good SO answer on configuring HikariCP w/ Spring Boot here.
Additionally, you should take a look at the Spring Boot Cloud SQL starter that Mike mentioned - it includes HikariCP as a dependency.

Spring boot application startup fail on having mysql and mongo dependency in POM.XML

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.xxxx.yyyy</groupId>
<artifactId>user</artifactId>
<packaging>jar</packaging>
<version>1.0.0</version>
<name>user</name>
<properties>
<start-class>com.xxxx.yyyy.user.WebApplication</start-class>
<spring-boot.version>1.2.4.RELEASE</spring-boot.version>
<spring-data-commons.version>1.9.2.RELEASE</spring-data-commons.version>
<spring-cloud-netflix.version>1.0.3.RELEASE</spring-cloud-netflix.version>
<mysql-connector-version>5.1.21</mysql-connector-version>
<apache-commons-version>3.1</apache-commons-version>
</properties>
<dependencies>
<!-- Other dependencies -->
<dependency>
<!-- Setup Spring Boot -->
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter</artifactId>
<version>${spring-boot.version}</version>
</dependency>
<dependency>
<!-- Setup Spring Thymeleaf, UI Rendering -->
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-thymeleaf</artifactId>
<version>${spring-boot.version}</version>
</dependency>
<!-- <dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-security</artifactId>
<version>${spring-boot.version}</version>
</dependency> -->
<dependency>
<!-- Setup Spring MVC & REST, use Embedded Tomcat -->
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
<version>${spring-boot.version}</version>
</dependency>
<dependency>
<!-- Setup Spring Data common components -->
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-commons</artifactId>
<version>${spring-data-commons.version}</version>
</dependency>
<dependency>
<!-- Testing starter -->
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<version>${spring-boot.version}</version>
</dependency>
<dependency>
<!-- Setup Spring Data JPA Repository support -->
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
<version>${spring-boot.version}</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-mail</artifactId>
<version>${spring-boot.version}</version>
</dependency>
<dependency>
<!-- Spring Cloud starter -->
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter</artifactId>
<version>${spring-cloud-netflix.version}</version>
</dependency>
<dependency>
<!-- Eureka service registration -->
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-eureka-server</artifactId>
<version>${spring-cloud-netflix.version}</version>
<exclusions>
<exclusion>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
<version>${apache-commons-version}</version>
</dependency>
<!-- https://mvnrepository.com/artifact/commons-codec/commons-codec -->
<dependency>
<groupId>commons-codec</groupId>
<artifactId>commons-codec</artifactId>
<version>1.9</version>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>${mysql-connector-version}</version>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-core</artifactId>
<version>4.1.4.Final</version>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-entitymanager</artifactId>
<version>4.1.4.Final</version>
</dependency>
<dependency>
<groupId>commons-dbcp</groupId>
<artifactId>commons-dbcp</artifactId>
<version>1.4</version>
</dependency>
<!-- https://mvnrepository.com/artifact/javax.mail/mail
<dependency>
<groupId>javax.mail</groupId>
<artifactId>mail</artifactId>
<version>1.4</version>
</dependency> -->
<!-- Spring Data MongoDB-->
<dependency>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-mongodb</artifactId>
<version>1.4.0.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-expression</artifactId>
<version>4.3.8.RELEASE</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<version>${spring-boot.version}</version>
<configuration>
<mainClass>com.altimetrik.platform.user.WebApplication</mainClass>
<layout>ZIP</layout>
</configuration>
<executions>
<execution>
<goals>
<goal>repackage</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<configuration>
<source>1.7</source>
<target>1.7</target>
</configuration>
</plugin>
</plugins>
</build>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-beans</artifactId>
<version>4.1.6.RELEASE</version>
</dependency>
</dependencies>
</dependencyManagement>
</project>
When I add the dependency for both mysql and mongo db in POM.XML, spring boot application is not starting up.
2017-05-09 12:36:42.823 INFO 8612 --- [ main] c.a.platform.user.WebApplication : Starting WebApplication on JJ09T12-LT1 with PID 8612 (E:\Project\platform-user\target\classes started by nmuthusamy in E:\Project\platform-user)
2017-05-09 12:36:42.847 INFO 8612 --- [ main] s.c.a.AnnotationConfigApplicationContext : Refreshing org.springframework.context.annotation.AnnotationConfigApplicationContext#13acb0d1: startup date [Tue May 09 12:36:42 IST 2017]; root of context hierarchy
2017-05-09 12:36:42.853 INFO 8612 --- [ main] .b.l.ClasspathLoggingApplicationListener : Application failed to start with classpath: [file:/E:/Project/platform-user/target/classes/, file:/C:/Users/nmuthusamy/.m2/repository/org/springframework/boot/spring-boot-starter/1.2.4.RELEASE/spring-boot-starter-1.2.4.RELEASE.jar, file:/C:/Users/nmuthusamy/.m2/repository/org/springframework/boot/spring-boot/1.2.4.RELEASE/spring-boot-1.2.4.RELEASE.jar, file:/C:/Users/nmuthusamy/.m2/repository/org/springframework/boot/spring-boot-autoconfigure/1.2.4.RELEASE/spring-boot-autoconfigure-1.2.4.RELEASE.jar, file:/C:/Users/nmuthusamy/.m2/repository/org/springframework/boot/spring-boot-starter-logging/1.2.4.RELEASE/spring-boot-starter-logging-1.2.4.RELEASE.jar, file:/C:/Users/nmuthusamy/.m2/repository/org/slf4j/jul-to-slf4j/1.7.12/jul-to-slf4j-1.7.12.jar, file:/C:/Users/nmuthusamy/.m2/repository/org/slf4j/log4j-over-slf4j/1.7.12/log4j-over-slf4j-1.7.12.jar, file:/C:/Users/nmuthusamy/.m2/repository/ch/qos/logback/logback-classic/1.1.3/logback-classic-1.1.3.jar, file:/C:/Users/nmuthusamy/.m2/repository/ch/qos/logback/logback-core/1.1.3/logback-core-1.1.3.jar, file:/C:/Users/nmuthusamy/.m2/repository/org/springframework/spring-core/4.1.6.RELEASE/spring-core-4.1.6.RELEASE.jar, file:/C:/Users/nmuthusamy/.m2/repository/org/yaml/snakeyaml/1.14/snakeyaml-1.14.jar, file:/C:/Users/nmuthusamy/.m2/repository/org/springframework/boot/spring-boot-starter-thymeleaf/1.2.4.RELEASE/spring-boot-starter-thymeleaf-1.2.4.RELEASE.jar, file:/C:/Users/nmuthusamy/.m2/repository/org/thymeleaf/thymeleaf-spring4/2.1.4.RELEASE/thymeleaf-spring4-2.1.4.RELEASE.jar, file:/C:/Users/nmuthusamy/.m2/repository/org/thymeleaf/thymeleaf/2.1.4.RELEASE/thymeleaf-2.1.4.RELEASE.jar, file:/C:/Users/nmuthusamy/.m2/repository/ognl/ognl/3.0.8/ognl-3.0.8.jar, file:/C:/Users/nmuthusamy/.m2/repository/org/unbescape/unbescape/1.1.0.RELEASE/unbescape-1.1.0.RELEASE.jar, file:/C:/Users/nmuthusamy/.m2/repository/nz/net/ultraq/thymeleaf/thymeleaf-layout-dialect/1.2.8/thymeleaf-layout-dialect-1.2.8.jar, file:/C:/Users/nmuthusamy/.m2/repository/org/springframework/boot/spring-boot-starter-web/1.2.4.RELEASE/spring-boot-starter-web-1.2.4.RELEASE.jar, file:/C:/Users/nmuthusamy/.m2/repository/org/springframework/boot/spring-boot-starter-tomcat/1.2.4.RELEASE/spring-boot-starter-tomcat-1.2.4.RELEASE.jar, file:/C:/Users/nmuthusamy/.m2/repository/org/apache/tomcat/embed/tomcat-embed-core/8.0.23/tomcat-embed-core-8.0.23.jar, file:/C:/Users/nmuthusamy/.m2/repository/org/apache/tomcat/embed/tomcat-embed-el/8.0.23/tomcat-embed-el-8.0.23.jar, file:/C:/Users/nmuthusamy/.m2/repository/org/apache/tomcat/embed/tomcat-embed-logging-juli/8.0.23/tomcat-embed-logging-juli-8.0.23.jar, file:/C:/Users/nmuthusamy/.m2/repository/org/apache/tomcat/embed/tomcat-embed-websocket/8.0.23/tomcat-embed-websocket-8.0.23.jar, file:/C:/Users/nmuthusamy/.m2/repository/com/fasterxml/jackson/core/jackson-databind/2.4.6/jackson-databind-2.4.6.jar, file:/C:/Users/nmuthusamy/.m2/repository/com/fasterxml/jackson/core/jackson-annotations/2.4.0/jackson-annotations-2.4.0.jar, file:/C:/Users/nmuthusamy/.m2/repository/com/fasterxml/jackson/core/jackson-core/2.4.6/jackson-core-2.4.6.jar, file:/C:/Users/nmuthusamy/.m2/repository/org/hibernate/hibernate-validator/5.1.3.Final/hibernate-validator-5.1.3.Final.jar, file:/C:/Users/nmuthusamy/.m2/repository/javax/validation/validation-api/1.1.0.Final/validation-api-1.1.0.Final.jar, file:/C:/Users/nmuthusamy/.m2/repository/com/fasterxml/classmate/1.0.0/classmate-1.0.0.jar, file:/C:/Users/nmuthusamy/.m2/repository/org/springframework/spring-web/4.1.6.RELEASE/spring-web-4.1.6.RELEASE.jar, file:/C:/Users/nmuthusamy/.m2/repository/org/springframework/spring-aop/4.1.6.RELEASE/spring-aop-4.1.6.RELEASE.jar, file:/C:/Users/nmuthusamy/.m2/repository/aopalliance/aopalliance/1.0/aopalliance-1.0.jar, file:/C:/Users/nmuthusamy/.m2/repository/org/springframework/spring-webmvc/4.1.6.RELEASE/spring-webmvc-4.1.6.RELEASE.jar, file:/C:/Users/nmuthusamy/.m2/repository/org/springframework/data/spring-data-commons/1.9.2.RELEASE/spring-data-commons-1.9.2.RELEASE.jar, file:/C:/Users/nmuthusamy/.m2/repository/org/springframework/spring-beans/4.1.6.RELEASE/spring-beans-4.1.6.RELEASE.jar, file:/C:/Users/nmuthusamy/.m2/repository/org/slf4j/slf4j-api/1.7.10/slf4j-api-1.7.10.jar, file:/C:/Users/nmuthusamy/.m2/repository/org/slf4j/jcl-over-slf4j/1.7.10/jcl-over-slf4j-1.7.10.jar, file:/C:/Users/nmuthusamy/.m2/repository/org/springframework/boot/spring-boot-starter-test/1.2.4.RELEASE/spring-boot-starter-test-1.2.4.RELEASE.jar, file:/C:/Users/nmuthusamy/.m2/repository/junit/junit/4.12/junit-4.12.jar, file:/C:/Users/nmuthusamy/.m2/repository/org/mockito/mockito-core/1.10.19/mockito-core-1.10.19.jar, file:/C:/Users/nmuthusamy/.m2/repository/org/objenesis/objenesis/2.1/objenesis-2.1.jar, file:/C:/Users/nmuthusamy/.m2/repository/org/hamcrest/hamcrest-core/1.3/hamcrest-core-1.3.jar, file:/C:/Users/nmuthusamy/.m2/repository/org/hamcrest/hamcrest-library/1.3/hamcrest-library-1.3.jar, file:/C:/Users/nmuthusamy/.m2/repository/org/springframework/spring-test/4.1.6.RELEASE/spring-test-4.1.6.RELEASE.jar, file:/C:/Users/nmuthusamy/.m2/repository/org/springframework/boot/spring-boot-starter-data-jpa/1.2.4.RELEASE/spring-boot-starter-data-jpa-1.2.4.RELEASE.jar, file:/C:/Users/nmuthusamy/.m2/repository/org/springframework/boot/spring-boot-starter-aop/1.2.4.RELEASE/spring-boot-starter-aop-1.2.4.RELEASE.jar, file:/C:/Users/nmuthusamy/.m2/repository/org/aspectj/aspectjrt/1.8.5/aspectjrt-1.8.5.jar, file:/C:/Users/nmuthusamy/.m2/repository/org/aspectj/aspectjweaver/1.8.5/aspectjweaver-1.8.5.jar, file:/C:/Users/nmuthusamy/.m2/repository/org/springframework/boot/spring-boot-starter-jdbc/1.2.4.RELEASE/spring-boot-starter-jdbc-1.2.4.RELEASE.jar, file:/C:/Users/nmuthusamy/.m2/repository/org/springframework/spring-jdbc/4.1.6.RELEASE/spring-jdbc-4.1.6.RELEASE.jar, file:/C:/Users/nmuthusamy/.m2/repository/org/apache/tomcat/tomcat-jdbc/8.0.23/tomcat-jdbc-8.0.23.jar, file:/C:/Users/nmuthusamy/.m2/repository/org/apache/tomcat/tomcat-juli/8.0.23/tomcat-juli-8.0.23.jar, file:/C:/Users/nmuthusamy/.m2/repository/javax/transaction/javax.transaction-api/1.2/javax.transaction-api-1.2.jar, file:/C:/Users/nmuthusamy/.m2/repository/org/springframework/spring-orm/4.1.6.RELEASE/spring-orm-4.1.6.RELEASE.jar, file:/C:/Users/nmuthusamy/.m2/repository/org/springframework/data/spring-data-jpa/1.7.2.RELEASE/spring-data-jpa-1.7.2.RELEASE.jar, file:/C:/Users/nmuthusamy/.m2/repository/org/springframework/spring-aspects/4.1.6.RELEASE/spring-aspects-4.1.6.RELEASE.jar, file:/C:/Users/nmuthusamy/.m2/repository/org/springframework/boot/spring-boot-starter-mail/1.2.4.RELEASE/spring-boot-starter-mail-1.2.4.RELEASE.jar, file:/C:/Users/nmuthusamy/.m2/repository/org/springframework/spring-context/4.1.6.RELEASE/spring-context-4.1.6.RELEASE.jar, file:/C:/Users/nmuthusamy/.m2/repository/org/springframework/spring-context-support/4.1.6.RELEASE/spring-context-support-4.1.6.RELEASE.jar, file:/C:/Users/nmuthusamy/.m2/repository/com/sun/mail/javax.mail/1.5.3/javax.mail-1.5.3.jar, file:/C:/Users/nmuthusamy/.m2/repository/javax/activation/activation/1.1/activation-1.1.jar, file:/C:/Users/nmuthusamy/.m2/repository/org/springframework/cloud/spring-cloud-starter/1.0.3.RELEASE/spring-cloud-starter-1.0.3.RELEASE.jar, file:/C:/Users/nmuthusamy/.m2/repository/org/springframework/cloud/spring-cloud-context/1.0.2.RELEASE/spring-cloud-context-1.0.2.RELEASE.jar, file:/C:/Users/nmuthusamy/.m2/repository/org/springframework/security/spring-security-crypto/3.2.7.RELEASE/spring-security-crypto-3.2.7.RELEASE.jar, file:/C:/Users/nmuthusamy/.m2/repository/org/springframework/cloud/spring-cloud-commons/1.0.2.RELEASE/spring-cloud-commons-1.0.2.RELEASE.jar, file:/C:/Users/nmuthusamy/.m2/repository/org/springframework/cloud/spring-cloud-starter-eureka-server/1.0.3.RELEASE/spring-cloud-starter-eureka-server-1.0.3.RELEASE.jar, file:/C:/Users/nmuthusamy/.m2/repository/org/springframework/cloud/spring-cloud-netflix-eureka-server/1.0.3.RELEASE/spring-cloud-netflix-eureka-server-1.0.3.RELEASE.jar, file:/C:/Users/nmuthusamy/.m2/repository/org/springframework/boot/spring-boot-starter-actuator/1.2.4.RELEASE/spring-boot-starter-actuator-1.2.4.RELEASE.jar, file:/C:/Users/nmuthusamy/.m2/repository/org/springframework/boot/spring-boot-actuator/1.2.4.RELEASE/spring-boot-actuator-1.2.4.RELEASE.jar, file:/C:/Users/nmuthusamy/.m2/repository/org/springframework/boot/spring-boot-starter-freemarker/1.2.4.RELEASE/spring-boot-starter-freemarker-1.2.4.RELEASE.jar, file:/C:/Users/nmuthusamy/.m2/repository/org/freemarker/freemarker/2.3.22/freemarker-2.3.22.jar, file:/C:/Users/nmuthusamy/.m2/repository/org/springframework/cloud/spring-cloud-netflix-core/1.0.3.RELEASE/spring-cloud-netflix-core-1.0.3.RELEASE.jar, file:/C:/Users/nmuthusamy/.m2/repository/com/netflix/eureka/eureka-client/1.1.147/eureka-client-1.1.147.jar, file:/C:/Users/nmuthusamy/.m2/repository/org/codehaus/jettison/jettison/1.2/jettison-1.2.jar, file:/C:/Users/nmuthusamy/.m2/repository/stax/stax-api/1.0.1/stax-api-1.0.1.jar, file:/C:/Users/nmuthusamy/.m2/repository/com/netflix/netflix-commons/netflix-eventbus/0.1.2/netflix-eventbus-0.1.2.jar, file:/C:/Users/nmuthusamy/.m2/repository/org/apache/commons/commons-math/2.2/commons-math-2.2.jar, file:/C:/Users/nmuthusamy/.m2/repository/com/netflix/netflix-commons/netflix-infix/0.1.2/netflix-infix-0.1.2.jar, file:/C:/Users/nmuthusamy/.m2/repository/joda-time/joda-time/2.3/joda-time-2.3.jar, file:/C:/Users/nmuthusamy/.m2/repository/commons-jxpath/commons-jxpath/1.3/commons-jxpath-1.3.jar, file:/C:/Users/nmuthusamy/.m2/repository/org/antlr/antlr-runtime/3.4/antlr-runtime-3.4.jar, file:/C:/Users/nmuthusamy/.m2/repository/org/antlr/stringtemplate/3.2.1/stringtemplate-3.2.1.jar, file:/C:/Users/nmuthusamy/.m2/repository/com/google/code/gson/gson/2.1/gson-2.1.jar, file:/C:/Users/nmuthusamy/.m2/repository/javax/ws/rs/jsr311-api/1.1.1/jsr311-api-1.1.1.jar, file:/C:/Users/nmuthusamy/.m2/repository/com/netflix/servo/servo-core/0.7.4/servo-core-0.7.4.jar, file:/C:/Users/nmuthusamy/.m2/repository/com/sun/jersey/jersey-core/1.11/jersey-core-1.11.jar, file:/C:/Users/nmuthusamy/.m2/repository/com/sun/jersey/jersey-client/1.11/jersey-client-1.11.jar, file:/C:/Users/nmuthusamy/.m2/repository/com/sun/jersey/contribs/jersey-apache-client4/1.11/jersey-apache-client4-1.11.jar, file:/C:/Users/nmuthusamy/.m2/repository/org/apache/httpcomponents/httpclient/4.2.1/httpclient-4.2.1.jar, file:/C:/Users/nmuthusamy/.m2/repository/org/apache/httpcomponents/httpcore/4.2.1/httpcore-4.2.1.jar, file:/C:/Users/nmuthusamy/.m2/repository/commons-logging/commons-logging/1.1.1/commons-logging-1.1.1.jar, file:/C:/Users/nmuthusamy/.m2/repository/com/netflix/governator/governator/1.2.10/governator-1.2.10.jar, file:/C:/Users/nmuthusamy/.m2/repository/com/google/inject/extensions/guice-grapher/3.0/guice-grapher-3.0.jar, file:/C:/Users/nmuthusamy/.m2/repository/com/google/inject/extensions/guice-assistedinject/3.0/guice-assistedinject-3.0.jar, file:/C:/Users/nmuthusamy/.m2/repository/org/codehaus/jsr166-mirror/jsr166y/1.7.0/jsr166y-1.7.0.jar, file:/C:/Users/nmuthusamy/.m2/repository/com/google/inject/guice/3.0/guice-3.0.jar, file:/C:/Users/nmuthusamy/.m2/repository/org/apache/xbean/xbean-finder/3.11.1/xbean-finder-3.11.1.jar, file:/C:/Users/nmuthusamy/.m2/repository/asm/asm-all/3.2/asm-all-3.2.jar, file:/C:/Users/nmuthusamy/.m2/repository/com/google/inject/extensions/guice-multibindings/3.0/guice-multibindings-3.0.jar, file:/C:/Users/nmuthusamy/.m2/repository/org/apache/xbean/xbean-bundleutils/3.11.1/xbean-bundleutils-3.11.1.jar, file:/C:/Users/nmuthusamy/.m2/repository/com/netflix/blitz4j/blitz4j/1.36.0/blitz4j-1.36.0.jar, file:/C:/Users/nmuthusamy/.m2/repository/com/google/guava/guava/11.0.1/guava-11.0.1.jar, file:/C:/Users/nmuthusamy/.m2/repository/com/google/code/findbugs/jsr305/1.3.9/jsr305-1.3.9.jar, file:/C:/Users/nmuthusamy/.m2/repository/log4j/log4j/1.2.17/log4j-1.2.17.jar, file:/C:/Users/nmuthusamy/.m2/repository/commons-collections/commons-collections/3.2.1/commons-collections-3.2.1.jar, file:/C:/Users/nmuthusamy/.m2/repository/com/sun/jersey/jersey-servlet/1.13/jersey-servlet-1.13.jar, file:/C:/Users/nmuthusamy/.m2/repository/com/sun/jersey/jersey-server/1.13/jersey-server-1.13.jar, file:/C:/Users/nmuthusamy/.m2/repository/asm/asm/3.1/asm-3.1.jar, file:/C:/Users/nmuthusamy/.m2/repository/com/netflix/eureka/eureka-core/1.1.147/eureka-core-1.1.147.jar, file:/C:/Users/nmuthusamy/.m2/repository/com/amazonaws/aws-java-sdk/1.3.27/aws-java-sdk-1.3.27.jar, file:/C:/Users/nmuthusamy/.m2/repository/org/codehaus/jackson/jackson-core-asl/1.8.9/jackson-core-asl-1.8.9.jar, file:/C:/Users/nmuthusamy/.m2/repository/org/codehaus/jackson/jackson-mapper-asl/1.8.9/jackson-mapper-asl-1.8.9.jar, file:/C:/Users/nmuthusamy/.m2/repository/com/netflix/archaius/archaius-core/0.6.5/archaius-core-0.6.5.jar, file:/C:/Users/nmuthusamy/.m2/repository/commons-configuration/commons-configuration/1.8/commons-configuration-1.8.jar, file:/C:/Users/nmuthusamy/.m2/repository/org/springframework/cloud/spring-cloud-starter-ribbon/1.0.3.RELEASE/spring-cloud-starter-ribbon-1.0.3.RELEASE.jar, file:/C:/Users/nmuthusamy/.m2/repository/com/netflix/ribbon/ribbon/2.0.0/ribbon-2.0.0.jar, file:/C:/Users/nmuthusamy/.m2/repository/com/netflix/ribbon/ribbon-transport/2.0.0/ribbon-transport-2.0.0.jar, file:/C:/Users/nmuthusamy/.m2/repository/io/reactivex/rxnetty-contexts/0.4.6/rxnetty-contexts-0.4.6.jar, file:/C:/Users/nmuthusamy/.m2/repository/io/reactivex/rxnetty-servo/0.4.6/rxnetty-servo-0.4.6.jar, file:/C:/Users/nmuthusamy/.m2/repository/com/netflix/hystrix/hystrix-core/1.4.0-rc.8/hystrix-core-1.4.0-rc.8.jar, file:/C:/Users/nmuthusamy/.m2/repository/javax/inject/javax.inject/1/javax.inject-1.jar, file:/C:/Users/nmuthusamy/.m2/repository/io/reactivex/rxnetty/0.4.6/rxnetty-0.4.6.jar, file:/C:/Users/nmuthusamy/.m2/repository/io/netty/netty-codec-http/4.0.25.Final/netty-codec-http-4.0.25.Final.jar, file:/C:/Users/nmuthusamy/.m2/repository/io/netty/netty-codec/4.0.25.Final/netty-codec-4.0.25.Final.jar, file:/C:/Users/nmuthusamy/.m2/repository/io/netty/netty-handler/4.0.25.Final/netty-handler-4.0.25.Final.jar, file:/C:/Users/nmuthusamy/.m2/repository/io/netty/netty-transport-native-epoll/4.0.25.Final/netty-transport-native-epoll-4.0.25.Final.jar, file:/C:/Users/nmuthusamy/.m2/repository/io/netty/netty-common/4.0.25.Final/netty-common-4.0.25.Final.jar, file:/C:/Users/nmuthusamy/.m2/repository/io/netty/netty-buffer/4.0.25.Final/netty-buffer-4.0.25.Final.jar, file:/C:/Users/nmuthusamy/.m2/repository/io/netty/netty-transport/4.0.25.Final/netty-transport-4.0.25.Final.jar, file:/C:/Users/nmuthusamy/.m2/repository/com/netflix/ribbon/ribbon-core/2.0.0/ribbon-core-2.0.0.jar, file:/C:/Users/nmuthusamy/.m2/repository/commons-lang/commons-lang/2.6/commons-lang-2.6.jar, file:/C:/Users/nmuthusamy/.m2/repository/com/netflix/ribbon/ribbon-httpclient/2.0.0/ribbon-httpclient-2.0.0.jar, file:/C:/Users/nmuthusamy/.m2/repository/com/netflix/netflix-commons/netflix-commons-util/0.1.1/netflix-commons-util-0.1.1.jar, file:/C:/Users/nmuthusamy/.m2/repository/com/netflix/ribbon/ribbon-loadbalancer/2.0.0/ribbon-loadbalancer-2.0.0.jar, file:/C:/Users/nmuthusamy/.m2/repository/com/netflix/netflix-commons/netflix-statistics/0.1.1/netflix-statistics-0.1.1.jar, file:/C:/Users/nmuthusamy/.m2/repository/io/reactivex/rxjava/1.0.11/rxjava-1.0.11.jar, file:/C:/Users/nmuthusamy/.m2/repository/com/netflix/ribbon/ribbon-eureka/2.0.0/ribbon-eureka-2.0.0.jar, file:/C:/Users/nmuthusamy/.m2/repository/com/google/code/findbugs/annotations/2.0.0/annotations-2.0.0.jar, file:/C:/Users/nmuthusamy/.m2/repository/com/thoughtworks/xstream/xstream/1.4.2/xstream-1.4.2.jar, file:/C:/Users/nmuthusamy/.m2/repository/xmlpull/xmlpull/1.1.3.1/xmlpull-1.1.3.1.jar, file:/C:/Users/nmuthusamy/.m2/repository/xpp3/xpp3_min/1.1.4c/xpp3_min-1.1.4c.jar, file:/C:/Users/nmuthusamy/.m2/repository/org/apache/commons/commons-lang3/3.1/commons-lang3-3.1.jar, file:/C:/Users/nmuthusamy/.m2/repository/commons-codec/commons-codec/1.9/commons-codec-1.9.jar, file:/C:/Users/nmuthusamy/.m2/repository/mysql/mysql-connector-java/5.1.21/mysql-connector-java-5.1.21.jar, file:/C:/Users/nmuthusamy/.m2/repository/org/hibernate/hibernate-core/4.1.4.Final/hibernate-core-4.1.4.Final.jar, file:/C:/Users/nmuthusamy/.m2/repository/antlr/antlr/2.7.7/antlr-2.7.7.jar, file:/C:/Users/nmuthusamy/.m2/repository/org/jboss/logging/jboss-logging/3.1.0.GA/jboss-logging-3.1.0.GA.jar, file:/C:/Users/nmuthusamy/.m2/repository/org/jboss/spec/javax/transaction/jboss-transaction-api_1.1_spec/1.0.0.Final/jboss-transaction-api_1.1_spec-1.0.0.Final.jar, file:/C:/Users/nmuthusamy/.m2/repository/dom4j/dom4j/1.6.1/dom4j-1.6.1.jar, file:/C:/Users/nmuthusamy/.m2/repository/org/hibernate/javax/persistence/hibernate-jpa-2.0-api/1.0.1.Final/hibernate-jpa-2.0-api-1.0.1.Final.jar, file:/C:/Users/nmuthusamy/.m2/repository/org/javassist/javassist/3.15.0-GA/javassist-3.15.0-GA.jar, file:/C:/Users/nmuthusamy/.m2/repository/org/hibernate/common/hibernate-commons-annotations/4.0.1.Final/hibernate-commons-annotations-4.0.1.Final.jar, file:/C:/Users/nmuthusamy/.m2/repository/org/hibernate/hibernate-entitymanager/4.1.4.Final/hibernate-entitymanager-4.1.4.Final.jar, file:/C:/Users/nmuthusamy/.m2/repository/commons-dbcp/commons-dbcp/1.4/commons-dbcp-1.4.jar, file:/C:/Users/nmuthusamy/.m2/repository/commons-pool/commons-pool/1.5.4/commons-pool-1.5.4.jar, file:/C:/Users/nmuthusamy/.m2/repository/org/springframework/data/spring-data-mongodb/1.4.0.RELEASE/spring-data-mongodb-1.4.0.RELEASE.jar, file:/C:/Users/nmuthusamy/.m2/repository/org/springframework/spring-tx/3.2.8.RELEASE/spring-tx-3.2.8.RELEASE.jar, file:/C:/Users/nmuthusamy/.m2/repository/org/springframework/spring-expression/3.2.8.RELEASE/spring-expression-3.2.8.RELEASE.jar, file:/C:/Users/nmuthusamy/.m2/repository/org/mongodb/mongo-java-driver/2.11.4/mongo-java-driver-2.11.4.jar]
2017-05-09 12:36:42.855 ERROR 8612 --- [ main] o.s.boot.SpringApplication : Application startup failed
java.lang.NoSuchMethodError: org.springframework.expression.spel.SpelParserConfiguration.<init>(Lorg/springframework/expression/spel/SpelCompilerMode;Ljava/lang/ClassLoader;)V
at org.springframework.context.expression.StandardBeanExpressionResolver.<init>(StandardBeanExpressionResolver.java:98)
at org.springframework.context.support.AbstractApplicationContext.prepareBeanFactory(AbstractApplicationContext.java:553)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:455)
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:686)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:320)
at org.springframework.boot.builder.SpringApplicationBuilder.run(SpringApplicationBuilder.java:139)
at org.springframework.cloud.bootstrap.BootstrapApplicationListener.bootstrapServiceContext(BootstrapApplicationListener.java:126)
at org.springframework.cloud.bootstrap.BootstrapApplicationListener.onApplicationEvent(BootstrapApplicationListener.java:75)
at org.springframework.cloud.bootstrap.BootstrapApplicationListener.onApplicationEvent(BootstrapApplicationListener.java:55)
at org.springframework.context.event.SimpleApplicationEventMulticaster.invokeListener(SimpleApplicationEventMulticaster.java:151)
at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:128)
at org.springframework.boot.context.event.EventPublishingRunListener.publishEvent(EventPublishingRunListener.java:100)
at org.springframework.boot.context.event.EventPublishingRunListener.environmentPrepared(EventPublishingRunListener.java:59)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:285)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:957)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:946)
at com.altimetrik.platform.user.WebApplication.main(WebApplication.java:43)
This is because of possible mismatch of spring-expression jar.
<dependency>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-mongodb</artifactId>
<version>${spring-data-mongodb.version}</version>
<exclusions>
<exclusion>
<groupId>org.springframework</groupId>
<artifactId>spring-expression</artifactId>
</exclusion>
</exclusions>
</dependency>
Try this and it should work.

Categories