Spring-Boot and MySql unable to connect - java

I am trying to connect to mysql database, but it's not working. I took a course from udemy and followed all steps, but i am getting always the same error, then I followed the steps from this and this guides, but doesn't work.
Things i tried so far:
new IDE
clean & rebuild project
deleting property spring.datasource.driverClassName = com.mysql.jdbc.Driver from application.properties
tried to add Mysql Connector manually
I've ran out of ideas. Need some assistance
Update: Stacktrace
2017-03-12 19:20:53.388 INFO 7808 --- [ main] org.hibernate.dialect.Dialect : HHH000400: Using dialect: org.hibernate.dialect.MySQL5Dialect
2017-03-12 19:20:53.515 INFO 7808 --- [ main] o.h.e.j.e.i.LobCreatorBuilderImpl : HHH000423: Disabling contextual LOB creation as JDBC driver reported JDBC version [3] less than 4
2017-03-12 19:20:54.046 WARN 7808 --- [ main] ationConfigEmbeddedWebApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in class path resource [org/springframework/boot/autoconfigure/orm/jpa/HibernateJpaAutoConfiguration.class]: Invocation of init method failed; nested exception is javax.persistence.PersistenceException: [PersistenceUnit: default] Unable to build Hibernate SessionFactory
2017-03-12 19:20:54.061 INFO 7808 --- [ main] o.apache.catalina.core.StandardService : Stopping service Tomcat
2017-03-12 19:20:54.106 INFO 7808 --- [ main] utoConfigurationReportLoggingInitializer :
Error starting ApplicationContext. To display the auto-configuration report re-run your application with 'debug' enabled.
2017-03-12 19:20:54.130 ERROR 7808 --- [ main] o.s.boot.SpringApplication : Application startup failed
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in class path resource [org/springframework/boot/autoconfigure/orm/jpa/HibernateJpaAutoConfiguration.class]: Invocation of init method failed; nested exception is javax.persistence.PersistenceException: [PersistenceUnit: default] Unable to build Hibernate SessionFactory
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1628) ~[spring-beans-4.3.7.RELEASE.jar:4.3.7.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:555) ~[spring-beans-4.3.7.RELEASE.jar:4.3.7.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:483) ~[spring-beans-4.3.7.RELEASE.jar:4.3.7.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306) ~[spring-beans-4.3.7.RELEASE.jar:4.3.7.RELEASE]
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230) ~[spring-beans-4.3.7.RELEASE.jar:4.3.7.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302) ~[spring-beans-4.3.7.RELEASE.jar:4.3.7.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197) ~[spring-beans-4.3.7.RELEASE.jar:4.3.7.RELEASE]
at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1081) ~[spring-context-4.3.7.RELEASE.jar:4.3.7.RELEASE]
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:856) ~[spring-context-4.3.7.RELEASE.jar:4.3.7.RELEASE]
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:542) ~[spring-context-4.3.7.RELEASE.jar:4.3.7.RELEASE]
at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:122) ~[spring-boot-1.4.5.RELEASE.jar:1.4.5.RELEASE]
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:762) [spring-boot-1.4.5.RELEASE.jar:1.4.5.RELEASE]
at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:372) [spring-boot-1.4.5.RELEASE.jar:1.4.5.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:316) [spring-boot-1.4.5.RELEASE.jar:1.4.5.RELEASE]
Packages in eclipse
Application.properties
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.stopCozi</groupId>
<artifactId>stopCozi</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>
<name>StopCozi</name>
<description>Stop Cozi </description>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.4.5.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.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<!-- for HTML -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-thymeleaf</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<!-- Dependecy for database -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-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-data-rest</artifactId>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>
User Entity
#Entity
public class User {
private String name;
private String surname;
private String password;
#Id
#GeneratedValue (strategy= GenerationType.AUTO)
private String userId;
private String email;
private String phoneNo;
private String PIN;
private List<Appointment> appointmentList;
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
//getter and setter
UserDaoRepository
#RepositoryRestResource(collectionResourceRel = "user", path = "user")
public interface UserDaoRepository extends JpaRepository<User, Long>{
User findByName(#Param("name") String name);
User findByEmail(#Param("email") String email);
}

Try adding this to your maven project file:
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>5.1.6</version>
</dependency>
Your application.properties file is just telling spring what jpa provider to use. You still have to include the jdbc provider implementation files.

You need to define the ORM association for this field :
private List<Appointment> appointmentList;
For example if a User may have multiple Appointment and an Appointment may be related to zero or one User, you could define the Appointment relationship in this way in the User entity :
#Entity
public class User{
...
#OneToMany(mappedBy="user")
private List<Appointment> appointmentList;
}
And in the Appointment entity you could define this relationship :
#Entity
public class Appointment{
...
#ManyToOne
private User user;
...
}
If you encounter other mapping errors, I advise you to understand the Hibernate/JPA basics.
Here is the actual documentation of Hibernate (v 5): http://docs.jboss.org/hibernate/orm/5.2/userguide/html_single/Hibernate_User_Guide.html
Here is the documentation part on the relationships definition between entities :
http://docs.jboss.org/hibernate/orm/5.2/userguide/html_single/Hibernate_User_Guide.html#associations

Related

Unable to Hit Rest Controller Spring Boot

I have below pom.xml in the SpringBoot application. While running the application, I am not facing any errors. But when I am hitting the URL through postman or browser, then my java code present inside controller is not getting executed.
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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.example</groupId>
<artifactId>MENU-RIGHT</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.3.1.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-jar-plugin.version>3.1.1</maven-jar-plugin.version>
</properties>
<dependencies>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>8.0.26</version>
</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>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
</project>
Controller:
package com.example.controller;
import java.util.logging.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import com.example.model.MenuRightModel;
import com.example.service.MenuRightService;
#RestController
public class MenuRightController {
Logger logger = Logger.getAnonymousLogger();
#Autowired
private MenuRightService menuRightService;
#RequestMapping(value = "/getRightByUser/{id}", method=RequestMethod.GET)
public MenuRightModel findRightByUser(#PathVariable("id") int id) {
logger.info("Request Received for User Id : "+id);
return menuRightService.findRightByUser(id);
}
#RequestMapping(value = "/getRightAll", method=RequestMethod.GET)
public MenuRightModel findAllRight() {
return new MenuRightModel();
}
}
Project Execution Screenshot:
Postman Execution Screenshot:
Spring Boot Application Class:
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
import org.springframework.context.annotation.ComponentScan;
#SpringBootApplication(exclude = {DataSourceAutoConfiguration.class })
#ComponentScan("src/main/java")
public class MenuRightApplication {
public static void main(String[] args) {
SpringApplication.run(MenuRightApplication.class, args);
}
}
Spring Boot Repository Class:
package com.dbs.repository;
import org.springframework.stereotype.Repository;
import com.example.model.MenuRightModel;
import org.springframework.data.jpa.repository.JpaRepository;
#Repository
public interface MenuRightRepository extends JpaRepository<MenuRightModel, Integer>{
MenuRightModel findByUserId(int id);
}
After Adding BasePackage as com.example facing below Exception:
2022-03-21 09:51:35.169 WARN 20560 --- [ restartedMain] ConfigServletWebServerApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'menuRightController': Unsatisfied dependency expressed through field 'menuRightService'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'menuRightServiceImpl': Unsatisfied dependency expressed through field 'menuRightRepository'; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type 'com.example.repository.MenuRightRepository' available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {#org.springframework.beans.factory.annotation.Autowired(required=true)}
2022-03-21 09:51:35.172 INFO 20560 --- [ restartedMain] o.apache.catalina.core.StandardService : Stopping service [Tomcat]
2022-03-21 09:51:35.189 INFO 20560 --- [ restartedMain] ConditionEvaluationReportLoggingListener :
Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
2022-03-21 09:51:35.312 ERROR 20560 --- [ restartedMain] o.s.b.d.LoggingFailureAnalysisReporter :
APPLICATION FAILED TO START
Description:
Field menuRightRepository in com.example.service.impl.MenuRightServiceImpl required a bean of type 'com.example.repository.MenuRightRepository' that could not be found.
The injection point has the following annotations:
- #org.springframework.beans.factory.annotation.Autowired(required=true)
Action:
Consider defining a bean of type 'com.example.repository.MenuRightRepository' in your configuration.
I am sure it is your main class configuration issue. By default, framework will scan beans in same package as of main class and sub-packages. e.g. below will not work
com/example/controller/FooController.java
com/example/main/MainClass.java
as applciation will scan for beans in com.example.main package and its subpackages only.
If that is case, you will need to update 'scanBasePackages' attribute of #SpringBootApplication annotation.
You need to add a package name in the component scan, in your case, it is #ComponentScan("com.example.controller"), Standard way to create other packages is
under the main root package

Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException:

I m trying to run my project Spring boot with mysql and flyway
My environement:
Linux 18.04
Java 1.8.0_201
Spring boot and this my pom.xml
4.0.0
org.springframework.boot
spring-boot-starter-parent
2.3.1.RELEASE
com.mhanzouli
tutorial
0.0.1-SNAPSHOT
tutorial
Test Swagger/Actuator/Log4j2/Flyway
<properties>
<java.version>1.8</java.version>
</properties>
<dependencies>
<!--<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</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>
<dependency>
<groupId>org.flywaydb</groupId>
<artifactId>flyway-core</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-log4j2</artifactId>
</dependency>
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger2</artifactId>
<version>2.6.1</version>
</dependency>
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger-ui</artifactId>
<version>2.6.1</version>
</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>jakarta.validation</groupId>
<artifactId>jakarta.validation-api</artifactId>
<version>2.0.2</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
application.yml
spring:
datasource:
url: jdbc:mysql://localhost:3306/tutorial_bd?useSSL=false&serverTimezone=UTC&useLegacyDatetimeCode=false
username: root
password:
jpa:
show-sql: true
hibernate:
ddl-auto: validate
naming-strategy: org.hibernate.cfg.ImprovedNamingStrategy
properties:
hibernate:
dialect: org.hibernate.dialect.MySQL5InnoDBDialect
flyway:
url: jdbc:mysql://localhost:3306/tutorial_bd
user: "root"
password:
baselineOnMigrate: true
check-location: true
locations: classpath:db/migration
enabled: true
V1__init.sql
CREATE TABLE users (
id bigint(20) NOT NULL AUTO_INCREMENT,
username varchar(100) NOT NULL,
first_name varchar(50) NOT NULL,
last_name varchar(50) DEFAULT NULL,
PRIMARY KEY (id),
UNIQUE KEY UK_username (username)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
User.java
package com.mhanzouli.tutorial.domain;
import javax.persistence.*;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.Size;
#Entity
#Table(name = "users")
public class User {
#Id
#GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;
#NotBlank
#Column(unique = true)
#Size(min = 1, max = 100)
private String username;
#NotBlank
#Size(max = 50)
private String firstName;
#Size(max = 50)
private String lastName;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getUsername() {
return username;
}
public void setUsername(String username) {
this.username = username;
}
public String getFirstName() {
return firstName;
}
public void setFirstName(String firstName) {
this.firstName = firstName;
}
public String getLastName() {
return lastName;
}
public void setLastName(String lastName) {
this.lastName = lastName;
}
}
this is my project structure
And when i execute
mvn spring-boot:run
i got this error
2020-06-20 21:19:54.540 INFO 13594 --- [ main] c.m.tutorial.TutorialApplication : Starting TutorialApplication on marwen with PID 13594 (/home/marwen/Bureau/projects/tutorial/target/classes started by marwen in /home/marwen/Bureau/projects/tutorial)
2020-06-20 21:19:54.543 INFO 13594 --- [ main] c.m.tutorial.TutorialApplication : No active profile set, falling back to default profiles: default
2020-06-20 21:19:55.337 INFO 13594 --- [ main] .s.d.r.c.RepositoryConfigurationDelegate : Bootstrapping Spring Data JPA repositories in DEFERRED mode.
2020-06-20 21:19:55.364 INFO 13594 --- [ main] .s.d.r.c.RepositoryConfigurationDelegate : Finished Spring Data repository scanning in 19ms. Found 0 JPA repository interfaces.
2020-06-20 21:19:55.962 INFO 13594 --- [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat initialized with port(s): 8080 (http)
2020-06-20 21:19:55.971 INFO 13594 --- [ main] o.apache.catalina.core.StandardService : Starting service [Tomcat]
2020-06-20 21:19:55.971 INFO 13594 --- [ main] org.apache.catalina.core.StandardEngine : Starting Servlet engine: [Apache Tomcat/9.0.36]
2020-06-20 21:19:56.045 INFO 13594 --- [ main] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring embedded WebApplicationContext
2020-06-20 21:19:56.046 INFO 13594 --- [ main] w.s.c.ServletWebServerApplicationContext : Root WebApplicationContext: initialization completed in 1452 ms
2020-06-20 21:19:56.196 INFO 13594 --- [ main] o.f.c.internal.license.VersionPrinter : Flyway Community Edition 6.4.4 by Redgate
2020-06-20 21:19:56.310 INFO 13594 --- [ main] o.f.c.internal.database.DatabaseFactory : Database: jdbc:mysql://localhost:3306/tutorial_bd (MySQL 5.5)
2020-06-20 21:19:56.366 WARN 13594 --- [ main] ConfigServletWebServerApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'flywayInitializer' defined in class path resource [org/springframework/boot/autoconfigure/flyway/FlywayAutoConfiguration$FlywayConfiguration.class]: Invocation of init method failed; nested exception is org.flywaydb.core.internal.license.FlywayEditionUpgradeRequiredException: Flyway Pro Edition or MariaDB upgrade required: MariaDB 10.1 is no longer supported by Flyway Community Edition, but still supported by Flyway Pro Edition.
2020-06-20 21:19:56.369 INFO 13594 --- [ main] o.apache.catalina.core.StandardService : Stopping service [Tomcat]
2020-06-20 21:19:56.382 INFO 13594 --- [ main] ConditionEvaluationReportLoggingListener :
Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
2020-06-20 21:19:56.392 ERROR 13594 --- [ main] o.s.boot.SpringApplication : Application run failed
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'flywayInitializer' defined in class path resource [org/springframework/boot/autoconfigure/flyway/FlywayAutoConfiguration$FlywayConfiguration.class]: Invocation of init method failed; nested exception is org.flywaydb.core.internal.license.FlywayEditionUpgradeRequiredException: Flyway Pro Edition or MariaDB upgrade required: MariaDB 10.1 is no longer supported by Flyway Community Edition, but still supported by Flyway Pro Edition.
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1796) ~[spring-beans-5.2.7.RELEASE.jar:5.2.7.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:595) ~[spring-beans-5.2.7.RELEASE.jar:5.2.7.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:517) ~[spring-beans-5.2.7.RELEASE.jar:5.2.7.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:323) ~[spring-beans-5.2.7.RELEASE.jar:5.2.7.RELEASE]
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:226) ~[spring-beans-5.2.7.RELEASE.jar:5.2.7.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:321) ~[spring-beans-5.2.7.RELEASE.jar:5.2.7.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:202) ~[spring-beans-5.2.7.RELEASE.jar:5.2.7.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:310) ~[spring-beans-5.2.7.RELEASE.jar:5.2.7.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:202) ~[spring-beans-5.2.7.RELEASE.jar:5.2.7.RELEASE]
at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1109) ~[spring-context-5.2.7.RELEASE.jar:5.2.7.RELEASE]
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:869) ~[spring-context-5.2.7.RELEASE.jar:5.2.7.RELEASE]
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:551) ~[spring-context-5.2.7.RELEASE.jar:5.2.7.RELEASE]
at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:143) ~[spring-boot-2.3.1.RELEASE.jar:2.3.1.RELEASE]
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:758) [spring-boot-2.3.1.RELEASE.jar:2.3.1.RELEASE]
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:750) [spring-boot-2.3.1.RELEASE.jar:2.3.1.RELEASE]
at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:397) [spring-boot-2.3.1.RELEASE.jar:2.3.1.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:315) [spring-boot-2.3.1.RELEASE.jar:2.3.1.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1237) [spring-boot-2.3.1.RELEASE.jar:2.3.1.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1226) [spring-boot-2.3.1.RELEASE.jar:2.3.1.RELEASE]
at com.mhanzouli.tutorial.TutorialApplication.main(TutorialApplication.java:10) [classes/:na]
Caused by: org.flywaydb.core.internal.license.FlywayEditionUpgradeRequiredException: Flyway Pro Edition or MariaDB upgrade required: MariaDB 10.1 is no longer supported by Flyway Community Edition, but still supported by Flyway Pro Edition.
at org.flywaydb.core.internal.database.base.Database.ensureDatabaseNotOlderThanOtherwiseRecommendUpgradeToFlywayEdition(Database.java:173) ~[flyway-core-6.4.4.jar:na]
at org.flywaydb.core.internal.database.mysql.MySQLDatabase.ensureSupported(MySQLDatabase.java:287) ~[flyway-core-6.4.4.jar:na]
at org.flywaydb.core.Flyway.execute(Flyway.java:514) ~[flyway-core-6.4.4.jar:na]
at org.flywaydb.core.Flyway.migrate(Flyway.java:159) ~[flyway-core-6.4.4.jar:na]
at org.springframework.boot.autoconfigure.flyway.FlywayMigrationInitializer.afterPropertiesSet(FlywayMigrationInitializer.java:65) ~[spring-boot-autoconfigure-2.3.1.RELEASE.jar:2.3.1.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1855) ~[spring-beans-5.2.7.RELEASE.jar:5.2.7.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1792) ~[spring-beans-5.2.7.RELEASE.jar:5.2.7.RELEASE]
... 19 common frames omitted
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 10.089 s
[INFO] Finished at: 2020-06-20T21:19:56+01:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.springframework.boot:spring-boot-maven-plugin:2.3.1.RELEASE:run (default-cli) on project tutorial: Application finished with exit code: 1 -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
The exception says "MariaDB 10.1 is no longer supported". Use newer version of Maria DB, e.g. the current version 10.5.3, and corresponding version of JDBC driver for it.

