vaadin / spring

Spring integration for Vaadin
https://vaadin.com/start
177 stars 101 forks source link

Can anyone please help me #1074

Closed cosmah closed 11 months ago

cosmah commented 1 year ago

There was an exception while trying to navigate to '' with the root cause 'org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type 'com.vaadincrm.application.backend.service.ContactService' available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {}' org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'com.vaadincrm.application.ui.MainView': Unsatisfied dependency expressed through constructor parameter 0: No qualifying bean of type 'com.vaadincrm.application.backend.service.ContactService' available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {} at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:801) at org.springframework.beans.factory.support.ConstructorResolver.autowireConstructor(ConstructorResolver.java:240) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireConstructor(AbstractAutowireCapableBeanFactory.java:1352) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1189) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:560) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:520) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:320) at com.vaadin.flow.spring.SpringInstantiator.getOrCreate(SpringInstantiator.java:126) at com.vaadin.flow.di.Instantiator.createRouteTarget(Instantiator.java:136) at com.vaadin.flow.router.internal.AbstractNavigationStateRenderer.lambda$getRouteTarget$1(AbstractNavigationStateRenderer.java:132) at java.base/java.util.Optional.orElseGet(Unknown Source) at com.vaadin.flow.router.internal.AbstractNavigationStateRenderer.getRouteTarget(AbstractNavigationStateRenderer.java:131) at com.vaadin.flow.router.internal.AbstractNavigationStateRenderer.sendBeforeEnterEventAndPopulateChain(AbstractNavigationStateRenderer.java:480) at com.vaadin.flow.router.internal.AbstractNavigationStateRenderer.createChainIfEmptyAndExecuteBeforeEnterNavigation(AbstractNavigationStateRenderer.java:461) at com.vaadin.flow.router.internal.AbstractNavigationStateRenderer.handle(AbstractNavigationStateRenderer.java:211) at com.vaadin.flow.component.internal.JavaScriptNavigationStateRenderer.handle(JavaScriptNavigationStateRenderer.java:78) at com.vaadin.flow.component.UI.handleNavigation(UI.java:1834) at com.vaadin.flow.component.UI.renderViewForRoute(UI.java:1797) at com.vaadin.flow.component.UI.connectClient(UI.java:1710) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.base/java.lang.reflect.Method.invoke(Unknown Source) at com.vaadin.flow.server.communication.rpc.PublishedServerEventHandlerRpcHandler.invokeMethod(PublishedServerEventHandlerRpcHandler.java:227) at com.vaadin.flow.server.communication.rpc.PublishedServerEventHandlerRpcHandler.invokeMethod(PublishedServerEventHandlerRpcHandler.java:204) at com.vaadin.flow.server.communication.rpc.PublishedServerEventHandlerRpcHandler.invokeMethod(PublishedServerEventHandlerRpcHandler.java:150) at com.vaadin.flow.server.communication.rpc.PublishedServerEventHandlerRpcHandler.handleNode(PublishedServerEventHandlerRpcHandler.java:133) at com.vaadin.flow.server.communication.rpc.AbstractRpcInvocationHandler.handle(AbstractRpcInvocationHandler.java:74) at com.vaadin.flow.server.communication.ServerRpcHandler.handleInvocationData(ServerRpcHandler.java:459) at com.vaadin.flow.server.communication.ServerRpcHandler.lambda$handleInvocations$2(ServerRpcHandler.java:440) at java.base/java.util.ArrayList.forEach(Unknown Source) at com.vaadin.flow.server.communication.ServerRpcHandler.handleInvocations(ServerRpcHandler.java:440) at com.vaadin.flow.server.communication.ServerRpcHandler.handleRpc(ServerRpcHandler.java:323) at com.vaadin.flow.server.communication.UidlRequestHandler.synchronizedHandleRequest(UidlRequestHandler.java:114) at com.vaadin.flow.server.SynchronizedRequestHandler.handleRequest(SynchronizedRequestHandler.java:40) at com.vaadin.flow.server.VaadinService.handleRequest(VaadinService.java:1522) at com.vaadin.flow.server.VaadinServlet.service(VaadinServlet.java:398) at com.vaadin.flow.spring.SpringServlet.service(SpringServlet.java:106) at jakarta.servlet.http.HttpServlet.service(HttpServlet.java:658) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:205) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:149) at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:642) at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:408) at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:313) at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:277) at org.springframework.web.servlet.mvc.ServletForwardingController.handleRequestInternal(ServletForwardingController.java:141) at org.springframework.web.servlet.mvc.AbstractController.handleRequest(AbstractController.java:178) at org.springframework.web.servlet.mvc.SimpleControllerHandlerAdapter.handle(SimpleControllerHandlerAdapter.java:51) at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:1081) at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:974) at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:1011) at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:914) at jakarta.servlet.http.HttpServlet.service(HttpServlet.java:590) at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:885) at jakarta.servlet.http.HttpServlet.service(HttpServlet.java:658) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:205) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:149) at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:51) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:174) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:149) at org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:100) at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:116) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:174) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:149) at org.springframework.web.filter.FormContentFilter.doFilterInternal(FormContentFilter.java:93) at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:116) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:174) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:149) at org.springframework.web.filter.ServerHttpObservationFilter.doFilterInternal(ServerHttpObservationFilter.java:109) at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:116) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:174) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:149) at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:201) at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:116) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:174) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:149) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:167) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:90) at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:482) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:115) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:93) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:74) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:340) at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:391) at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:63) at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:896) at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1744) at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:52) at org.apache.tomcat.util.threads.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1191) at org.apache.tomcat.util.threads.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:659) at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) at java.base/java.lang.Thread.run(Unknown Source) Caused by: org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type 'com.vaadincrm.application.backend.service.ContactService' available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {} at org.springframework.beans.factory.support.DefaultListableBeanFactory.raiseNoMatchingBeanFound(DefaultListableBeanFactory.java:1824) at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1383) at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1337) at org.springframework.beans.factory.support.ConstructorResolver.resolveAutowiredArgument(ConstructorResolver.java:910) at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:788)

