Error starting Tomcat context. Exception: org.springframework.beans.factory.BeanCreationException - spring

When i was run my spring boot application i have facing the following errors.anyone can face it please help me.and the following are the posted my application.yml.
Error starting Tomcat context. Exception: org.springframework.beans.factory.BeanCreationException. Message: Error creating bean with name 'characterEncodingFilter' defined in class path resource [org/springframework/boot/autoconfigure/web/HttpEncodingAutoConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.web.filter.CharacterEncodingFilter]: Factory method 'characterEncodingFilter' threw exception; nested exception is java.lang.NoSuchMethodError: org.springframework.web.filter.CharacterEncodingFilter.setForceRequestEncoding(Z)V
Exception encountered during context initialization - cancelling refresh attempt: org.springframework.context.ApplicationContextException: Unable to start embedded container; nested exception is org.springframework.boot.context.embedded.EmbeddedServletContainerException: Unable to start embedded Tomcat
application.yml
server:
port: 8080
context-path: /crudapp
spring:
profiles: local,default
datasource:
sampleapp:
url: jdbc:mysql://localhost:3306/employee
username: root
password: root
driverClassName: com.mysql.jdbc.Driver
schema:
- defaultSchema:
maximum-pool-size: 10
hibernate:
hbm2ddl.method: update
dialect: org.hibernate.dialect.MySQLDialect
show_sql: true
format_sql: true
pom.xml
<?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>
<groupId>com.example</groupId>
<artifactId>registration</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>
<name>registration</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/> <!-- lookup parent from repository -->
</parent>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<java.version>1.8</java.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-jdbc</artifactId>
</dependency>
<!-- <dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<scope>runtime</scope>
</dependency> -->
<!-- <dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>5.1.6</version>
</dependency> -->
<dependency>
<groupId>commons-dbcp</groupId>
<artifactId>commons-dbcp</artifactId>
</dependency>
<dependency>
<groupId>com.jappyframework</groupId>
<artifactId>jappy-framework</artifactId>
<version>5.7.19</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<!-- <dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<version>2.5</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>5.2.3.Final</version>
</dependency> -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.zaxxer</groupId>
<artifactId>HikariCP</artifactId>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
<version>3.0</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>

Related

exception in loading bean in Springboot application

We are trying to convert a standalone spring-hibernate based application to web application using Springboot(STS 4). We are using applicationcontext.xml file for bean creation and configuration.We configured libraries in pom.xml,which is attached here. When running the application using Maven, following error is showing. Please help
Description:
An attempt was made to call a method that does not exist. The attempt was made from the following location:
org.springframework.orm.jpa.support.PersistenceAnnotationBeanPostProcessor.findPersistenceMetadata(PersistenceAnnotationBeanPostProcessor.java:350)
The following method did not exist:
org.springframework.beans.factory.annotation.InjectionMetadata.<init>(Ljava/lang/Class;)V
The calling method's class, org.springframework.orm.jpa.support.PersistenceAnnotationBeanPostProcessor, was loaded from the following location:
jar:file:/C:/Users/CIG-Lekshmi1/.m2/repository/org/springframework/spring-orm/2.5.6/spring-orm-2.5.6.jar!/org/springframework/orm/jpa/support/PersistenceAnnotationBeanPostProcessor.class
The called method's class, org.springframework.beans.factory.annotation.InjectionMetadata, is available from the following locations:
jar:file:/C:/Users/CIG-Lekshmi1/.m2/repository/org/springframework/spring-beans/5.3.16/spring-beans-5.3.16.jar!/org/springframework/beans/factory/annotation/InjectionMetadata.class
The called method's class hierarchy was loaded from the following locations:
org.springframework.beans.factory.annotation.InjectionMetadata: file:/C:/Users/CIG-Lekshmi1/.m2/repository/org/springframework/spring-beans/5.3.16/spring-beans-5.3.16.jar
Action:
Correct the classpath of your application so that it contains compatible versions of the classes org.springframework.orm.jpa.support.PersistenceAnnotationBeanPostProcessor and org.springframework.beans.factory.annotation.InjectionMetadata
POM.xml
<?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 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.6.4</version>
<relativePath/>
</parent>
<groupId>com.example</groupId>
<artifactId>ProveWeb-2</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>ProveWeb-2</name>
<description>Demo project for Spring Boot</description>
<properties>
<java.version>1.8</java.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jdbc</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>
<!-- <dependency> -->
<!-- <groupId>org.springframework.boot</groupId> -->
<!-- <artifactId>spring-boot-starter-jdbc</artifactId> -->
<!-- </dependency> -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-orm</artifactId>
<version>2.5.6</version>
</dependency>
<dependency>
<groupId>com.opencsv</groupId>
<artifactId>opencsv</artifactId>
<version>5.1</version>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>5.1.10</version>
</dependency>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.14</version>
</dependency>
<dependency>
<groupId>com.toedter</groupId>
<artifactId>jcalendar</artifactId>
<version>1.4</version>
</dependency>
<dependency>
<groupId>com.itextpdf</groupId>
<artifactId>itextpdf</artifactId>
<version>5.3.4</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>