Connect with MSSQL with Spring Reactive (R2DBC), Error creating bean

I am currently trying to establish a database connection with a Microsoft SQL Server. Unfortunately I can not understand why it does not work. And the error message can unfortunately not give me precise information.
Starter Class
#ComponentScan({ "com.example.web", "com.example.repository", "com.example.config", "com.example.domain" })
#SpringBootApplication
public class R2Dbc3Application {
public static void main(String[] args) {
SpringApplication.run(R2Dbc3Application.class, args);
}
}
DatabaseConfiguration:
#Configuration
#EnableR2dbcRepositories("com.example.repository")
public class DatabaseConfiguration extends AbstractR2dbcConfiguration {
private final Logger log = LoggerFactory.getLogger(DatabaseConfiguration.class);
#Value("${spring.data.mssql.host}")
private String host;
#Value("${spring.data.mssql.database}")
private String database;
#Value("${spring.data.mssql.username}")
private String username;
#Value("${spring.data.mssql.password}")
private String password;
#Bean
#Override
public MssqlConnectionFactory connectionFactory() {
System.out.println("Connecting to database" + host);
return new MssqlConnectionFactory(MssqlConnectionConfiguration.builder()
.host(host)
.port(1453)
.database(database)
.username(username)
.password(password)
.build());
}
}
DatabaseInitializer:
#Component
public class DatabaseInitializer {
private final Logger log = LoggerFactory.getLogger(DatabaseInitializer.class);
#Autowired
PersonRepository personRepository;
public DatabaseInitializer(PersonRepository personRepository) {
this.personRepository = personRepository;
}
#PostConstruct
public void init() {
log.info("Initializing database if necessary");
personRepository.findAll().count().subscribe(count -> {
if (count == 0) {
log.info("Database is empty, inserting sample data");
createPerson("Josh", "Long", "Pivotal");
createPerson("Julien", "Dubois", "Microsoft");
} else {
log.info("Database is already initialized");
}
});
}
private void createPerson(String firstName, String lastName, String company) {
Person person = new Person();
person.setFirstName(firstName);
person.setLastName(lastName);
person.setCompany(company);
personRepository.save(person).log().subscribe();
}
}
Domain:
import org.springframework.data.annotation.Id;
import org.springframework.data.relational.core.mapping.Table;
#Table("person")
public class Person {
#Id
private Long id;
private String firstName;
private String lastName;
private String company;
// getter und setter
Repository:
#Repository
public interface PersonRepository extends ReactiveCrudRepository<Person, Long> {
}
Controller:
#RestController
public class PersonController {
private final PersonRepository personRepository;
public PersonController(PersonRepository personRepository) {
this.personRepository = personRepository;
}
#GetMapping(value = "/persons", produces = MediaType.TEXT_EVENT_STREAM_VALUE)
public Flux<Person> list() {
return personRepository.findAll();
}
}
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 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.2.6.RELEASE</version>
<relativePath /> <!-- lookup parent from repository -->
</parent>
<groupId>com.example</groupId>
<artifactId>R2DBC2</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>R2DBC2</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-webflux</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-r2dbc</artifactId>
<version>1.0.0.gh-151-SNAPSHOT</version>
</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>io.projectreactor</groupId>
<artifactId>reactor-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
<repositories>
<repository>
<id>spring-libs-snapshot</id>
<url>https://repo.spring.io/libs-snapshot</url>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
<repository>
<id>spring-milestones</id>
<name>Spring Milestones</name>
<url>https://repo.spring.io/milestone</url>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>spring-milestones</id>
<name>Spring Milestones</name>
<url>https://repo.spring.io/milestone</url>
</pluginRepository>
</pluginRepositories>
</project>
Error Message:
2020-05-25 10:23:35.193 INFO 22532 --- [ restartedMain] com.example.app.R2Dbc3Application : Starting R2Dbc3Application on 64LP0Z2 with PID 22532 (C:\tools\Spring-Tool-Suite\R2DBC3\target\classes started by kemal.sacirovic in C:\tools\Spring-Tool-Suite\R2DBC3)
2020-05-25 10:23:35.195 INFO 22532 --- [ restartedMain] com.example.app.R2Dbc3Application : No active profile set, falling back to default profiles: default
2020-05-25 10:23:35.236 INFO 22532 --- [ restartedMain] .e.DevToolsPropertyDefaultsPostProcessor : Devtools property defaults active! Set 'spring.devtools.add-properties' to 'false' to disable
2020-05-25 10:23:35.237 INFO 22532 --- [ restartedMain] .e.DevToolsPropertyDefaultsPostProcessor : For additional web related logging consider setting the 'logging.level.web' property to 'DEBUG'
2020-05-25 10:23:35.555 INFO 22532 --- [ restartedMain] .s.d.r.c.RepositoryConfigurationDelegate : Bootstrapping Spring Data R2DBC repositories in DEFAULT mode.
2020-05-25 10:23:35.588 INFO 22532 --- [ restartedMain] .s.d.r.c.RepositoryConfigurationDelegate : Finished Spring Data repository scanning in 30ms. Found 1 R2DBC repository interfaces.
Connecting to databasedbtbln01
2020-05-25 10:23:35.930 WARN 22532 --- [ restartedMain] onfigReactiveWebServerApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'personController' defined in file [C:\tools\Spring-Tool-Suite\R2DBC3\target\classes\com\example\web\PersonController.class]: Unsatisfied dependency expressed through constructor parameter 0; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'personRepository': Cannot resolve reference to bean 'databaseClient' while setting bean property 'databaseClient'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'databaseClient' defined in class path resource [com/example/config/DatabaseConfiguration.class]: Unsatisfied dependency expressed through method 'databaseClient' parameter 0; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'reactiveDataAccessStrategy' defined in class path resource [com/example/config/DatabaseConfiguration.class]: Unsatisfied dependency expressed through method 'reactiveDataAccessStrategy' parameter 0; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'r2dbcMappingContext' defined in class path resource [com/example/config/DatabaseConfiguration.class]: Unsatisfied dependency expressed through method 'r2dbcMappingContext' parameter 1; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'r2dbcCustomConversions' defined in class path resource [com/example/config/DatabaseConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.data.r2dbc.convert.R2dbcCustomConversions]: Factory method 'r2dbcCustomConversions' threw exception; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'connectionFactory' defined in class path resource [com/example/config/DatabaseConfiguration.class]: Post-processing of merged bean definition failed; nested exception is java.lang.IllegalStateException: Failed to introspect Class [io.r2dbc.mssql.MssqlConnectionFactory] from ClassLoader [sun.misc.Launcher$AppClassLoader#764c12b6]
2020-05-25 10:23:35.947 INFO 22532 --- [ restartedMain] ConditionEvaluationReportLoggingListener :
Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
2020-05-25 10:23:35.956 ERROR 22532 --- [ restartedMain] o.s.boot.SpringApplication : Application run failed
org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'personController' defined in file [C:\tools\Spring-Tool-Suite\R2DBC3\target\classes\com\example\web\PersonController.class]: Unsatisfied dependency expressed through constructor parameter 0; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'personRepository': Cannot resolve reference to bean 'databaseClient' while setting bean property 'databaseClient'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'databaseClient' defined in class path resource [com/example/config/DatabaseConfiguration.class]: Unsatisfied dependency expressed through method 'databaseClient' parameter 0; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'reactiveDataAccessStrategy' defined in class path resource [com/example/config/DatabaseConfiguration.class]: Unsatisfied dependency expressed through method 'reactiveDataAccessStrategy' parameter 0; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'r2dbcMappingContext' defined in class path resource [com/example/config/DatabaseConfiguration.class]: Unsatisfied dependency expressed through method 'r2dbcMappingContext' parameter 1; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'r2dbcCustomConversions' defined in class path resource [com/example/config/DatabaseConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.data.r2dbc.convert.R2dbcCustomConversions]: Factory method 'r2dbcCustomConversions' threw exception; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'connectionFactory' defined in class path resource [com/example/config/DatabaseConfiguration.class]: Post-processing of merged bean definition failed; nested exception is java.lang.IllegalStateException: Failed to introspect Class [io.r2dbc.mssql.MssqlConnectionFactory] from ClassLoader [sun.misc.Launcher$AppClassLoader#764c12b6]
at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:798) ~[spring-beans-5.2.5.RELEASE.jar:5.2.5.RELEASE]
at org.springframework.beans.factory.support.ConstructorResolver.autowireConstructor(ConstructorResolver.java:228) ~[spring-beans-5.2.5.RELEASE.jar:5.2.5.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireConstructor(AbstractAutowireCapableBeanFactory.java:1358) ~[spring-beans-5.2.5.RELEASE.jar:5.2.5.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1204) ~[spring-beans-5.2.5.RELEASE.jar:5.2.5.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:557) ~[spring-beans-5.2.5.RELEASE.jar:5.2.5.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:517) ~[spring-beans-5.2.5.RELEASE.jar:5.2.5.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:323) ~[spring-beans-5.2.5.RELEASE.jar:5.2.5.RELEASE]
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222) ~[spring-beans-5.2.5.RELEASE.jar:5.2.5.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:321) ~[spring-beans-5.2.5.RELEASE.jar:5.2.5.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:202) ~[spring-beans-5.2.5.RELEASE.jar:5.2.5.RELEASE]
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:882) ~[spring-beans-5.2.5.RELEASE.jar:5.2.5.RELEASE]
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:878) ~[spring-context-5.2.5.RELEASE.jar:5.2.5.RELEASE]
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:550) ~[spring-context-5.2.5.RELEASE.jar:5.2.5.RELEASE]
at org.springframework.boot.web.reactive.context.ReactiveWebServerApplicationContext.refresh(ReactiveWebServerApplicationContext.java:66) ~[spring-boot-2.2.6.RELEASE.jar:2.2.6.RELEASE]
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:747) [spring-boot-2.2.6.RELEASE.jar:2.2.6.RELEASE]
at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:397) [spring-boot-2.2.6.RELEASE.jar:2.2.6.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:315) [spring-boot-2.2.6.RELEASE.jar:2.2.6.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1226) [spring-boot-2.2.6.RELEASE.jar:2.2.6.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1215) [spring-boot-2.2.6.RELEASE.jar:2.2.6.RELEASE]
at com.example.app.R2Dbc3Application.main(R2Dbc3Application.java:13) [classes/:na]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_212]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_212]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_212]
at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_212]
Please add a bean for DatabaseClient, like below
#Autowired
private ConnectionFactory connectionFactory;
#Bean
public DatabaseClient databaseClient() {
return create(connectionFactory);
}
To reduce the no of classes, you can remove the DatabaseConfiguration class and add below to you application.properties, Spring will take care of creating connectionFactory
server.port=
spring.r2dbc.url=r2dbc:mssql:/<host>/<db-name>
spring.r2dbc.username=
spring.r2dbc.password=
spring.r2dbc.initialization-mode=always
spring.main.web-application-type=reactive