mcollovati commented 1 year ago

Hi, the exception you see is telling you that your application is not providing the ContactService bean. The class is probably missing a @Service annotation.

Are you building the application from scratch, or is that code from some tutorial/example on the web?

cosmah commented 1 year ago

I'm learning Vaadin flow, so am flowing the tutorial pdf all annotations are there but still let me share the code and you have a look

cosmah commented 1 year ago
package com.vaadincrm.application.backend.entity;
import jakarta.persistence.*;
import jakarta.validation.constraints.*;

@Entity
public class Contact extends AbstractEntity implements Cloneable {
    public enum Status {
        ImportedLead, NotContacted, Contacted, Customer, ClosedLost
    }
    @NotNull
    @NotEmpty
    private String firstName = "";
    @NotNull
    @NotEmpty
    private String lastName = "";
    @ManyToOne
    @JoinColumn(name = "company_id")
    private Company company;
    @Enumerated(EnumType.STRING)
    @NotNull
    private Contact.Status status;
    @Email
    @NotNull
    @NotEmpty
    private String email = "";
    public String getEmail() {
        return email;
    }
    public void setEmail(String email) {
        this.email = email;
    }
    public Status getStatus() {
        return status;
    }
    public void setStatus(Status status) {
        this.status = status;
    }
    public String getLastName() {
        return lastName;
    }
    public void setLastName(String lastName) {
        this.lastName = lastName;
    }
    public String getFirstName() {
        return firstName;
    }
    public void setFirstName(String firstName) {
        this.firstName = firstName;
    }
    public void setCompany(Company company) {
        this.company = company;
    }
    public Company getCompany() {
        return company;
    }
    @Override
    public String toString() {
        return firstName + " " + lastName;
    }
}
cosmah commented 1 year ago
package com.vaadincrm.application;

import com.vaadin.flow.component.page.AppShellConfigurator;
import com.vaadin.flow.theme.Theme;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.ComponentScan;

/**
 * The entry point of the Spring Boot application.
 *
 * Use the @PWA annotation to make the application installable on phones, tablets,
 * and some desktop browsers.
 *
 */
@Theme(value = "vaadin.app")
@SpringBootApplication
@ComponentScan(basePackages = {
    "com.vaadincrm.application.backend.repository",
    "com.vaadincrm.application.backend.service",
    "com.vaadincrm.application.ui" // Add the package of MainView and other UI components
})
public class Application implements AppShellConfigurator {

    public static void main(String[] args) {
        SpringApplication.run(Application.class, args);
    }
}
cosmah commented 1 year ago
package com.vaadincrm.application.ui;

