Closed cosmah closed 9 months 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?
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
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;
}
}
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);
}
}
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());
}
}
it started misbehaving after i added the mainview
Double check that the ContactService
class is annotated with @Service
or @Component
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
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)
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()));
}
}
}
thats the link to the project
I got two issues in the project that prevents it from start:
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
dependenciesspring.datasource.url
in application.properties
.With the above steps the application starts and I can the MainView with the grid with the data.
@ConditionalOnClass did not find required class 'io.r2dbc.spi.ConnectionFactory' (OnClassCondition)
DispatcherServletAutoConfiguration.DispatcherServletConfiguration#multipartResolver: Did not match:
DynatraceMetricsExportAutoConfiguration: Did not match:
ElasticMetricsExportAutoConfiguration: Did not match:
ElasticsearchClientAutoConfiguration: Did not match:
ElasticsearchDataAutoConfiguration: Did not match:
ElasticsearchReactiveHealthContributorAutoConfiguration: Did not match:
ElasticsearchRepositoriesAutoConfiguration: Did not match:
ElasticsearchRestClientAutoConfiguration: Did not match:
ElasticsearchRestHealthContributorAutoConfiguration: Did not match:
EmbeddedLdapAutoConfiguration: Did not match:
EmbeddedWebServerFactoryCustomizerAutoConfiguration.JettyWebServerFactoryCustomizerConfiguration: Did not match:
EmbeddedWebServerFactoryCustomizerAutoConfiguration.NettyWebServerFactoryCustomizerConfiguration: Did not match:
EmbeddedWebServerFactoryCustomizerAutoConfiguration.UndertowWebServerFactoryCustomizerConfiguration: Did not match:
EnvironmentEndpointAutoConfiguration#environmentEndpointWebExtension: Did not match:
ErrorWebFluxAutoConfiguration: Did not match:
FlywayAutoConfiguration: Did not match:
FlywayEndpointAutoConfiguration: Did not match:
FreeMarkerAutoConfiguration: Did not match:
GangliaMetricsExportAutoConfiguration: Did not match:
GraphQlAutoConfiguration: Did not match:
GraphQlObservationAutoConfiguration: Did not match:
GraphQlQueryByExampleAutoConfiguration: Did not match:
GraphQlQuerydslAutoConfiguration: Did not match:
GraphQlRSocketAutoConfiguration: Did not match:
GraphQlReactiveQueryByExampleAutoConfiguration: Did not match:
GraphQlReactiveQuerydslAutoConfiguration: Did not match:
GraphQlWebFluxAutoConfiguration: Did not match:
GraphQlWebFluxSecurityAutoConfiguration: Did not match:
GraphQlWebMvcAutoConfiguration: Did not match:
GraphQlWebMvcSecurityAutoConfiguration: Did not match:
GraphiteMetricsExportAutoConfiguration: Did not match:
GroovyTemplateAutoConfiguration: Did not match:
GsonAutoConfiguration: Did not match:
GsonHttpMessageConvertersConfiguration: Did not match:
HazelcastAutoConfiguration: Did not match:
HazelcastCacheConfiguration: Did not match:
HazelcastHealthContributorAutoConfiguration: Did not match:
HazelcastJpaDependencyAutoConfiguration: Did not match:
HealthEndpointReactiveWebExtensionConfiguration: Did not match:
HealthEndpointWebExtensionConfiguration.JerseyAdditionalHealthEndpointPathsConfiguration: Did not match:
HibernateMetricsAutoConfiguration: Did not match:
HttpExchangesAutoConfiguration: Did not match:
HttpExchangesAutoConfiguration.ReactiveHttpExchangesConfiguration: Did not match:
HttpExchangesAutoConfiguration.ServletHttpExchangesConfiguration: Did not match:
HttpExchangesEndpointAutoConfiguration#httpExchangesEndpoint: Did not match:
HttpHandlerAutoConfiguration: Did not match:
HumioMetricsExportAutoConfiguration: Did not match:
HypermediaAutoConfiguration: Did not match:
InfinispanCacheConfiguration: Did not match:
InfluxDbAutoConfiguration: Did not match:
InfluxDbHealthContributorAutoConfiguration: Did not match:
InfluxMetricsExportAutoConfiguration: Did not match:
InfoContributorAutoConfiguration#buildInfoContributor: Did not match:
InfoContributorAutoConfiguration#envInfoContributor: Did not match:
InfoContributorAutoConfiguration#gitInfoContributor: Did not match:
InfoContributorAutoConfiguration#javaInfoContributor: Did not match:
InfoContributorAutoConfiguration#osInfoContributor: Did not match:
IntegrationAutoConfiguration: Did not match:
IntegrationGraphEndpointAutoConfiguration: Did not match:
JCacheCacheConfiguration: Did not match:
JacksonHttpMessageConvertersConfiguration.MappingJackson2XmlHttpMessageConverterConfiguration: Did not match:
JdbcRepositoriesAutoConfiguration: Did not match:
JerseyAutoConfiguration: Did not match:
JerseySameManagementContextConfiguration: Did not match:
JerseyServerMetricsAutoConfiguration: Did not match:
JerseyWebEndpointManagementContextConfiguration: Did not match:
JettyMetricsAutoConfiguration: Did not match:
JmsAutoConfiguration: Did not match:
JmsHealthContributorAutoConfiguration: Did not match:
JmxMetricsExportAutoConfiguration: Did not match:
JndiConnectionFactoryAutoConfiguration: Did not match:
JndiDataSourceAutoConfiguration: Did not match:
JndiJtaConfiguration: Did not match:
JooqAutoConfiguration: Did not match:
JpaRepositoriesAutoConfiguration#entityManagerFactoryBootstrapExecutorCustomizer: Did not match:
JsonbAutoConfiguration: Did not match:
JsonbHttpMessageConvertersConfiguration: Did not match:
KafkaAutoConfiguration: Did not match:
KafkaMetricsAutoConfiguration: Did not match:
KairosMetricsExportAutoConfiguration: Did not match:
LdapAutoConfiguration: Did not match:
LdapHealthContributorAutoConfiguration: Did not match:
LdapRepositoriesAutoConfiguration: Did not match:
LettuceMetricsAutoConfiguration: Did not match:
LiquibaseAutoConfiguration: Did not match:
LiquibaseEndpointAutoConfiguration: Did not match:
Log4J2MetricsAutoConfiguration: Did not match:
LogFileWebEndpointAutoConfiguration#logFileWebEndpoint: Did not match:
MailHealthContributorAutoConfiguration: Did not match:
MailSenderAutoConfiguration: Did not match:
MailSenderValidatorAutoConfiguration: Did not match:
ManagementContextAutoConfiguration.DifferentManagementContextConfiguration: Did not match:
ManagementWebSecurityAutoConfiguration: Did not match:
MappingsEndpointAutoConfiguration.ReactiveWebConfiguration: Did not match:
MessageSourceAutoConfiguration: Did not match:
MicrometerTracingAutoConfiguration: Did not match:
MongoAutoConfiguration: Did not match:
MongoDataAutoConfiguration: Did not match:
MongoHealthContributorAutoConfiguration: Did not match:
MongoMetricsAutoConfiguration: Did not match:
MongoReactiveAutoConfiguration: Did not match:
MongoReactiveDataAutoConfiguration: Did not match:
MongoReactiveHealthContributorAutoConfiguration: Did not match:
MongoReactiveRepositoriesAutoConfiguration: Did not match:
MongoRepositoriesAutoConfiguration: Did not match:
MustacheAutoConfiguration: Did not match:
Neo4jAutoConfiguration: Did not match:
Neo4jDataAutoConfiguration: Did not match:
Neo4jHealthContributorAutoConfiguration: Did not match:
Neo4jReactiveDataAutoConfiguration: Did not match:
Neo4jReactiveRepositoriesAutoConfiguration: Did not match:
Neo4jRepositoriesAutoConfiguration: Did not match:
NettyAutoConfiguration: Did not match:
NewRelicMetricsExportAutoConfiguration: Did not match:
NoOpMeterRegistryConfiguration: Did not match:
OAuth2AuthorizationServerAutoConfiguration: Did not match:
OAuth2AuthorizationServerJwtAutoConfiguration: Did not match:
OAuth2ClientAutoConfiguration: Did not match:
OAuth2ResourceServerAutoConfiguration: Did not match:
ObservationAutoConfiguration.MeterObservationHandlerConfiguration.TracingAndMetricsObservationHandlerConfiguration: Did not match:
ObservationAutoConfiguration.MetricsWithTracingConfiguration: Did not match:
ObservationAutoConfiguration.OnlyTracingConfiguration: Did not match:
OpenTelemetryAutoConfiguration: Did not match:
OtlpAutoConfiguration: Did not match:
OtlpMetricsExportAutoConfiguration: Did not match:
ProjectInfoAutoConfiguration#buildProperties: Did not match:
ProjectInfoAutoConfiguration#gitProperties: Did not match:
PrometheusExemplarsAutoConfiguration: Did not match:
PrometheusMetricsExportAutoConfiguration: Did not match:
QuartzAutoConfiguration: Did not match:
QuartzEndpointAutoConfiguration: Did not match:
R2dbcAutoConfiguration: Did not match:
R2dbcDataAutoConfiguration: Did not match:
R2dbcInitializationConfiguration: Did not match:
R2dbcRepositoriesAutoConfiguration: Did not match:
R2dbcTransactionManagerAutoConfiguration: Did not match:
RSocketGraphQlClientAutoConfiguration: Did not match:
RSocketMessagingAutoConfiguration: Did not match:
RSocketRequesterAutoConfiguration: Did not match:
RSocketSecurityAutoConfiguration: Did not match:
RSocketServerAutoConfiguration: Did not match:
RSocketStrategiesAutoConfiguration: Did not match:
RabbitAutoConfiguration: Did not match:
RabbitHealthContributorAutoConfiguration: Did not match:
RabbitMetricsAutoConfiguration: Did not match:
ReactiveCloudFoundryActuatorAutoConfiguration: Did not match:
ReactiveElasticsearchClientAutoConfiguration: Did not match:
ReactiveElasticsearchRepositoriesAutoConfiguration: Did not match:
ReactiveHealthEndpointConfiguration: Did not match:
ReactiveManagementContextAutoConfiguration: Did not match:
ReactiveManagementWebSecurityAutoConfiguration: Did not match:
ReactiveMultipartAutoConfiguration: Did not match:
ReactiveOAuth2ClientAutoConfiguration: Did not match:
ReactiveOAuth2ResourceServerAutoConfiguration: Did not match:
ReactiveSecurityAutoConfiguration: Did not match:
ReactiveUserDetailsServiceAutoConfiguration: Did not match:
ReactiveWebServerFactoryAutoConfiguration: Did not match:
RedisAutoConfiguration: Did not match:
RedisCacheConfiguration: Did not match:
RedisHealthContributorAutoConfiguration: Did not match:
RedisReactiveAutoConfiguration: Did not match:
RedisReactiveHealthContributorAutoConfiguration: Did not match:
RedisRepositoriesAutoConfiguration: Did not match:
RemoteDevToolsAutoConfiguration: Did not match:
RepositoryRestMvcAutoConfiguration: Did not match:
Saml2RelyingPartyAutoConfiguration: Did not match:
SecurityAutoConfiguration: Did not match:
SecurityFilterAutoConfiguration: Did not match:
SecurityRequestMatchersManagementContextConfiguration: Did not match:
SendGridAutoConfiguration: Did not match:
ServletEndpointManagementContextConfiguration.JerseyServletEndpointManagementContextConfiguration: Did not match:
ServletManagementContextAutoConfiguration.ApplicationContextFilterConfiguration: Did not match:
ServletWebServerFactoryAutoConfiguration.ForwardedHeaderFilterConfiguration: Did not match:
ServletWebServerFactoryConfiguration.EmbeddedJetty: Did not match:
ServletWebServerFactoryConfiguration.EmbeddedUndertow: Did not match:
SessionAutoConfiguration: Did not match:
SessionsEndpointAutoConfiguration: Did not match:
ShutdownEndpointAutoConfiguration: Did not match:
SignalFxMetricsExportAutoConfiguration: Did not match:
SpringSecurityAutoConfiguration: Did not match:
StackdriverMetricsExportAutoConfiguration: Did not match:
StartupEndpointAutoConfiguration: Did not match:
StatsdMetricsExportAutoConfiguration: Did not match:
TaskSchedulingAutoConfiguration#scheduledBeanLazyInitializationExcludeFilter: Did not match:
TaskSchedulingAutoConfiguration#taskScheduler: Did not match:
ThymeleafAutoConfiguration: Did not match:
TransactionAutoConfiguration#transactionalOperator: Did not match:
TransactionAutoConfiguration.AspectJTransactionManagementConfiguration: Did not match:
TransactionAutoConfiguration.EnableTransactionManagementConfiguration.JdkDynamicAutoProxyConfiguration: Did not match:
UserDetailsServiceAutoConfiguration: Did not match:
WavefrontAutoConfiguration: Did not match:
WavefrontMetricsExportAutoConfiguration: Did not match:
WavefrontTracingAutoConfiguration: Did not match:
WebClientAutoConfiguration: Did not match:
WebClientObservationConfiguration: Did not match:
WebFluxAutoConfiguration: Did not match:
WebFluxEndpointManagementContextConfiguration: Did not match:
WebFluxObservationAutoConfiguration: Did not match:
WebMvcAutoConfiguration#hiddenHttpMethodFilter: Did not match:
WebMvcAutoConfiguration.ProblemDetailsErrorHandlingConfiguration: Did not match:
WebMvcAutoConfiguration.ResourceChainCustomizerConfiguration: Did not match:
WebMvcAutoConfiguration.WebMvcAutoConfigurationAdapter#beanNameViewResolver: Did not match:
WebMvcEndpointManagementContextConfiguration#managementHealthEndpointWebMvcHandlerMapping: Did not match:
WebServiceTemplateAutoConfiguration: Did not match:
WebServicesAutoConfiguration: Did not match:
WebSessionIdResolverAutoConfiguration: Did not match:
WebSocketMessagingAutoConfiguration.WebSocketMessageConverterConfiguration: Did not match:
WebSocketReactiveAutoConfiguration: Did not match:
WebSocketServletAutoConfiguration.JettyWebSocketConfiguration: Did not match:
WebSocketServletAutoConfiguration.UndertowWebSocketConfiguration: Did not match:
XADataSourceAutoConfiguration: Did not match:
ZipkinAutoConfiguration: Did not match:
None
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>
I've moved the dependencies but thats the error now. for the database am using h2
THEY STILL POINT TO THAT SPECIFIC BEAN
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
@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.
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)