errors starting a simple spring boot application

Im trying to run a simple spring boot application, i have filled the application.properties with appropriate parameters to creat a datasource based on jpa and mysql configuration, and i have specified in the pom.xml some of the dependencies that my application may require in order to run, but i still get the same error when i start my application, here is my configuration files, i hope i can get some help here !
i want the application to create in my database the table using orm techonolgy for the begining but im stuck with these errors !!
pom.xml file
http://maven.apache.org/xsd/maven-4.0.0.xsd">
4.0.0
<groupId>objectExchange</groupId>
<artifactId>exchange</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>
<name>objectExchange</name>
<description>ObjectExchange Spring Boot</description>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.4.1.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.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>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>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
the application.properties file
spring.datasource.url = jdbc:mysql://localhost:3306/db_objexchange
spring.datasource.username = root
spring.datasource.password =
spring.datasource.driverClassName = com.mysql.jdbc.Driver
spring.jpa.database = MYSQL
spring.jpa.show-sql = true
spring.jpa.hibernate.ddl-auto = update
spring.jpa.hibernate.naming-strategy=org.hibernate.cfg.ImprovedNamingStrategy
spring.jpa.properties.hibernate.dialect = org.hibernate.dialect.MySQL5Dialect
the application file :
package com;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
#SpringBootApplication
public class ObjectExchangeApplication {
public static void main(String[] args) {
SpringApplication.run(ObjectExchangeApplication.class, args);
}
}
the class for persistance with jpa
package com.entities;
import java.io.Serializable;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
#Entity
public class utilisateur implements Serializable {
#Id
#GeneratedValue
private Long id;
private String nom;
private String prenom;
public utilisateur() {
super();
}
public utilisateur(Long id, String nom, String prenom) {
super();
this.id = id;
this.nom = nom;
this.prenom = prenom;
}
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getNom() {
return nom;
}
public void setNom(String nom) {
this.nom = nom;
}
public String getPrenom() {
return prenom;
}
public void setPrenom(String prenom) {
this.prenom = prenom;
}
}
this are the file i have on my application and i keep getting these errors :
:: Spring Boot :: (v1.4.1.RELEASE)
2016-09-25 19:59:02.908 INFO 4952 --- [ main] com.ObjectExchangeApplication : Starting ObjectExchangeApplication on user-PC with PID 4952 (C:\Users\user\workspace\objectExchange\target\classes started by user in C:\Users\user\workspace\objectExchange)
2016-09-25 19:59:02.918 INFO 4952 --- [ main] com.ObjectExchangeApplication : No active profile set, falling back to default profiles: default
2016-09-25 19:59:03.277 INFO 4952 --- [ main] ationConfigEmbeddedWebApplicationContext : Refreshing org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext#1eb5ee5: startup date [Sun Sep 25 19:59:03 WEST 2016]; root of context hierarchy
2016-09-25 19:59:05.193 WARN 4952 --- [ main] ationConfigEmbeddedWebApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanDefinitionStoreException: Failed to read candidate component class: URL [jar:file:/C:/Users/user/.m2/repository/mysql/mysql-connector-java/5.1.39/mysql-connector-java-5.1.39.jar!/com/mysql/fabric/FabricCommunicationException.class]; nested exception is java.util.zip.ZipException: invalid LOC header (bad signature)
2016-09-25 19:59:05.284 ERROR 4952 --- [ main] o.s.boot.SpringApplication : Application startup failed
org.springframework.beans.factory.BeanDefinitionStoreException: Failed to read candidate component class: URL [jar:file:/C:/Users/user/.m2/repository/mysql/mysql-connector-java/5.1.39/mysql-connector-java-5.1.39.jar!/com/mysql/fabric/FabricCommunicationException.class]; nested exception is java.util.zip.ZipException: invalid LOC header (bad signature)
at org.springframework.context.annotation.ClassPathScanningCandidateComponentProvider.findCandidateComponents(ClassPathScanningCandidateComponentProvider.java:303) ~[spring-context-4.3.3.RELEASE.jar:4.3.3.RELEASE]
at org.springframework.context.annotation.ClassPathBeanDefinitionScanner.doScan(ClassPathBeanDefinitionScanner.java:248) ~[spring-context-4.3.3.RELEASE.jar:4.3.3.RELEASE]
at org.springframework.context.annotation.ComponentScanAnnotationParser.parse(ComponentScanAnnotationParser.java:137) ~[spring-context-4.3.3.RELEASE.jar:4.3.3.RELEASE]
at org.springframework.context.annotation.ConfigurationClassParser.doProcessConfigurationClass(ConfigurationClassParser.java:275) ~[spring-context-4.3.3.RELEASE.jar:4.3.3.RELEASE]
at org.springframework.context.annotation.ConfigurationClassParser.processConfigurationClass(ConfigurationClassParser.java:237) ~[spring-context-4.3.3.RELEASE.jar:4.3.3.RELEASE]
at org.springframework.context.annotation.ConfigurationClassParser.parse(ConfigurationClassParser.java:204) ~[spring-context-4.3.3.RELEASE.jar:4.3.3.RELEASE]
at org.springframework.context.annotation.ConfigurationClassParser.parse(ConfigurationClassParser.java:173) ~[spring-context-4.3.3.RELEASE.jar:4.3.3.RELEASE]
at org.springframework.context.annotation.ConfigurationClassPostProcessor.processConfigBeanDefinitions(ConfigurationClassPostProcessor.java:324) ~[spring-context-4.3.3.RELEASE.jar:4.3.3.RELEASE]
at org.springframework.context.annotation.ConfigurationClassPostProcessor.postProcessBeanDefinitionRegistry(ConfigurationClassPostProcessor.java:246) ~[spring-context-4.3.3.RELEASE.jar:4.3.3.RELEASE]
at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanDefinitionRegistryPostProcessors(PostProcessorRegistrationDelegate.java:273) ~[spring-context-4.3.3.RELEASE.jar:4.3.3.RELEASE]
at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanFactoryPostProcessors(PostProcessorRegistrationDelegate.java:98) ~[spring-context-4.3.3.RELEASE.jar:4.3.3.RELEASE]
at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:681) ~[spring-context-4.3.3.RELEASE.jar:4.3.3.RELEASE]
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:523) ~[spring-context-4.3.3.RELEASE.jar:4.3.3.RELEASE]
at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:122) ~[spring-boot-1.4.1.RELEASE.jar:1.4.1.RELEASE]
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:761) [spring-boot-1.4.1.RELEASE.jar:1.4.1.RELEASE]
at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:371) [spring-boot-1.4.1.RELEASE.jar:1.4.1.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:315) [spring-boot-1.4.1.RELEASE.jar:1.4.1.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1186) [spring-boot-1.4.1.RELEASE.jar:1.4.1.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1175) [spring-boot-1.4.1.RELEASE.jar:1.4.1.RELEASE]
at com.ObjectExchangeApplication.main(ObjectExchangeApplication.java:10) [classes/:na]
Caused by: java.util.zip.ZipException: invalid LOC header (bad signature)
at java.util.zip.ZipFile.read(Native Method) ~[na:1.8.0_92]
at java.util.zip.ZipFile.access$1400(Unknown Source) ~[na:1.8.0_92]
at java.util.zip.ZipFile$ZipFileInputStream.read(Unknown Source) ~[na:1.8.0_92]
at java.util.zip.ZipFile$ZipFileInflaterInputStream.fill(Unknown Source) ~[na:1.8.0_92]
at java.util.zip.InflaterInputStream.read(Unknown Source) ~[na:1.8.0_92]
at java.io.FilterInputStream.read(Unknown Source) ~[na:1.8.0_92]
at java.io.BufferedInputStream.fill(Unknown Source) ~[na:1.8.0_92]
at java.io.BufferedInputStream.read1(Unknown Source) ~[na:1.8.0_92]
at java.io.BufferedInputStream.read(Unknown Source) ~[na:1.8.0_92]
at org.springframework.asm.ClassReader.readClass(ClassReader.java:463) ~[spring-core-4.3.3.RELEASE.jar:4.3.3.RELEASE]
at org.springframework.asm.ClassReader.<init>(ClassReader.java:426) ~[spring-core-4.3.3.RELEASE.jar:4.3.3.RELEASE]
at org.springframework.core.type.classreading.SimpleMetadataReader.<init>(SimpleMetadataReader.java:53) ~[spring-core-4.3.3.RELEASE.jar:4.3.3.RELEASE]
at org.springframework.core.type.classreading.SimpleMetadataReaderFactory.getMetadataReader(SimpleMetadataReaderFactory.java:98) ~[spring-core-4.3.3.RELEASE.jar:4.3.3.RELEASE]
at org.springframework.core.type.classreading.CachingMetadataReaderFactory.getMetadataReader(CachingMetadataReaderFactory.java:102) ~[spring-core-4.3.3.RELEASE.jar:4.3.3.RELEASE]
at org.springframework.context.annotation.ClassPathScanningCandidateComponentProvider.findCandidateComponents(ClassPathScanningCandidateComponentProvider.java:279) ~[spring-context-4.3.3.RELEASE.jar:4.3.3.RELEASE]
... 19 common frames omitted
I really hope i can get some help as soon as possible, and thank you all so much !!
Your error is this:
Failed to read candidate component class: URL
[jar:file:/C:/Users/user/.m2/repository/mysql/mysql-connector-java/5.1.39/mysql-connector-java-5.1.39.jar!/com/mysql/fabric/FabricCommunicationException.class];
nested exception is java.util.zip.ZipException: invalid LOC header
(bad signature)
This suggests that mysql-connector-java-5.1.39.jar is corrupt.
Solution
Remove C:/Users/user/.m2/repository (or at the very least C:/Users/user/.m2/repository/mysql/mysql-connector-java/).
This will force maven to redownload mysql-connector-java's jar when you rebuild (ie: mvn clean install).
Include the dependency
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
instead of
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>
in your POM.xml
Another issue could be the mysql jar located in your .m2 folder. Try to delete the jar file, update your pom.xml and try again.
Working on project I stumble upon the not exact, but rather similar error.
Caused by: org.apache.ignite.IgniteCheckedException: Failed to find configuration in: org.springframework.boot.loader.jar.ZipInflaterInputStream#...
In my case the real reason for such error was removing one parameter inside SpringBoot configuration XML file. I don't see real reason for error but fact is....
Correct config runs without errors is below:
<beans profile="local,default">
<bean class="org.apache.ignite.configuration.IgniteConfiguration">
The incorrect configuration causing the same error was removed 'default' param:
<beans profile="local">
<bean class="org.apache.ignite.configuration.IgniteConfiguration">
The last configuration was caused the same error on SpringBott app start-up.
The configuration parameters in my case are related to Apache Ignite. Cleaning up /.m2/ and Gradle cache folders didn't help.
As one more solution can be running application with specifying explicit Spring profile like:
java -jar -Dspring.profiles.active=local xxx_YOUR_FAT_JAR-FILE.jar