import com.vaadin.flow.component.button.Button;
import com.vaadin.flow.component.datepicker.DatePicker;
import com.vaadin.flow.component.grid.Grid;
import com.vaadin.flow.component.html.Paragraph;
import com.vaadin.flow.component.orderedlayout.HorizontalLayout;
import com.vaadin.flow.component.orderedlayout.VerticalLayout;
import com.vaadin.flow.router.Route;
import com.vaadincrm.application.backend.entity.Contact;
import com.vaadincrm.application.backend.service.ContactService;

//1. FIRST DEFINE ENTRY ROUTE
@Route("")
public class MainView extends VerticalLayout {
    private ContactService contactService;

    // Defines a new field grid and instantiates it to a Grid of type Contact
    private Grid<Contact> grid = new Grid<>(Contact.class);

    public MainView(ContactService contactService) {
        // Saves ContactService in a field, so you have easy access to it later
        this.contactService = contactService;
        // Gives the component a CSS class name to help with styling
        addClassName("list-view");
        // Calls setSizeFull() to make MainView take up the full size of the browser
        // window
        setSizeFull();
        // Splits the grid configuration into a separate method
        configureGrid();

        // Adds the grid to the main layout using the add(grid) method
        add(grid);
        // Creates a new method, updateList(), that fetches all contacts from the
        // service, and passes them to the grid.
        updateList();
    }

    private void configureGrid() {
        grid.addClassName("contact-grid");
        grid.setSizeFull();
        // Defines the properties of a Contact to shown using the grid.setColumns(..)
        // method.
        grid.setColumns("firstName", "lastName", "email", "status");
    }

    // ------TABLE-----
    private void updateList() {
        grid.setItems(contactService.findAll());
    }

}
cosmah commented 1 year ago

it started misbehaving after i added the mainview

mcollovati commented 1 year ago

Double check that the ContactService class is annotated with @Service or @Component

mcollovati commented 1 year ago

If the ContactService class is ok, you can try to add the settings suggested in the PDF you mentioned in the application.properties file

spring.devtools.restart.poll-interval=2s
spring.devtools.restart.quiet-period=1s

A quote from the PDF

image

mcollovati commented 1 year ago

If this also does not work, please share the project on GitHub or attach it to the ticker as a compressed zip file (remember to remove node_modules and target folders if present, before creating the compressed file)

cosmah commented 1 year ago

This is my contact service

package com.vaadincrm.application.backend.service;

import com.vaadincrm.application.backend.entity.Company; import com.vaadincrm.application.backend.entity.Contact; import com.vaadincrm.application.backend.repository.CompanyRepository; import com.vaadincrm.application.backend.repository.ContactRepository; import jakarta.annotation.PostConstruct; import org.springframework.stereotype.Service;

import java.util.List; import java.util.Random; import java.util.logging.Level; import java.util.logging.Logger; import java.util.stream.Collectors; import java.util.stream.Stream;

@Service public class ContactService { private static final Logger LOGGER = Logger.getLogger(ContactService.class.getName()); private ContactRepository contactRepository; private CompanyRepository companyRepository; public ContactService(ContactRepository contactRepository, CompanyRepository companyRepository){ this.contactRepository = contactRepository; this.companyRepository = companyRepository; }

public List<Contact> findAll(){
    return contactRepository.findAll();
}

public long count(){
    return contactRepository.count();
}

public void delete(Contact contact){
    contactRepository.delete(contact);
}

public void save(Contact contact){
    if (contact == null){
        LOGGER.log(Level.SEVERE,
                "Contact is null, Please reconnect");
        return;
    }
    contactRepository.save(contact);
}

//populate in data
@PostConstruct //this annotation tells spring to run this method after constructing ContactService
public void populateTestData() {
    if (companyRepository.count() == 0) {
        companyRepository.saveAll(
                Stream.of("Path-Way Electronics", "E-Tech Management", "Path-E-Tech Management")
                                .map(Company::new)
                                .collect(Collectors.toList()));
    }
    if (contactRepository.count() == 0) {
        Random r = new Random(0);
        List<Company> companies = companyRepository.findAll();
        contactRepository.saveAll(
                Stream.of("Gabrielle Patel", "Brian Robinson", "Eduardo Haugen",
                                "Koen Johansen", "Alejandro Macdonald", "Angel Karlsson", "Yahir Gustavsson", "Haiden Svensson",
                                "Emily Stewart", "Corinne Davis", "Ryann Davis", "Yurem Jackson",
                                "Kelly Gustavsson",
                                "Eileen Walker", "Katelyn Martin", "Israel Carlsson", "Quinn Hansson", "Makena Smith",
                                "Danielle Watson", "Leland Harris", "Gunner Karlsen", "Jamar Olsson ", "Lara Martin",
                                "Ann Andersson", "Remington Andersson", "Rene Carlsson", "Elvis Olsen", "Solomon Olsen",
                                "Jaydan Jackson", "Bernard Nilsen")
                        .map(name -> {
                            String[] split = name.split(" ");
                            Contact contact = new Contact();
                            contact.setFirstName(split[0]);
                            contact.setLastName(split[1]);
                            contact.setCompany(companies.get(r.nextInt(companies.size())));
                            contact.setStatus(Contact.Status.values()[r.nextInt(Contact
                                    .Status.values().length)]);
                            String email = (contact.getFirstName() + "." + contact
                                    .getLastName() + "@" + contact.getCompany().getName().replaceAll("[\\s-]", "") +
                                    ".com").toLowerCase();
                            contact.setEmail(email);
                            return contact;
                        }).collect(Collectors.toList()));
    }
}

}

