Hello,
I have a pretty basic Crud example I’m working on that is getting the following error
I started with the spring starter project.zip for IntelliJ
Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [com.crocker.projects.spring.MainView]
: Constructor threw exception; nested exception is java.lang.NoClassDefFoundError: Could not initialize class com.vaadin.flow.component.crud.CrudI18n
at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:184)
at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:87)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateBean(AbstractAutowireCapableBeanFactory.java:1295)
... 74 more
Caused by: java.lang.NoClassDefFoundError: Could not initialize class com.vaadin.flow.component.crud.CrudI18n
at com.vaadin.flow.component.crud.Crud.<init>(Crud.java:163)
at com.vaadin.flow.component.crud.Crud.<init>(Crud.java:119)
at com.crocker.projects.spring.MainView.<init>(MainView.java:39)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:172)
Here is my code:
EnterpriseDataProvider enterpriseDataProvider = new EnterpriseDataProvider(broadworks);
Crud<Enterprise> enterpriseCrud = new Crud<>(Enterprise.class, createEnterpriseEditor());
enterpriseCrud.setDataProvider(enterpriseDataProvider);
enterpriseCrud.addSaveListener(e-> enterpriseDataProvider.persist(e.getItem()));
enterpriseCrud.addDeleteListener(e-> enterpriseDataProvider.delete(e.getItem()));
enterpriseCrud.addThemeVariants(CrudVariant.NO_BORDER);
add(new Label("Hello World"));
add(enterpriseCrud);
private CrudEditor<Enterprise> createEnterpriseEditor() {
TextField enterpriseId = new TextField("Enterprise ID");
TextField enterpriseName = new TextField("Enterprise Name");
TextField supportEmail = new TextField("Support Email");
TextField defaultDomain = new TextField("Default Domain");
FormLayout form = new FormLayout(enterpriseId, enterpriseName, supportEmail);
Binder<Enterprise> binder = new Binder<>(Enterprise.class);
binder.bind(enterpriseId, Enterprise::getServiceProviderId, Enterprise::setServiceProviderId);
binder.bind(enterpriseName, Enterprise::getServiceProviderName, Enterprise::setServiceProviderName);
binder.bind(supportEmail, Enterprise::getSupportEmail, Enterprise::setSupportEmail);
binder.bind(defaultDomain, Enterprise::getDefaultDomain, Enterprise::setDefaultDomain);
return new BinderCrudEditor<>(binder, form);
}