how to add persistence xml files in spring boot

I am trying to add spring boot to an existing project that i have. Earlier i had an application context xml file and 4 persistence files along with 3 separate properties files. I used #ImportResource feature of spring to import all the files at once in my application class below #SpringApplication annotation. The code looks like:
#SpringBootApplication
#ComponentScan({"service","web"})
#ImportResource( { "classpath:applicationContext.xml", "classpath:archive-ticket-persistence.xml", "classpath:rest.properties", "classpath:complete-ticket-persistence.xml", "classpath:datasource.properties", "classpath:ticket-persistence.xml", "classpath:user-persistence.xml" } )
public class Application {
public static void main(String[] args) {
SpringApplication.run(Application.class, args);
}
}
I keep getting this error message every single time i run the application
2015-08-14 12:46:53.658 INFO 6012 --- [ main] Application : Starting Application on squraishi with PID 6012 (C:\Development\newworkspace\Em7Demo\target\classes started by Administrator in C:\Development\newworkspace\Em7Demo)
2015-08-14 12:46:53.721 INFO 6012 --- [ main] ationConfigEmbeddedWebApplicationContext : Refreshing org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext#6056677a: startup date [Fri Aug 14 12:46:53 EDT 2015]; root of context hierarchy
2015-08-14 12:46:55.125 INFO 6012 --- [ main] o.s.b.f.xml.XmlBeanDefinitionReader : Loading XML bean definitions from class path resource [applicationContext.xml]
2015-08-14 12:46:55.313 INFO 6012 --- [ main] o.s.b.f.xml.XmlBeanDefinitionReader : Loading XML bean definitions from class path resource [archive-ticket-persistence.xml]
2015-08-14 12:46:56.046 WARN 6012 --- [ main] ationConfigEmbeddedWebApplicationContext : Exception encountered during context initialization - cancelling refresh attempt
org.springframework.beans.factory.parsing.BeanDefinitionParsingException: Configuration problem: Unable to locate Spring NamespaceHandler for XML schema namespace [http://java.sun.com/xml/ns/persistence]
Offending resource: class path resource [archive-ticket-persistence.xml]
at org.springframework.beans.factory.parsing.FailFastProblemReporter.error(FailFastProblemReporter.java:70)
at org.springframework.beans.factory.parsing.ReaderContext.error(ReaderContext.java:85)
at org.springframework.beans.factory.parsing.ReaderContext.error(ReaderContext.java:80)
at org.springframework.beans.factory.xml.BeanDefinitionParserDelegate.error(BeanDefinitionParserDelegate.java:316)
at org.springframework.beans.factory.xml.BeanDefinitionParserDelegate.parseCustomElement(BeanDefinitionParserDelegate.java:1424)
at org.springframework.beans.factory.xml.BeanDefinitionParserDelegate.parseCustomElement(BeanDefinitionParserDelegate.java:1417)
at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.parseBeanDefinitions(DefaultBeanDefinitionDocumentReader.java:180)
at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.doRegisterBeanDefinitions(DefaultBeanDefinitionDocumentReader.java:144)
at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.registerBeanDefinitions(DefaultBeanDefinitionDocumentReader.java:100)
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.registerBeanDefinitions(XmlBeanDefinitionReader.java:510)
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:392)
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:336)
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:304)
at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:181)
at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:217)
at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:188)
at org.springframework.context.annotation.ConfigurationClassBeanDefinitionReader.loadBeanDefinitionsFromImportedResources(ConfigurationClassBeanDefinitionReader.java:347)
at org.springframework.context.annotation.ConfigurationClassBeanDefinitionReader.loadBeanDefinitionsForConfigurationClass(ConfigurationClassBeanDefinitionReader.java:150)
at org.springframework.context.annotation.ConfigurationClassBeanDefinitionReader.loadBeanDefinitions(ConfigurationClassBeanDefinitionReader.java:124)
at org.springframework.context.annotation.ConfigurationClassPostProcessor.processConfigBeanDefinitions(ConfigurationClassPostProcessor.java:318)
at org.springframework.context.annotation.ConfigurationClassPostProcessor.postProcessBeanDefinitionRegistry(ConfigurationClassPostProcessor.java:239)
at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanDefinitionRegistryPostProcessors(PostProcessorRegistrationDelegate.java:254)
at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanFactoryPostProcessors(PostProcessorRegistrationDelegate.java:94)
at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:606)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:462)
at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:118)
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:686)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:320)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:957)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:946)
at Application.main(Application.java:12)
2015-08-14 12:46:56.046 INFO 6012 --- [ main] .b.l.ClasspathLoggingApplicationListener : Application failed to start with classpath: [file:/C:/Development/newworkspace/Em7Demo/target/classes/, file:/C:/Users/Administrator/.m2/repository/com/hostedsolutions/portal/common/1.0-SNAPSHOT/common-1.0-SNAPSHOT.jar, file:/C:/Users/Administrator/.m2/repository/org/springframework/boot/spring-boot-starter-data-rest/1.2.5.RELEASE/spring-boot-starter-data-rest-1.2.5.RELEASE.jar, file:/C:/Users/Administrator/.m2/repository/org/springframework/boot/spring-boot-starter/1.2.5.RELEASE/spring-boot-starter-1.2.5.RELEASE.jar, file:/C:/Users/Administrator/.m2/repository/org/springframework/boot/spring-boot/1.2.5.RELEASE/spring-boot-1.2.5.RELEASE.jar, file:/C:/Users/Administrator/.m2/repository/org/springframework/boot/spring-boot-autoconfigure/1.2.5.RELEASE/spring-boot-autoconfigure-1.2.5.RELEASE.jar, file:/C:/Users/Administrator/.m2/repository/org/springframework/boot/spring-boot-starter-logging/1.2.5.RELEASE/spring-boot-starter-logging-1.2.5.RELEASE.jar, file:/C:/Users/Administrator/.m2/repository/org/slf4j/jul-to-slf4j/1.7.12/jul-to-slf4j-1.7.12.jar, file:/C:/Users/Administrator/.m2/repository/org/slf4j/log4j-over-slf4j/1.7.12/log4j-over-slf4j-1.7.12.jar, file:/C:/Users/Administrator/.m2/repository/ch/qos/logback/logback-classic/1.1.3/logback-classic-1.1.3.jar, file:/C:/Users/Administrator/.m2/repository/ch/qos/logback/logback-core/1.1.3/logback-core-1.1.3.jar, file:/C:/Users/Administrator/.m2/repository/org/yaml/snakeyaml/1.14/snakeyaml-1.14.jar, file:/C:/Users/Administrator/.m2/repository/com/fasterxml/jackson/core/jackson-annotations/2.4.6/jackson-annotations-2.4.6.jar, file:/C:/Users/Administrator/.m2/repository/com/fasterxml/jackson/core/jackson-databind/2.4.6/jackson-databind-2.4.6.jar, file:/C:/Users/Administrator/.m2/repository/com/fasterxml/jackson/core/jackson-core/2.4.6/jackson-core-2.4.6.jar, file:/C:/Users/Administrator/.m2/repository/org/springframework/spring-core/4.1.7.RELEASE/spring-core-4.1.7.RELEASE.jar, file:/C:/Users/Administrator/.m2/repository/org/springframework/spring-tx/4.1.7.RELEASE/spring-tx-4.1.7.RELEASE.jar, file:/C:/Users/Administrator/.m2/repository/org/springframework/data/spring-data-rest-webmvc/2.2.3.RELEASE/spring-data-rest-webmvc-2.2.3.RELEASE.jar, file:/C:/Users/Administrator/.m2/repository/org/springframework/data/spring-data-rest-core/2.2.3.RELEASE/spring-data-rest-core-2.2.3.RELEASE.jar, file:/C:/Users/Administrator/.m2/repository/org/springframework/hateoas/spring-hateoas/0.16.0.RELEASE/spring-hateoas-0.16.0.RELEASE.jar, file:/C:/Users/Administrator/.m2/repository/org/springframework/plugin/spring-plugin-core/1.1.0.RELEASE/spring-plugin-core-1.1.0.RELEASE.jar, file:/C:/Users/Administrator/.m2/repository/org/atteo/evo-inflector/1.2/evo-inflector-1.2.jar, file:/C:/Users/Administrator/.m2/repository/com/github/fge/json-patch/1.7/json-patch-1.7.jar, file:/C:/Users/Administrator/.m2/repository/com/github/fge/jackson-coreutils/1.6/jackson-coreutils-1.6.jar, file:/C:/Users/Administrator/.m2/repository/com/github/fge/msg-simple/1.1/msg-simple-1.1.jar, file:/C:/Users/Administrator/.m2/repository/com/github/fge/btf/1.2/btf-1.2.jar, file:/C:/Users/Administrator/.m2/repository/com/google/guava/guava/16.0.1/guava-16.0.1.jar, file:/C:/Users/Administrator/.m2/repository/com/google/code/findbugs/jsr305/2.0.1/jsr305-2.0.1.jar, file:/C:/Users/Administrator/.m2/repository/org/slf4j/slf4j-api/1.7.12/slf4j-api-1.7.12.jar, file:/C:/Users/Administrator/.m2/repository/org/slf4j/jcl-over-slf4j/1.7.12/jcl-over-slf4j-1.7.12.jar, file:/C:/Users/Administrator/.m2/repository/org/springframework/boot/spring-boot-starter-data-jpa/1.2.5.RELEASE/spring-boot-starter-data-jpa-1.2.5.RELEASE.jar, file:/C:/Users/Administrator/.m2/repository/org/springframework/boot/spring-boot-starter-aop/1.2.5.RELEASE/spring-boot-starter-aop-1.2.5.RELEASE.jar, file:/C:/Users/Administrator/.m2/repository/org/aspectj/aspectjrt/1.8.6/aspectjrt-1.8.6.jar, file:/C:/Users/Administrator/.m2/repository/org/aspectj/aspectjweaver/1.8.6/aspectjweaver-1.8.6.jar, file:/C:/Users/Administrator/.m2/repository/org/springframework/boot/spring-boot-starter-jdbc/1.2.5.RELEASE/spring-boot-starter-jdbc-1.2.5.RELEASE.jar, file:/C:/Users/Administrator/.m2/repository/org/springframework/spring-jdbc/4.1.7.RELEASE/spring-jdbc-4.1.7.RELEASE.jar, file:/C:/Users/Administrator/.m2/repository/org/apache/tomcat/tomcat-jdbc/8.0.23/tomcat-jdbc-8.0.23.jar, file:/C:/Users/Administrator/.m2/repository/org/apache/tomcat/tomcat-juli/8.0.23/tomcat-juli-8.0.23.jar, file:/C:/Users/Administrator/.m2/repository/org/hibernate/hibernate-entitymanager/4.3.10.Final/hibernate-entitymanager-4.3.10.Final.jar, file:/C:/Users/Administrator/.m2/repository/org/jboss/logging/jboss-logging/3.1.3.GA/jboss-logging-3.1.3.GA.jar, file:/C:/Users/Administrator/.m2/repository/org/jboss/logging/jboss-logging-annotations/1.2.0.Beta1/jboss-logging-annotations-1.2.0.Beta1.jar, file:/C:/Users/Administrator/.m2/repository/org/hibernate/hibernate-core/4.3.10.Final/hibernate-core-4.3.10.Final.jar, file:/C:/Users/Administrator/.m2/repository/antlr/antlr/2.7.7/antlr-2.7.7.jar, file:/C:/Users/Administrator/.m2/repository/org/jboss/jandex/1.1.0.Final/jandex-1.1.0.Final.jar, file:/C:/Users/Administrator/.m2/repository/dom4j/dom4j/1.6.1/dom4j-1.6.1.jar, file:/C:/Users/Administrator/.m2/repository/xml-apis/xml-apis/1.0.b2/xml-apis-1.0.b2.jar, file:/C:/Users/Administrator/.m2/repository/org/hibernate/common/hibernate-commons-annotations/4.0.5.Final/hibernate-commons-annotations-4.0.5.Final.jar, file:/C:/Users/Administrator/.m2/repository/org/hibernate/javax/persistence/hibernate-jpa-2.1-api/1.0.0.Final/hibernate-jpa-2.1-api-1.0.0.Final.jar, file:/C:/Users/Administrator/.m2/repository/org/javassist/javassist/3.18.1-GA/javassist-3.18.1-GA.jar, file:/C:/Users/Administrator/.m2/repository/javax/transaction/javax.transaction-api/1.2/javax.transaction-api-1.2.jar, file:/C:/Users/Administrator/.m2/repository/org/springframework/spring-orm/4.1.7.RELEASE/spring-orm-4.1.7.RELEASE.jar, file:/C:/Users/Administrator/.m2/repository/org/springframework/data/spring-data-jpa/1.7.3.RELEASE/spring-data-jpa-1.7.3.RELEASE.jar, file:/C:/Users/Administrator/.m2/repository/org/springframework/data/spring-data-commons/1.9.3.RELEASE/spring-data-commons-1.9.3.RELEASE.jar, file:/C:/Users/Administrator/.m2/repository/org/springframework/spring-aspects/4.1.7.RELEASE/spring-aspects-4.1.7.RELEASE.jar, file:/C:/Users/Administrator/.m2/repository/org/springframework/boot/spring-boot-starter-security/1.2.5.RELEASE/spring-boot-starter-security-1.2.5.RELEASE.jar, file:/C:/Users/Administrator/.m2/repository/org/springframework/spring-beans/4.1.7.RELEASE/spring-beans-4.1.7.RELEASE.jar, file:/C:/Users/Administrator/.m2/repository/org/springframework/spring-context/4.1.7.RELEASE/spring-context-4.1.7.RELEASE.jar, file:/C:/Users/Administrator/.m2/repository/org/springframework/spring-expression/4.1.7.RELEASE/spring-expression-4.1.7.RELEASE.jar, file:/C:/Users/Administrator/.m2/repository/org/springframework/spring-web/4.1.7.RELEASE/spring-web-4.1.7.RELEASE.jar, file:/C:/Users/Administrator/.m2/repository/org/springframework/security/spring-security-config/3.2.7.RELEASE/spring-security-config-3.2.7.RELEASE.jar, file:/C:/Users/Administrator/.m2/repository/aopalliance/aopalliance/1.0/aopalliance-1.0.jar, file:/C:/Users/Administrator/.m2/repository/org/springframework/security/spring-security-core/3.2.7.RELEASE/spring-security-core-3.2.7.RELEASE.jar, file:/C:/Users/Administrator/.m2/repository/org/springframework/security/spring-security-web/3.2.7.RELEASE/spring-security-web-3.2.7.RELEASE.jar, file:/C:/Users/Administrator/.m2/repository/org/springframework/spring-aop/4.1.7.RELEASE/spring-aop-4.1.7.RELEASE.jar, file:/C:/Users/Administrator/.m2/repository/org/springframework/boot/spring-boot-starter-web/1.2.5.RELEASE/spring-boot-starter-web-1.2.5.RELEASE.jar, file:/C:/Users/Administrator/.m2/repository/org/hibernate/hibernate-validator/5.1.3.Final/hibernate-validator-5.1.3.Final.jar, file:/C:/Users/Administrator/.m2/repository/com/fasterxml/classmate/1.0.0/classmate-1.0.0.jar, file:/C:/Users/Administrator/.m2/repository/org/springframework/spring-webmvc/4.1.7.RELEASE/spring-webmvc-4.1.7.RELEASE.jar, file:/C:/Users/Administrator/.m2/repository/org/springframework/boot/spring-boot-starter-tomcat/1.2.5.RELEASE/spring-boot-starter-tomcat-1.2.5.RELEASE.jar, file:/C:/Users/Administrator/.m2/repository/org/apache/tomcat/embed/tomcat-embed-core/8.0.23/tomcat-embed-core-8.0.23.jar, file:/C:/Users/Administrator/.m2/repository/org/apache/tomcat/embed/tomcat-embed-el/8.0.23/tomcat-embed-el-8.0.23.jar, file:/C:/Users/Administrator/.m2/repository/org/apache/tomcat/embed/tomcat-embed-logging-juli/8.0.23/tomcat-embed-logging-juli-8.0.23.jar, file:/C:/Users/Administrator/.m2/repository/org/apache/tomcat/embed/tomcat-embed-websocket/8.0.23/tomcat-embed-websocket-8.0.23.jar, file:/C:/Users/Administrator/.m2/repository/junit/junit/4.12/junit-4.12.jar, file:/C:/Users/Administrator/.m2/repository/org/objenesis/objenesis/2.1/objenesis-2.1.jar, file:/C:/Users/Administrator/.m2/repository/org/hamcrest/hamcrest-core/1.3/hamcrest-core-1.3.jar, file:/C:/Users/Administrator/.m2/repository/org/springframework/org.springframework.jms/3.1.1.RELEASE/org.springframework.jms-3.1.1.RELEASE.jar, file:/C:/Users/Administrator/.m2/repository/org/aopalliance/com.springsource.org.aopalliance/1.0.0/com.springsource.org.aopalliance-1.0.0.jar, file:/C:/Users/Administrator/.m2/repository/org/springframework/org.springframework.aop/3.1.1.RELEASE/org.springframework.aop-3.1.1.RELEASE.jar, file:/C:/Users/Administrator/.m2/repository/org/springframework/org.springframework.beans/3.1.1.RELEASE/org.springframework.beans-3.1.1.RELEASE.jar, file:/C:/Users/Administrator/.m2/repository/org/springframework/org.springframework.asm/3.1.1.RELEASE/org.springframework.asm-3.1.1.RELEASE.jar, file:/C:/Users/Administrator/.m2/repository/org/springframework/org.springframework.context/3.1.1.RELEASE/org.springframework.context-3.1.1.RELEASE.jar, file:/C:/Users/Administrator/.m2/repository/org/springframework/org.springframework.expression/3.1.1.RELEASE/org.springframework.expression-3.1.1.RELEASE.jar, file:/C:/Users/Administrator/.m2/repository/org/springframework/org.springframework.core/3.1.1.RELEASE/org.springframework.core-3.1.1.RELEASE.jar, file:/C:/Users/Administrator/.m2/repository/org/springframework/org.springframework.transaction/3.1.1.RELEASE/org.springframework.transaction-3.1.1.RELEASE.jar, file:/C:/Users/Administrator/.m2/repository/javax/mail/mail/1.4.1/mail-1.4.1.jar, file:/C:/Users/Administrator/.m2/repository/javax/activation/activation/1.1/activation-1.1.jar, file:/C:/Users/Administrator/.m2/repository/org/jsoup/jsoup/1.3.2/jsoup-1.3.2.jar, file:/C:/Users/Administrator/.m2/repository/org/springframework/org.springframework.context.support/3.1.1.RELEASE/org.springframework.context.support-3.1.1.RELEASE.jar, file:/C:/Users/Administrator/.m2/repository/org/apache/geronimo/specs/geronimo-jms_1.1_spec/1.1.1/geronimo-jms_1.1_spec-1.1.1.jar, file:/C:/Users/Administrator/.m2/repository/org/springframework/org.springframework.orm/3.1.1.RELEASE/org.springframework.orm-3.1.1.RELEASE.jar, file:/C:/Users/Administrator/.m2/repository/org/springframework/org.springframework.jdbc/3.1.1.RELEASE/org.springframework.jdbc-3.1.1.RELEASE.jar, file:/C:/Users/Administrator/.m2/repository/org/springframework/org.springframework.web.portlet/3.1.1.RELEASE/org.springframework.web.portlet-3.1.1.RELEASE.jar, file:/C:/Users/Administrator/.m2/repository/org/springframework/org.springframework.web.servlet/3.1.1.RELEASE/org.springframework.web.servlet-3.1.1.RELEASE.jar, file:/C:/Users/Administrator/.m2/repository/org/springframework/org.springframework.web/3.1.1.RELEASE/org.springframework.web-3.1.1.RELEASE.jar, file:/C:/Users/Administrator/.m2/repository/javax/servlet/jstl/1.2/jstl-1.2.jar, file:/C:/Users/Administrator/.m2/repository/com/google/gwt/gwt-servlet/2.4.0/gwt-servlet-2.4.0.jar, file:/C:/Users/Administrator/.m2/repository/org/sourceforge/gwt-widget/gwt-sl/1.0/gwt-sl-1.0.jar, file:/C:/Users/Administrator/.m2/repository/net/sourceforge/findbugs/annotations/1.3.2/annotations-1.3.2.jar, file:/C:/Users/Administrator/.m2/repository/org/springframework/spring-oxm/4.1.7.RELEASE/spring-oxm-4.1.7.RELEASE.jar, file:/C:/Users/Administrator/.m2/repository/commons-lang/commons-lang/2.5/commons-lang-2.5.jar, file:/C:/Users/Administrator/.m2/repository/commons-configuration/commons-configuration/1.6/commons-configuration-1.6.jar, file:/C:/Users/Administrator/.m2/repository/commons-collections/commons-collections/3.2.1/commons-collections-3.2.1.jar, file:/C:/Users/Administrator/.m2/repository/commons-digester/commons-digester/2.1/commons-digester-2.1.jar, file:/C:/Users/Administrator/.m2/repository/commons-beanutils/commons-beanutils/1.9.2/commons-beanutils-1.9.2.jar, file:/C:/Users/Administrator/.m2/repository/commons-beanutils/commons-beanutils-core/1.8.0/commons-beanutils-core-1.8.0.jar, file:/C:/Users/Administrator/.m2/repository/org/apache/httpcomponents/httpclient/4.3.6/httpclient-4.3.6.jar, file:/C:/Users/Administrator/.m2/repository/commons-codec/commons-codec/1.6/commons-codec-1.6.jar, file:/C:/Users/Administrator/.m2/repository/ca/juliusdavies/not-yet-commons-ssl/0.3.11/not-yet-commons-ssl-0.3.11.jar, file:/C:/Users/Administrator/.m2/repository/commons-httpclient/commons-httpclient/3.1/commons-httpclient-3.1.jar, file:/C:/Users/Administrator/.m2/repository/org/springframework/org.springframework.test/3.1.1.RELEASE/org.springframework.test-3.1.1.RELEASE.jar, file:/C:/Users/Administrator/.m2/repository/c3p0/c3p0/0.9.1/c3p0-0.9.1.jar, file:/C:/Users/Administrator/.m2/repository/org/codehaus/jackson/jackson-mapper-asl/1.9.1/jackson-mapper-asl-1.9.1.jar, file:/C:/Users/Administrator/.m2/repository/org/codehaus/jackson/jackson-core-asl/1.9.1/jackson-core-asl-1.9.1.jar, file:/C:/Users/Administrator/.m2/repository/org/apache/httpcomponents/httpcore/4.1.3/httpcore-4.1.3.jar, file:/C:/Users/Administrator/.m2/repository/commons-logging/commons-logging/1.1.1/commons-logging-1.1.1.jar, file:/C:/Users/Administrator/.m2/repository/commons-dbcp/commons-dbcp/1.4/commons-dbcp-1.4.jar, file:/C:/Users/Administrator/.m2/repository/commons-pool/commons-pool/1.6/commons-pool-1.6.jar]
2015-08-14 12:46:56.062 ERROR 6012 --- [ main] o.s.boot.SpringApplication : Application startup failed
so im thinking maybe the files that i added are not getting loaded at all. Am i doing something wrong? Can this be done in a better way? Please guide me as im new to spring boot.
EDIT: Adding pom as well
<?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>org.springframework</groupId>
<artifactId>Em7Demo</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>war</packaging>
<name>Demo</name>
<description>Demo project using Spring Boot</description>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.2.5.RELEASE</version>
<relativePath /> <!-- lookup parent from repository -->
</parent>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<java.version>1.7</java.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-security</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-tomcat</artifactId>
<scope>provided</scope>
</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>
<bean id="entityManagerFactory" class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">
<property name="persistenceXmlLocation" value="classpath:META-INF/persistence.xml" />
<property name="persistenceUnitName" value="PersistenceName" />
</bean>
<jpa:repositories base-package="your.packages.repositories" entity-manager-factory-ref="entityManagerFactory" transaction-manager-ref="transactionManager" />
<bean id="transactionManager" class="org.springframework.orm.jpa.JpaTransactionManager" >
<property name="entityManagerFactory" ref="entityManagerFactory" />
</bean>

Categories

Resources