cosmah commented 1 year ago

https://github.com/cosmah/my-app.git

cosmah commented 1 year ago

thats the link to the project

mcollovati commented 1 year ago

I got two issues in the project that prevents it from start:

  1. The spring-boot-starter-data-jpa dependency is defined only in the production profile, so the repository interfaces was not handled automatically. You have to move the dependency in the main dependencies section, and you can remove the jakarta.persistence-api and spring-data-jpa dependencies
  2. You should add a dependency for the JDBC driver for the database you plan to use and set the proper value for spring.datasource.url in application.properties.

With the above steps the application starts and I can the MainView with the grid with the data.

cosmah commented 1 year ago

Exclusions:

None

Unconditional classes:

org.springframework.boot.autoconfigure.context.ConfigurationPropertiesAutoConfiguration

org.springframework.boot.actuate.autoconfigure.availability.AvailabilityHealthContributorAutoConfiguration

org.springframework.boot.autoconfigure.ssl.SslAutoConfiguration

org.springframework.boot.actuate.autoconfigure.info.InfoContributorAutoConfiguration

org.springframework.boot.autoconfigure.context.PropertyPlaceholderAutoConfiguration

org.springframework.boot.autoconfigure.context.LifecycleAutoConfiguration

org.springframework.boot.actuate.autoconfigure.metrics.integration.IntegrationMetricsAutoConfiguration

org.springframework.boot.actuate.autoconfigure.endpoint.EndpointAutoConfiguration

com.vaadin.flow.spring.VaadinScopesConfig

org.springframework.boot.actuate.autoconfigure.web.server.ManagementContextAutoConfiguration

org.springframework.boot.actuate.autoconfigure.health.HealthContributorAutoConfiguration

org.springframework.boot.actuate.autoconfigure.endpoint.jackson.JacksonEndpointAutoConfiguration

org.springframework.boot.autoconfigure.availability.ApplicationAvailabilityAutoConfiguration

org.springframework.boot.autoconfigure.info.ProjectInfoAutoConfiguration