Correct the classpath of your application so that it contains a single, compatible version of org.springframework.vault.support.SslConfiguration

I am developing code Spring Boot Microservices Project - Part 1 - Spring Boot Config Server & Eureka Service Discovery from - https://www.youtube.com/watch?v=Fq85GschdLw and getting the below error.
***************************
APPLICATION FAILED TO START
***************************
Description:
An attempt was made to call a method that does not exist. The attempt was made from the following location:
org.springframework.cloud.vault.config.VaultConfiguration.createSslConfiguration(VaultConfiguration.java:101)
The following method did not exist:
'void org.springframework.vault.support.SslConfiguration.<init>(org.springframework.vault.support.SslConfiguration$KeyStoreConfiguration, org.springframework.vault.support.SslConfiguration$KeyStoreConfiguration, java.util.List, java.util.List)'
The method's class, org.springframework.vault.support.SslConfiguration, is available from the following locations:
jar:file:/C:/Users/pc/.m2/repository/org/springframework/vault/spring-vault-core/2.3.0/spring-vault-core-2.3.0.jar!/org/springframework/vault/support/SslConfiguration.class
The class hierarchy was loaded from the following locations:
org.springframework.vault.support.SslConfiguration: file:/C:/Users/pc/.m2/repository/org/springframework/vault/spring-vault-core/2.3.0/spring-vault-core-2.3.0.jar
Action:
Correct the classpath of your application so that it contains a single, compatible version of org.springframework.vault.support.SslConfiguration
[2m2021-04-13 20:13:32.155[0;39m [31mERROR[0;39m [35m20424[0;39m [2m---[0;39m [2m[ main][0;39m [36mo.s.b.d.LoggingFailureAnalysisReporter [0;39m [2m:[0;39m
***************************
APPLICATION FAILED TO START
***************************
Description:
An attempt was made to call a method that does not exist. The attempt was made from the following location:
org.springframework.cloud.vault.config.VaultConfiguration.createSslConfiguration(VaultConfiguration.java:101)
The following method did not exist:
'void org.springframework.vault.support.SslConfiguration.<init>(org.springframework.vault.support.SslConfiguration$KeyStoreConfiguration, org.springframework.vault.support.SslConfiguration$KeyStoreConfiguration, java.util.List, java.util.List)'
The method's class, org.springframework.vault.support.SslConfiguration, is available from the following locations:
jar:file:/C:/Users/pc/.m2/repository/org/springframework/vault/spring-vault-core/2.3.0/spring-vault-core-2.3.0.jar!/org/springframework/vault/support/SslConfiguration.class
The class hierarchy was loaded from the following locations:
org.springframework.vault.support.SslConfiguration: file:/C:/Users/pc/.m2/repository/org/springframework/vault/spring-vault-core/2.3.0/spring-vault-core-2.3.0.jar
Action:
Correct the classpath of your application so that it contains a single, compatible version of org.springframework.vault.support.SslConfiguration
pom.xml
<?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 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.4.4</version>
<relativePath /> <!-- lookup parent from repository -->
</parent>
<groupId>com.programming.techie</groupId>
<artifactId>order-service</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>order-service</name>
<description>Demo project for Spring Boot</description>
<properties>
<java.version>11</java.version>
<spring-cloud.version>2020.0.2</spring-cloud.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</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-actuator</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-netflix-eureka-client</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-config</artifactId>
</dependency>
<!-- <dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-bus-amqp</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-feign</artifactId>
<version>1.4.7.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-circuitbreaker-resilience4j</artifactId>
</dependency> -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-security</artifactId>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<scope>runtime</scope>
</dependency>
<!-- <dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-oauth2-resource-server</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-oauth2-jose</artifactId>
</dependency> -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-bootstrap</artifactId>
<version>3.0.1</version>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-vault-config</artifactId>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<excludes>
<exclude>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
</exclude>
</excludes>
</configuration>
</plugin>
</plugins>
</build>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-dependencies</artifactId>
<version>${spring-cloud.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
</project>
bootstrap.properties
spring.cloud.config.uri=http://localhost:8888
spring.datasource.username=root
spring.datasource.password=root
eureka.client.register-with-eureka=true
eureka.client.fetch-registry=true
spring.application.name=order-service
server.port=0
eureka.instance.instance-id=${spring.application.name}:${random.uuid}
management.endpoints.web.exposure.include=*
# Vault
spring.cloud.vault.host=localhost
spring.cloud.vault.port=8200
spring.cloud.vault.scheme=http
spring.cloud.vault.authentication=TOKEN
spring.cloud.vault.token=s.QjdrL9Y6oLhJssBFtOXtuNDc
spring.cloud.vault.application-name=order-service
Downgrade the SpringBoot version from 2.4.4 to 2.3.10.RELEASE and <spring-cloud.version>Hoxton.SR11</spring-cloud.version>.
Downgrade the SpringBoot version from 2.4.4 to 2.4.2

Deploying SpringWS application on Websphere without any database component throwing Error creating bean with name defaultValidator

Hi have been trying to deploy a SpringWS Application onto Websphere-8.5.5.12 application server. but It's throwing the following error. Though I understood the error but not able to solve it.
[2/10/20 23:24:23:348 IST] 0000009d SystemErr R com.ibm.ws.exception.RuntimeWarning: com.ibm.ws.webcontainer.exception.WebAppNotLoadedException: Failed to load webapp: Failed to load webapp: Error creating bean with name &#39;defaultValidator&#39; defined in class path resource [org/springframework/boot/autoconfigure/validation/ValidationAutoConfiguration.class]: Invocation of init method failed&#59; nested exception is java.lang.NoSuchMethodError: javax/validation/Configuration.getDefaultParameterNameProvider&#40;&#41;Ljavax/validation/ParameterNameProvider&#59; &#40;loaded from file:/C:/Program Files &#40;x86&#41;/IBM/WebSphere/AppServer/plugins/javax.j2ee.validation.jar by org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader#20dbc652&#41; called from class org.springframework.validation.beanvalidation.LocalValidatorFactoryBean &#40;loaded from file:/C:/Program&#37;20Files&#37;20&#40;x86&#41;/IBM/WebSphere/AppServer/profiles/AppSrv01/installedApps/DDRFFSN2Node01Cell/Pru_FeService-1-0_0_1-SNAPSHOT_war.ear/Pru_FeService-1-0.0.1-SNAPSHOT.war/WEB-INF/lib/spring-context-5.2.3.RELEASE.jar by
com.ibm.ws.classloader.CompoundClassLoader#b09dd62[war:Pru_FeService-1-0_0_1-SNAPSHOT_war/Pru_FeService-1-0.0.1-SNAPSHOT.war]
The service is a soap service without any database component or Hibernate or anything else. Plain vanilla SpringWS
The Pom.xml is as given below.
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.2.4.RELEASE</version>
<relativePath /> <!-- lookup parent from repository -->
</parent>
<groupId>com.test.ipru.api</groupId>
<artifactId>Pru_FeService-1</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>XXXX_FE</name>
<description>Project for FeService</description>
<packaging>war</packaging>
<properties>
<java.version>1.8</java.version>
<maven-jar-plugin.version>3.1.1</maven-jar-plugin.version>
</properties>
<dependencies>
<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>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<scope>runtime</scope>
<optional>true</optional>
</dependency>
<dependency>
<groupId>wsdl4j</groupId>
<artifactId>wsdl4j</artifactId>
</dependency>
<dependency>
<groupId>net.sf.dozer</groupId>
<artifactId>dozer</artifactId>
<version>5.5.1</version>
</dependency>
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger-ui</artifactId>
<version>2.8.0</version>
</dependency>
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger2</artifactId>
<version>2.8.0</version>
</dependency>
<dependency>
<groupId>com.sun.xml.ws</groupId>
<artifactId>jaxws-rt</artifactId>
<version>2.3.2</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-validation</artifactId>
</dependency>
<dependency>
<groupId>javax.validation</groupId>
<artifactId>validation-api</artifactId>
<version>2.0.1.Final</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
I have been looking into StackOverflow for days now but none of the solutions seem to work.
Any help would be appreciated very much

Weld DefinitionException when deploying Spring Boot project to Wildfly

I'm trying to use WildFly to my Spring Boot project, but when I deploy it, the following exception is thrown:
{"WFLYCTL0080: Failed services" => {"jboss.deployment.unit.\"infrendsz-0.0.1-SNAPSHOT.war\".WeldStartService" => "Failed to start service
Caused by: org.jboss.weld.exceptions.DefinitionException: Exception List with 1 exceptions:
Exception 0 :
javax.enterprise.event.ObserverException
...
Caused by: java.lang.ExceptionInInitializerError
...
Caused by: java.lang.reflect.MalformedParameterizedTypeException
...
"}}
The project works fine as a normal Spring Boot project.
I'm using WildFly 11.
I did everything written here:
https://thepracticaldeveloper.com/2017/09/02/how-to-deploy-a-spring-boot-war-in-wildfly-jboss/
Also my project doesn't use Spring Security at all, but I needed to add it to the dependencies, because WildFly threw a ClassDefNotFound exception otherwise.
Here is my pom.xml:
<?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>
<groupId>hu.kleatech</groupId>
<artifactId>infrendsz</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>war</packaging>
<name>infrendsz</name>
<description>Információs rendszerek építése tárgy beadandó</description>
<parent>
<groupId>org.joinfaces</groupId>
<artifactId>joinfaces-parent</artifactId>
<version>3.2.0</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<java.version>1.8</java.version>
</properties>
<dependencies>
<dependency>
<groupId>org.joinfaces</groupId>
<artifactId>jsf-spring-boot-starter</artifactId>
</dependency>
<dependency>
<groupId>org.primefaces</groupId>
<artifactId>primefaces</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>
<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-security</artifactId>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
</dependency>
<dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<!--
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
-->
</project>
Do you have any idea what couses this and how to solve it?

Spring Boot JDBC Connection to Google Cloud SQL not working

I want to start by saying that when I run this locally, it works perfectly. When I deploy (./mvnw -DskipTests=true appengine:deploy) I deploys just fine with no errors and even appears to run on google cloud just fine. But when I try to use the registration form, i get the following error on submission.
Whitelabel Error Page
This application has no explicit mapping for /error, so you are seeing this as a fallback.
Wed Mar 07 22:48:57 UTC 2018
There was an unexpected error (type=Internal Server Error, status=500).
Unable to acquire JDBC Connection; nested exception is org.hibernate.exception.JDBCConnectionException: Unable to acquire JDBC Connection
MY POM FILE
<?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>
<groupId>com.myApp</groupId>
<artifactId>myApp-server</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>
<name>trading-server</name>
<description>Demo project for Spring Boot</description>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.0.0.RELEASE</version>
<relativePath /> <!-- lookup parent from repository -->
</parent>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<java.version>1.8</java.version>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
<mysql-connector.version>6.0.5</mysql-connector.version>
<mysql-socket-factory.version>1.0.5</mysql-socket-factory.version>
</properties>
<dependencies>
<!-- Spring Boot Dependencies -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-cache</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<!-- Thymeleaf -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-thymeleaf</artifactId>
</dependency>
<dependency>
<groupId>org.thymeleaf.extras</groupId>
<artifactId>thymeleaf-extras-springsecurity4</artifactId>
</dependency>
<dependency>
<groupId>org.thymeleaf.extras</groupId>
<artifactId>thymeleaf-extras-java8time</artifactId>
</dependency>
<!-- Spring Security -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-security</artifactId>
</dependency>
<!-- Database Dependencies -->
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<!-- MySQL Socket Factory for Cloud SQL -->
<groupId>com.google.cloud.sql</groupId>
<artifactId>mysql-socket-factory</artifactId>
<version>1.0.3</version>
</dependency>
<!-- Test Dependencies -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-test</artifactId>
<scope>test</scope>
</dependency>
<!-- Caching Dependencies -->
<!-- <dependency> <groupId>javax.cache</groupId> <artifactId>cache-api</artifactId>
</dependency> <dependency> <groupId>org.ehcache</groupId> <artifactId>ehcache</artifactId>
</dependency> -->
<!-- Webjars Dependencies -->
<dependency>
<groupId>org.webjars</groupId>
<artifactId>webjars-locator</artifactId>
<version>0.32</version>
</dependency>
<dependency>
<groupId>org.webjars</groupId>
<artifactId>bootstrap</artifactId>
<version>3.3.7-1</version>
</dependency>
<dependency>
<groupId>org.webjars</groupId>
<artifactId>jquery</artifactId>
<version>3.3.1-1</version>
</dependency>
</dependencies>
<build>
<!-- START plugin -->
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
<plugin>
<groupId>com.google.cloud.tools</groupId>
<artifactId>appengine-maven-plugin</artifactId>
<version>${appengine.maven.plugin}</version>
</plugin>
</plugins>
<!-- END plugin -->
</build>
APPLICATION PROPERTIES
## DATABASE
database=mysql
#spring.datasource.schema=classpath*:db/${database}/schema.sql
spring.datasource.data=classpath*:db/${database}/data.sql
# Web
spring.thymeleaf.mode=HTML
# Hibernate
hibernate.dialect.storage_engine = innodb
# JPA
spring.jpa.hibernate.ddl-auto=none
spring.jpa.database-platform=org.hibernate.dialect.MySQL5InnoDBDialect
# Spring Actuator Settings
management.endpoints.web.exposure.include=health,info,beans,env,metrics,mapping,trace,sessions
management.endpoints.web.base-path=/actuator
# Active Spring profiles
spring.profiles.active=mysql
APPLICATION-MYSQL.PROPERTIES
database=mysql
spring.datasource.driverClassName=com.mysql.jdbc.Driver
spring.datasource.url=jdbc:mysql://google/database?cloudSqlInstance=spring-test:us-central1:spring-main=com.google.cloud.sql.mysql.SocketFactory
#spring.datasource.url=jdbc:mysql://###.#.#.#/database?cloudSqlInstance=spring-test:us-central1:spring-main=com.google.cloud.sql.mysql.SocketFactory
spring.datasource.username=root
spring.datasource.password=secret
spring.datasource.initialize=true
So again this works perfectly when I comment when i switch datasource.url above and run it locally. But I get the following error when I try to register an account on google cloud sql:
Whitelabel Error Page
This application has no explicit mapping for /error, so you are seeing this as a fallback.
Wed Mar 07 22:48:57 UTC 2018
There was an unexpected error (type=Internal Server Error, status=500).
Unable to acquire JDBC Connection; nested exception is org.hibernate.exception.JDBCConnectionException: Unable to acquire JDBC Connection
The easy way to connect is using spring cloud gcp.
I did this repo to provide a successful connection example.

Resources