2023-11-13T13:56:54.187+03:00 ERROR 19588 --- [ restartedMain] o.s.boot.SpringApplication : Application run failed

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in class path resource [org/springframework/boot/autoconfigure/orm/jpa/HibernateJpaConfiguration.class]: EntityManagerFactory interface [interface org.hibernate.SessionFactory] seems to conflict with Spring's EntityManagerFactoryInfo mixin - consider resetting the 'entityManagerFactoryInterface' property to plain [jakarta.persistence.EntityManagerFactory] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1770) ~[spring-beans-6.0.13.jar:6.0.13] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:598) ~[spring-beans-6.0.13.jar:6.0.13] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:520) ~[spring-beans-6.0.13.jar:6.0.13] at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:325) ~[spring-beans-6.0.13.jar:6.0.13]
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234) ~[spring-beans-6.0.13.jar:6.0.13] at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:323) ~[spring-beans-6.0.13.jar:6.0.13] at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:199) ~[spring-beans-6.0.13.jar:6.0.13] at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1166) ~[spring-context-6.0.13.jar:6.0.13]
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:940) ~[spring-context-6.0.13.jar:6.0.13] at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:616) ~[spring-context-6.0.13.jar:6.0.13] at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:146) ~[spring-boot-3.1.5.jar:3.1.5] at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:738) ~[spring-boot-3.1.5.jar:3.1.5] at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:440) ~[spring-boot-3.1.5.jar:3.1.5] at org.springframework.boot.SpringApplication.run(SpringApplication.java:316) ~[spring-boot-3.1.5.jar:3.1.5] at org.springframework.boot.SpringApplication.run(SpringApplication.java:1306) ~[spring-boot-3.1.5.jar:3.1.5] at org.springframework.boot.SpringApplication.run(SpringApplication.java:1295) ~[spring-boot-3.1.5.jar:3.1.5] at com.vaadincrm.application.Application.main(Application.java:26) ~[classes/:na] at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:na] at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[na:na] at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[na:na] at java.base/java.lang.reflect.Method.invoke(Unknown Source) ~[na:na] at org.springframework.boot.devtools.restart.RestartLauncher.run(RestartLauncher.java:50) ~[spring-boot-devtools-3.1.5.jar:3.1.5] Caused by: java.lang.IllegalStateException: EntityManagerFactory interface [interface org.hibernate.SessionFactory] seems to conflict with Spring's EntityManagerFactoryInfo mixin - consider resetting the 'entityManagerFactoryInterface' property to plain [jakarta.persistence.EntityManagerFactory] at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.createEntityManagerFactoryProxy(AbstractEntityManagerFactoryBean.java:469) ~[spring-orm-6.0.13.jar:6.0.13] at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.afterPropertiesSet(AbstractEntityManagerFactoryBean.java:403) ~[spring-orm-6.0.13.jar:6.0.13] at org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean.afterPropertiesSet(LocalContainerEntityManagerFactoryBean.java:352) ~[spring-orm-6.0.13.jar:6.0.13] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1817) ~[spring-beans-6.0.13.jar:6.0.13] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1766) ~[spring-beans-6.0.13.jar:6.0.13] ... 21 common frames omitted Caused by: java.lang.IllegalArgumentException: methods with same signature getSchemaManager() but incompatible return types: [interface org.hibernate.relational.SchemaManager, interface jakarta.persistence.SchemaManager] at java.base/java.lang.reflect.ProxyGenerator.checkReturnTypes(Unknown Source) ~[na:na] at java.base/java.lang.reflect.ProxyGenerator.generateClassFile(Unknown Source) ~[na:na] at java.base/java.lang.reflect.ProxyGenerator.generateProxyClass(Unknown Source) ~[na:na] at java.base/java.lang.reflect.Proxy$ProxyBuilder.defineProxyClass(Unknown Source) ~[na:na] at java.base/java.lang.reflect.Proxy$ProxyBuilder.build(Unknown Source) ~[na:na] at java.base/java.lang.reflect.Proxy.lambda$getProxyConstructor$1(Unknown Source) ~[na:na] at java.base/jdk.internal.loader.AbstractClassLoaderValue$Memoizer.get(Unknown Source) ~[na:na] at java.base/jdk.internal.loader.AbstractClassLoaderValue.computeIfAbsent(Unknown Source) ~[na:na] at java.base/java.lang.reflect.Proxy.getProxyConstructor(Unknown Source) ~[na:na] at java.base/java.lang.reflect.Proxy.newProxyInstance(Unknown Source) ~[na:na] at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.createEntityManagerFactoryProxy(AbstractEntityManagerFactoryBean.java:464) ~[spring-orm-6.0.13.jar:6.0.13] ... 25 common frames omitted

PS C:\Users\Administrator\Desktop\Software Engineering\cosmc\my-app>

cosmah commented 1 year ago

I've moved the dependencies but thats the error now. for the database am using h2

cosmah commented 1 year ago

THEY STILL POINT TO THAT SPECIFIC BEAN

mcollovati commented 1 year ago

You have to remove the jakarta.persistence-api dependency from your pom because it is causing a conflict with the version required by Spring Boot

mshabarov commented 11 months ago

@cosmah this issue is closed due to no answer for more than two week. Please open a new issue if you have still any questions or problems.