I am trying to create a simple tiles application using Spring MVC but i get the below error while i start my server which i am unable to figure out.
Error
org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘viewResolver’ defined in ServletContext resource [/WEB-INF/dispatcher-servlet.xml]: Error setting property values; nested exception is org.springframework.beans.PropertyBatchUpdateException; nested PropertyAccessExceptions (1) are:
PropertyAccessException 1: org.springframework.beans.MethodInvocationException: Property ‘viewClass’ threw exception; nested exception is java.lang.IllegalArgumentException: Given view class [org.springframework.web.servlet.view.tiles2.TilesView] is not of type [org.springframework.web.servlet.view.InternalResourceView]
Below are my files
Web.xml
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" id="WebApp_ID" version="3.0">
<display-name>SpringMVC</display-name>
<servlet>
<servlet-name>dispatcher</servlet-name>
<servlet-class>
org.springframework.web.servlet.DispatcherServlet
</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>dispatcher</servlet-name>
<url-pattern>/</url-pattern>
</servlet-mapping>
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/dispatcher-servlet.xml</param-value>
</context-param>
</web-app>
servlet.xml
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:mvc="http://www.springframework.org/schema/mvc"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-3.0.xsd
http://www.springframework.org/schema/mvc
http://www.springframework.org/schema/mvc/spring-mvc-3.0.xsd">
<context:component-scan base-package="com.tutorialpoint" />
<mvc:annotation-driven />
<bean id="viewResolver" class="org.springframework.web.servlet.view.InternalResourceViewResolver">
<property name="prefix" value="/WEB-INF/jsp/" />
<property name="suffix" value=".jsp" />
<property name="viewClass" value = "org.springframework.web.servlet.view.tiles2.TilesView"/>
</bean>
<bean class="org.springframework.web.servlet.view.tiles2.TilesConfigurer">
<property name="definitions">
<list>
<value>/WEB-INF/tiles.xml</value>
</list>
</property>
</bean>
</beans>
tiles.xml
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE tiles-definitions PUBLIC
"-//Apache Software Foundation//DTD Tiles Configuration 2.0//EN"
"http://tiles.apache.org/dtds/tiles-config_2_0.dtd">
<tiles-definitions>
<definition name="base.definition"
template="/WEB-INF/jsp/layout.jsp">
<put-attribute name="title" value="" />
<put-attribute name="header" value="/WEB-INF/jsp/header.jsp" />
<put-attribute name="menu" value="/WEB-INF/jsp/menu.jsp" />
<put-attribute name="body" value="" />
<put-attribute name="footer" value="/WEB-INF/jsp/footer.jsp" />
</definition>
<definition name="contact" extends="base.definition">
<put-attribute name="title" value="Contact Manager" />
<put-attribute name="body" value="/WEB-INF/jsp/contact.jsp" />
</definition>
<definition name="hello" extends="base.definition">
<put-attribute name="title" value="Hello Spring MVC" />
<put-attribute name="body" value="/WEB-INF/jsp/hello.jsp" />
</definition>
</tiles-definitions>
Please guide.
Issue
Entity
@Entity
public class Card {
@Id
private Long id;
private String full_name;
private String login;
private int balance;
public Card() {
}
public Card(String full_name, String login, int balance) {
this.full_name = full_name;
this.login = login;
this.balance = balance;
}
public Card(Long id, String full_name, String login, int balance) {
this.id = id;
this.full_name = full_name;
this.login = login;
this.balance = balance;
}
public String getFull_name() {
return full_name;
}
public String getLogin() {
return login;
}
public int getBalance() {
return balance;
}
@Override
public String toString() {
......... }
}
Repository
@Repository
public interface CardRepository extends JpaRepository<Card, Long>{
@Query(value = "SELECT us.id, ...", nativeQuery = true)
List<Card> findAll();
}
Service
public interface CardService {
List<Card> findAll();
}
Impl
@Service
public class CardServiceImpl implements CardService {
@Autowired
private CardRepository repository;
@Override
public List<Card> findAll() {
List<ECard> list = new ArrayList<>();
return repository.findAll();
}
}
Controller
@RestController
@RequestMapping("/card")
public class CardController {
@Autowired
private CardService cardService;
public @ResponseBody List<Card> getAllCards() {
return cardService.findAll();
}
@RequestMapping( value = "/card", method = RequestMethod.GET)
public List<Card> cardList() {
return cardService.findAll();
}
}
I built a service like this. It works great. But I would like to save the data it receives to an xlsx file. This file should be saved when the application starts. I wanted to add the Workbook library instead of the existing Controller class, or rather its contents.
Something like that:
public class SaveCards {
public static void saveCards() throws IOException {
CardServiceImpl cardService = new CardServiceImpl();
saveExcel(cardService.findAll(), "fileName.xlsx");
}
private static void saveExcel(List<Card> list, String fileName) throws IOException {
Workbook workbook = new XSSFWorkbook();
Sheet sheet = workbook.createSheet("Cards");
sheet.setColumnWidth(0, 6000);
sheet.setColumnWidth(1, 4000);
Row header = sheet.createRow(0);
CellStyle headerStyle = workbook.createCellStyle();
headerStyle.setFillForegroundColor(IndexedColors.LIGHT_BLUE.getIndex());
headerStyle.setFillPattern(FillPatternType.SOLID_FOREGROUND);
XSSFFont font = ((XSSFWorkbook) workbook).createFont();
font.setFontName("Arial");
font.setFontHeightInPoints((short) 16);
font.setBold(true);
headerStyle.setFont(font);
Cell headerCell = header.createCell(0);
headerCell.setCellValue("full_name");
headerCell.setCellStyle(headerStyle);
headerCell = header.createCell(1);
headerCell.setCellValue("login");
headerCell.setCellStyle(headerStyle);
headerCell = header.createCell(2);
headerCell.setCellValue("balance");
headerCell.setCellStyle(headerStyle);
CellStyle style = workbook.createCellStyle();
style.setWrapText(true);
int ix_row=2;
for (Card card : list) {
Row row = sheet.createRow(ix_row);
Cell cell = row.createCell(0);
cell.setCellValue(eCard.getFull_name());
cell.setCellStyle(style);
cell = row.createCell(1);
cell.setCellValue(eCard.getLogin());
cell.setCellStyle(style);
cell = row.createCell(2);
cell.setCellValue(eCard.getBalance());
cell.setCellStyle(style);
ix_row++;
}
FileOutputStream outputStream = new FileOutputStream(fileName);
workbook.write(outputStream);
workbook.close();
}
}
However, if I changed the Controller class to the SaveCards class, I got an error: Error creating bean with name ‘viewResolver’ Spring
Now, the following comes out: Started DemonewApplication in 11.253 seconds (JVM running for 11.882). And that’s all, no action takes place, the data received by the select is not saved to the xlsx file.
What am I doing wrong?
I understand that the saveCards method in the SaveCards class has to be called somewhere, but I can’t figure out where?
Solution
You can extend org.springframework.boot.ApplicationRunner to run your code at Spring Boot startup.
@Component
class SaveCardsStartupRunner implements ApplicationRunner
{
@Autowired
private SaveCards saveCards;
@Override
public void run(ApplicationArguments args)
{
saveCards.saveCards();
}
}
And the SaveCards class has to be changed as follows:
@Component
public class SaveCards {
{
@Autowired
private CardService cardService;
public void saveCards() throws IOException {
saveExcel(cardService.findAll(), "fileName.xlsx");
}
private void saveExcel(List<Card> list, String fileName) throws IOException {...}
}
Answered By – Georg Leber
This Answer collected from stackoverflow, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0
Информация об исключении: Error creating bean with name ‘viewResolver’ defined in class path resource [org/springframework/boot/autoconfigure/web/WebMvcAutoConfiguration
W
e
b
M
v
c
A
u
t
o
C
o
n
f
i
g
u
r
a
t
i
o
n
A
d
a
p
t
e
r
.
c
l
a
s
s
]
:
I
n
i
t
i
a
l
i
z
a
t
i
o
n
o
f
b
e
a
n
f
a
i
l
e
d
;
n
e
s
t
e
d
e
x
c
e
p
t
i
o
n
i
s
o
r
g
.
s
p
r
i
n
g
f
r
a
m
e
w
o
r
k
.
b
e
a
n
s
.
f
a
c
t
o
r
y
.
U
n
s
a
t
i
s
f
i
e
d
D
e
p
e
n
d
e
n
c
y
E
x
c
e
p
t
i
o
n
:
E
r
r
o
r
c
r
e
a
t
i
n
g
b
e
a
n
w
i
t
h
n
a
m
e
′
o
r
g
.
s
p
r
i
n
g
f
r
a
m
e
w
o
r
k
.
b
o
o
t
.
a
u
t
o
c
o
n
f
i
g
u
r
e
.
t
h
y
m
e
l
e
a
f
.
T
h
y
m
e
l
e
a
f
A
u
t
o
C
o
n
f
i
g
u
r
a
t
i
o
n
WebMvcAutoConfigurationAdapter.class]: Initialization of bean failed; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'org.springframework.boot.autoconfigure.thymeleaf.ThymeleafAutoConfiguration
Thymeleaf3Configuration
T
h
y
m
e
l
e
a
f
3
V
i
e
w
R
e
s
o
l
v
e
r
C
o
n
f
i
g
u
r
a
t
i
o
n
′
:
U
n
s
a
t
i
s
f
i
e
d
d
e
p
e
n
d
e
n
c
y
e
x
p
r
e
s
s
e
d
t
h
r
o
u
g
h
c
o
n
s
t
r
u
c
t
o
r
p
a
r
a
m
e
t
e
r
1
;
n
e
s
t
e
d
e
x
c
e
p
t
i
o
n
i
s
o
r
g
.
s
p
r
i
n
g
f
r
a
m
e
w
o
r
k
.
b
e
a
n
s
.
f
a
c
t
o
r
y
.
B
e
a
n
C
r
e
a
t
i
o
n
E
x
c
e
p
t
i
o
n
:
E
r
r
o
r
c
r
e
a
t
i
n
g
b
e
a
n
w
i
t
h
n
a
m
e
′
o
r
g
.
s
p
r
i
n
g
f
r
a
m
e
w
o
r
k
.
b
o
o
t
.
a
u
t
o
c
o
n
f
i
g
u
r
e
.
t
h
y
m
e
l
e
a
f
.
T
h
y
m
e
l
e
a
f
A
u
t
o
C
o
n
f
i
g
u
r
a
t
i
o
n
Thymeleaf3ViewResolverConfiguration': Unsatisfied dependency expressed through constructor parameter 1; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.boot.autoconfigure.thymeleaf.ThymeleafAutoConfiguration
ThymeleafDefaultConfiguration’: Bean instantiation via constructor failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.boot.autoconfigure.thymeleaf.ThymeleafAutoConfiguration
T
h
y
m
e
l
e
a
f
D
e
f
a
u
l
t
C
o
n
f
i
g
u
r
a
t
i
o
n
ThymeleafDefaultConfiguration
E
n
h
a
n
c
e
r
B
y
S
p
r
i
n
g
C
G
L
I
B
EnhancerBySpringCGLIB
b
20
d
f
d
10
]
:
C
o
n
s
t
r
u
c
t
o
r
t
h
r
e
w
e
x
c
e
p
t
i
o
n
;
n
e
s
t
e
d
e
x
c
e
p
t
i
o
n
i
s
o
r
g
.
s
p
r
i
n
g
f
r
a
m
e
w
o
r
k
.
b
e
a
n
s
.
f
a
c
t
o
r
y
.
B
e
a
n
C
r
e
a
t
i
o
n
E
x
c
e
p
t
i
o
n
:
E
r
r
o
r
c
r
e
a
t
i
n
g
b
e
a
n
w
i
t
h
n
a
m
e
′
l
a
y
o
u
t
D
i
a
l
e
c
t
′
d
e
f
i
n
e
d
i
n
c
l
a
s
s
p
a
t
h
r
e
s
o
u
r
c
e
[
o
r
g
/
s
p
r
i
n
g
f
r
a
m
e
w
o
r
k
/
b
o
o
t
/
a
u
t
o
c
o
n
f
i
g
u
r
e
/
t
h
y
m
e
l
e
a
f
/
T
h
y
m
e
l
e
a
f
A
u
t
o
C
o
n
f
i
g
u
r
a
t
i
o
n
b20dfd10]: Constructor threw exception; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'layoutDialect' defined in class path resource [org/springframework/boot/autoconfigure/thymeleaf/ThymeleafAutoConfiguration
ThymeleafWebLayoutConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [nz.net.ultraq.thymeleaf.LayoutDialect]: Factory method ‘layoutDialect’ threw exception; nested exception is java.lang.NoClassDefFoundError: org/thymeleaf/dom/Attribute
Решение: Добавьте параметр свойства в файл pom проекта: <thymeleaf-layout-dialect.version> 2.0.4 </thymeleaf-layout-dialect.version>
Полная конфигурация тимелеафа в Springboot:
1. Добавьте координаты:
org.springframework.boot
spring-boot-starter-thymeleaf
org.assertj
assertj-core
2. Добавьте две строчки в свойство pom
<java.version>1.8</java.version>
<thymeleaf.version>3.0.2.RELEASE</thymeleaf.version>
<thymeleaf-layout-dialect.version>2.0.4</thymeleaf-layout-dialect.version>
3. Добавьте соответствующую конфигурацию в файл конфигурации. (На самом деле настраивать не нужно, если ресурс html помещен в пакет шаблонов, настраивать не нужно)
spring.thymeleaf.servlet.content-type=text/html
spring.thymeleaf.mode=HTML
spring.thymeleaf.cache=false
spring.thymeleaf.encoding=utf-8
У меня возникли проблемы с инициализацией контекста. Я не использую файлы конфигурации xml. Я хотел сделать конфигурацию Spring без xml, но появляется ошибка. Пожалуйста, помогите решить.
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'viewResolver' defined in com.luv2code.springsecurity.demo.config.DemoAppConfig: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.web.servlet.ViewResolver]: Factory method 'viewResolver' threw exception; nested exception is java.lang.StackOverflowError
org.springframework.beans.factory.support.ConstructorResolver.instantiate(ConstructorResolver.java:625)
org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:456)
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1287)
Мой DemoAppConfig
package com.luv2code.springsecurity.demo.config;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.ViewResolver;
import org.springframework.web.servlet.config.annotation.EnableWebMvc;
import org.springframework.web.servlet.view.InternalResourceViewResolver;
@Configuration
@EnableWebMvc
@ComponentScan(basePackages = "com.luv2code.springsecurity.demo")
public class DemoAppConfig {
@Bean
public ViewResolver viewResolver() {
InternalResourceViewResolver viewResolver = new InternalResourceViewResolver();
viewResolver.setPrefix("/WEB-INF/view/");
viewResolver.setSuffix(".jsp");
return viewResolver();
}
}
Мой WebInit
public class MySpringMvcDisptacherServletInitializer extends AbstractAnnotationConfigDispatcherServletInitializer {
@Override
protected Class<?>[] getRootConfigClasses() {
// TODO Auto-generated method stub
return null;
}
@Override
protected Class<?>[] getServletConfigClasses() {
// TODO Auto-generated method stub
return new Class[] {DemoAppConfig.class};
}
@Override
protected String[] getServletMappings() {
// TODO Auto-generated method stub
return new String[] { "/" };
}
}
Я знаю, что моя проблема в DemoAppConfig, но я просто не могу ее найти. Это должно быть с Resolver. Но я не получаю желаемого результата.
2 ответа
Лучший ответ
Метод viewResolver() вызывает сам себя. Это никогда не закончится, пока стек (который отслеживает вызовы методов) не исчерпает свою емкость — «переполнение стека».
См. ответ на вопрос «Что такое StackOverflowError?» для отличного подробного объяснения.
Вместо того, чтобы снова вызывать viewResolver(), я думаю, вы хотите вернуть локальную переменную viewResolver (будьте осторожны, здесь нет скобок).
0
mthmulders
18 Авг 2020 в 13:54
Попробуйте вернуть return viewResolver; вместо return viewResolver ();
@Configuration
@EnableWebMvc
@ComponentScan(basePackages="com.luv2code.springsecurity.demo")
public class DemoAppConfig {
// define a bean for ViewResolver
@Bean
public ViewResolver viewResolver() {
InternalResourceViewResolver viewResolver = new InternalResourceViewResolver();
viewResolver.setPrefix("/WEB-INF/view/");
viewResolver.setSuffix(".jsp");
return viewResolver;
}
}
0
zawarudo
18 Авг 2020 в 14:02
1. Overview
In this tutorial, we’ll discuss the Spring org.springframework.beans.factory.BeanCreationException. It’s a very common exception thrown when the BeanFactory creates beans of the bean definitions, and encounteres a problem. This article will explore the most common causes of this exception, along with the solutions.
2. Cause: org.springframework.beans.factory.NoSuchBeanDefinitionException
By far, the most common cause of the BeanCreationException is Spring trying to inject a bean that doesn’t exist in the context.
For example, BeanA is trying to inject BeanB:
@Component
public class BeanA {
@Autowired
private BeanB dependency;
...
}
If a BeanB isn’t found in the context, then the following exception will be thrown (Error Creating Bean):
Error creating bean with name 'beanA': Injection of autowired dependencies failed;
nested exception is org.springframework.beans.factory.BeanCreationException:
Could not autowire field: private com.baeldung.web.BeanB cpm.baeldung.web.BeanA.dependency;
nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException:
No qualifying bean of type [com.baeldung.web.BeanB] found for dependency:
expected at least 1 bean which qualifies as autowire candidate for this dependency.
Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true)}
To diagnose this type of issue, we’ll first make sure the bean is declared:
- either in an XML configuration file using the <bean /> element
- or in a Java @Configuration class via the @Bean annotation
- or is annotated with @Component, @Repository, @Service, @Controller, and classpath scanning is active for that package
We’ll also check that Spring actually picks up the configuration files or classes, and loads them into the main context.
3. Cause: org.springframework.beans.factory.NoUniqueBeanDefinitionException
Another similar cause for the bean creation exception is Spring trying to inject a bean by type, namely by its interface, and finding two or more beans implementing that interface in the context.
For example, BeanB1 and BeanB2 both implement the same interface:
@Component
public class BeanB1 implements IBeanB { ... }
@Component
public class BeanB2 implements IBeanB { ... }
@Component
public class BeanA {
@Autowired
private IBeanB dependency;
...
}
This will lead to the following exception being thrown by the Spring bean factory:
Error creating bean with name 'beanA': Injection of autowired dependencies failed;
nested exception is org.springframework.beans.factory.BeanCreationException:
Could not autowire field: private com.baeldung.web.IBeanB com.baeldung.web.BeanA.b;
nested exception is org.springframework.beans.factory.NoUniqueBeanDefinitionException:
No qualifying bean of type [com.baeldung.web.IBeanB] is defined:
expected single matching bean but found 2: beanB1,beanB2
4. Cause: org.springframework.beans.BeanInstantiationException
4.1. Custom Exception
Next in line is a bean that throws an exception during its creation process. A simplified example to easily understand the problem is throwing an exception in the constructor of the bean:
@Component
public class BeanA {
public BeanA() {
super();
throw new NullPointerException();
}
...
}
As expected, this will lead to Spring failing fast with the following exception:
Error creating bean with name 'beanA' defined in file [...BeanA.class]:
Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException:
Could not instantiate bean class [com.baeldung.web.BeanA]:
Constructor threw exception;
nested exception is java.lang.NullPointerException
4.2. java.lang.InstantiationException
Another possible occurence of the BeanInstantiationException is defining an abstract class as a bean in XML; this has to be in XML because there’s no way to do it in a Java @Configuration file, and classpath scanning will ignore the abstract class:
@Component
public abstract class BeanA implements IBeanA { ... }
Here’s the XML definition of the bean:
<bean id="beanA" class="com.baeldung.web.BeanA" />
This setup will result in a similar exception:
org.springframework.beans.factory.BeanCreationException:
Error creating bean with name 'beanA' defined in class path resource [beansInXml.xml]:
Instantiation of bean failed;
nested exception is org.springframework.beans.BeanInstantiationException:
Could not instantiate bean class [com.baeldung.web.BeanA]:
Is it an abstract class?;
nested exception is java.lang.InstantiationException
4.3. java.lang.NoSuchMethodException
If a bean has no default constructor, and Spring tries to instantiate it by looking for that constructor, this will result in a runtime exception:
@Component
public class BeanA implements IBeanA {
public BeanA(final String name) {
super();
System.out.println(name);
}
}
When the classpath scanning mechanism picks up this bean, the failure will be:
Error creating bean with name 'beanA' defined in file [...BeanA.class]: Instantiation of bean failed;
nested exception is org.springframework.beans.BeanInstantiationException:
Could not instantiate bean class [com.baeldung.web.BeanA]:
No default constructor found;
nested exception is java.lang.NoSuchMethodException: com.baeldung.web.BeanA.<init>()
A similar exception, but harder to diagnose, may occur when the Spring dependencies on the classpath don’t have the same version. This kind of version incompatibility may result in a NoSuchMethodException because of API changes. The solution to such a problem is to make sure all Spring libraries have the exact same version in the project.
5. Cause: org.springframework.beans.NotWritablePropertyException
Yet another possiblity is defining a bean, BeanA, with a reference to another bean, BeanB, without having the corresponding setter method in BeanA:
@Component
public class BeanA {
private IBeanB dependency;
...
}
@Component
public class BeanB implements IBeanB { ... }
Here’s the Spring XML Configuration:
<bean id="beanA" class="com.baeldung.web.BeanA">
<property name="beanB" ref="beanB" />
</bean>
Again, this can only occur in XML Configuration because when using Java @Configuration, the compiler will make this issue impossible to reproduce.
Of course, in order to solve this issue, we need to add the setter for IBeanB:
@Component
public class BeanA {
private IBeanB dependency;
public void setDependency(final IBeanB dependency) {
this.dependency = dependency;
}
}
6. Cause: org.springframework.beans.factory.CannotLoadBeanClassException
Spring throws this exception when it can’t load the class of the defined bean. This may occur if the Spring XML Configuration contains a bean that simply doesn’t have a corresponding class. For example, if class BeanZ doesn’t exist, the following definition will result in an exception:
<bean id="beanZ" class="com.baeldung.web.BeanZ" />
The root cause of the ClassNotFoundException and the full exception in this case is:
nested exception is org.springframework.beans.factory.BeanCreationException:
...
nested exception is org.springframework.beans.factory.CannotLoadBeanClassException:
Cannot find class [com.baeldung.web.BeanZ] for bean with name 'beanZ'
defined in class path resource [beansInXml.xml];
nested exception is java.lang.ClassNotFoundException: com.baeldung.web.BeanZ
7. Children of BeanCreationException
7.1. The org.springframework.beans.factory.BeanCurrentlyInCreationException
One of the subclasses of BeanCreationException is the BeanCurrentlyInCreationException. This usually occurs when using constructor injection, for example, in a case of circular dependencies:
@Component
public class BeanA implements IBeanA {
private IBeanB beanB;
@Autowired
public BeanA(final IBeanB beanB) {
super();
this.beanB = beanB;
}
}
@Component
public class BeanB implements IBeanB {
final IBeanA beanA;
@Autowired
public BeanB(final IBeanA beanA) {
super();
this.beanA = beanA;
}
}
Spring won’t be able to resolve this kind of wiring scenario and the end result will be:
org.springframework.beans.factory.BeanCurrentlyInCreationException:
Error creating bean with name 'beanA':
Requested bean is currently in creation: Is there an unresolvable circular reference?
The full exception is very verbose:
org.springframework.beans.factory.UnsatisfiedDependencyException:
Error creating bean with name 'beanA' defined in file [...BeanA.class]:
Unsatisfied dependency expressed through constructor argument with index 0
of type [com.baeldung.web.IBeanB]: :
Error creating bean with name 'beanB' defined in file [...BeanB.class]:
Unsatisfied dependency expressed through constructor argument with index 0
of type [com.baeldung.web.IBeanA]: :
Error creating bean with name 'beanA': Requested bean is currently in creation:
Is there an unresolvable circular reference?;
nested exception is org.springframework.beans.factory.BeanCurrentlyInCreationException:
Error creating bean with name 'beanA':
Requested bean is currently in creation:
Is there an unresolvable circular reference?;
nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException:
Error creating bean with name 'beanB' defined in file [...BeanB.class]:
Unsatisfied dependency expressed through constructor argument with index 0
of type [com.baeldung.web.IBeanA]: :
Error creating bean with name 'beanA':
Requested bean is currently in creation:
Is there an unresolvable circular reference?;
nested exception is org.springframework.beans.factory.BeanCurrentlyInCreationException:
Error creating bean with name 'beanA':
Requested bean is currently in creation: Is there an unresolvable circular reference?
7.2. The org.springframework.beans.factory.BeanIsAbstractException
This instantiation exception may occur when the Bean Factory attempts to retrieve and instantiate a bean that was declared as abstract:
public abstract class BeanA implements IBeanA {
...
}
We declare it in the XML Configuration as:
<bean id="beanA" abstract="true" class="com.baeldung.web.BeanA" />
If we try to retrieve BeanA from the Spring Context by name, like when instantiating another bean:
@Configuration
public class Config {
@Autowired
BeanFactory beanFactory;
@Bean
public BeanB beanB() {
beanFactory.getBean("beanA");
return new BeanB();
}
}
This will result in the following exception:
org.springframework.beans.factory.BeanIsAbstractException:
Error creating bean with name 'beanA': Bean definition is abstract
And the full exception stacktrace:
org.springframework.beans.factory.BeanCreationException:
Error creating bean with name 'beanB' defined in class path resource
[org/baeldung/spring/config/WebConfig.class]: Instantiation of bean failed;
nested exception is org.springframework.beans.factory.BeanDefinitionStoreException:
Factory method
[public com.baeldung.web.BeanB com.baeldung.spring.config.WebConfig.beanB()] threw exception;
nested exception is org.springframework.beans.factory.BeanIsAbstractException:
Error creating bean with name 'beanA': Bean definition is abstract
8. Conclusion
In this article, we learned how to navigate the variety of causes and problems that may lead to a BeanCreationException in Spring, as well as developed a good grasp on how to fix all of these problems.
The implementation of all the exception examples can be found in the github project. This is an Eclipse based project, so it should be easy to import and run as it is.
Get started with Spring 5 and Spring Boot 2, through the Learn Spring course:
>> THE COURSE
Я пытаюсь создать простой преобразователь представлений, который возвращает привет, мир независимо от того, какое представление вы хотите (в качестве отправной точки).
У меня пока есть это:
public class MyViewResolver extends AbstractTemplateView {
@Override
protected void renderMergedTemplateModel(Map<String, Object> model, HttpServletRequest request,
HttpServletResponse response) throws Exception {
doRender(model, request, response);
}
protected void doRender(Map<String,Object> model, HttpServletRequest request, HttpServletResponse response)
throws Exception {
PrintWriter writer = response.getWriter();
writer.write("hi from my resolver!");
}
}
Теперь я получаю эту ошибку:
2012-03-29 16:51:28.855:WARN:/:unavailable
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'viewResolver' defined in ServletContext resource [/WEB-INF/application-context.xml]: Invocation of init method failed; nested exception is java.lang.IllegalArgumentException: Property 'url' is required
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1455)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:519)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:294)
Я реализовал все, что требуется AbstractTemplateView, но не уверен, какое свойство url он запрашивает?
Кроме того, где имя представления, которое передается этому viewresolver’у?
Обновить
Итак, я добавил:
@Override
public boolean isUrlRequired() {
return false;
}
И теперь я просто получаю сообщение об ошибке:
HTTP ERROR 404
Problem accessing /home/index. Reason:
NOT_FOUND
В моем application-context.xml есть:
<bean id="viewResolver" class="com.example.MyViewResolver">
</bean>
Что мне чего-то не хватает?
Thanks, but now the build console give me this:
Seems like it doesn’t recognize the spring-boot-starter-thymeleaf library.
Information:Internal caches are corrupted or have outdated format, forcing project rebuild: backward reference index should be updated to actual version Information:java: Errors occurred while compiling module 'main' Information:javac 1.8.0_40 was used to compile java sources Information:4/12/2018 11:07 PM - Compilation completed with 85 errors and 0 warnings in 3s 918ms E:UsersJiaminOneDriveDocumentsProgramminggiflib-gradle-buildersrcmainjavacomteamtreehousegiflibApplication.java Error:(3, 32) java: package org.springframework.boot does not exist Error:(4, 46) java: package org.springframework.boot.autoconfigure does not exist Error:(5, 46) java: package org.springframework.context.annotation does not exist Error:(7, 2) java: cannot find symbol symbol: class EnableAutoConfiguration Error:(8, 2) java: cannot find symbol symbol: class ComponentScan Error:(11, 9) java: cannot find symbol symbol: variable SpringApplication location: class com.teamtreehouse.giflib.Application E:UsersJiaminOneDriveDocumentsProgramminggiflib-gradle-buildersrcmainjavacomteamtreehousegiflibconfigTemplateConfig.java Error:(3, 46) java: package org.springframework.context.annotation does not exist Error:(4, 46) java: package org.springframework.context.annotation does not exist Error:(5, 29) java: package org.thymeleaf.spring4 does not exist Error:(6, 46) java: package org.thymeleaf.spring4.templateresolver does not exist Error:(7, 34) java: package org.thymeleaf.spring4.view does not exist Error:(9, 2) java: cannot find symbol symbol: class Configuration Error:(12, 12) java: cannot find symbol symbol: class SpringResourceTemplateResolver location: class com.teamtreehouse.giflib.config.TemplateConfig Error:(21, 12) java: cannot find symbol symbol: class SpringTemplateEngine location: class com.teamtreehouse.giflib.config.TemplateConfig Error:(28, 12) java: cannot find symbol symbol: class ThymeleafViewResolver location: class com.teamtreehouse.giflib.config.TemplateConfig Error:(11, 6) java: cannot find symbol symbol: class Bean location: class com.teamtreehouse.giflib.config.TemplateConfig Error:(20, 6) java: cannot find symbol symbol: class Bean location: class com.teamtreehouse.giflib.config.TemplateConfig Error:(27, 6) java: cannot find symbol symbol: class Bean location: class com.teamtreehouse.giflib.config.TemplateConfig Error:(13, 15) java: cannot find symbol symbol: class SpringResourceTemplateResolver location: class com.teamtreehouse.giflib.config.TemplateConfig Error:(13, 69) java: cannot find symbol symbol: class SpringResourceTemplateResolver location: class com.teamtreehouse.giflib.config.TemplateConfig Error:(22, 15) java: cannot find symbol symbol: class SpringTemplateEngine location: class com.teamtreehouse.giflib.config.TemplateConfig Error:(22, 63) java: cannot find symbol symbol: class SpringTemplateEngine location: class com.teamtreehouse.giflib.config.TemplateConfig Error:(29, 15) java: cannot find symbol symbol: class ThymeleafViewResolver location: class com.teamtreehouse.giflib.config.TemplateConfig Error:(29, 56) java: cannot find symbol symbol: class ThymeleafViewResolver location: class com.teamtreehouse.giflib.config.TemplateConfig E:UsersJiaminOneDriveDocumentsProgramminggiflib-gradle-buildersrcmainjavacomteamtreehousegiflibwebcontrollerGifController.java Error:(4, 38) java: package org.springframework.stereotype does not exist Error:(5, 30) java: package org.springframework.ui does not exist Error:(6, 1) java: package org.springframework.web.bind.annotation does not exist Error:(11, 2) java: cannot find symbol symbol: class Controller Error:(16, 28) java: cannot find symbol symbol: class Model location: class com.teamtreehouse.giflib.web.controller.GifController Error:(26, 56) java: cannot find symbol symbol: class Model location: class com.teamtreehouse.giflib.web.controller.GifController Error:(44, 29) java: cannot find symbol symbol: class Model location: class com.teamtreehouse.giflib.web.controller.GifController Error:(64, 30) java: cannot find symbol symbol: class Model location: class com.teamtreehouse.giflib.web.controller.GifController Error:(72, 57) java: cannot find symbol symbol: class Model location: class com.teamtreehouse.giflib.web.controller.GifController Error:(107, 57) java: cannot find symbol symbol: class Model location: class com.teamtreehouse.giflib.web.controller.GifController Error:(15, 6) java: cannot find symbol symbol: class RequestMapping location: class com.teamtreehouse.giflib.web.controller.GifController Error:(26, 31) java: cannot find symbol symbol: class PathVariable location: class com.teamtreehouse.giflib.web.controller.GifController Error:(25, 6) java: cannot find symbol symbol: class RequestMapping location: class com.teamtreehouse.giflib.web.controller.GifController Error:(37, 29) java: cannot find symbol symbol: class PathVariable location: class com.teamtreehouse.giflib.web.controller.GifController Error:(35, 6) java: cannot find symbol symbol: class RequestMapping location: class com.teamtreehouse.giflib.web.controller.GifController Error:(36, 6) java: cannot find symbol symbol: class ResponseBody location: class com.teamtreehouse.giflib.web.controller.GifController Error:(43, 6) java: cannot find symbol symbol: class RequestMapping location: class com.teamtreehouse.giflib.web.controller.GifController Error:(54, 6) java: cannot find symbol symbol: class RequestMapping location: class com.teamtreehouse.giflib.web.controller.GifController Error:(63, 6) java: cannot find symbol symbol: class RequestMapping location: class com.teamtreehouse.giflib.web.controller.GifController Error:(72, 32) java: cannot find symbol symbol: class PathVariable location: class com.teamtreehouse.giflib.web.controller.GifController Error:(71, 6) java: cannot find symbol symbol: class RequestMapping location: class com.teamtreehouse.giflib.web.controller.GifController Error:(79, 6) java: cannot find symbol symbol: class RequestMapping location: class com.teamtreehouse.giflib.web.controller.GifController Error:(89, 30) java: cannot find symbol symbol: class PathVariable location: class com.teamtreehouse.giflib.web.controller.GifController Error:(88, 6) java: cannot find symbol symbol: class RequestMapping location: class com.teamtreehouse.giflib.web.controller.GifController Error:(98, 35) java: cannot find symbol symbol: class PathVariable location: class com.teamtreehouse.giflib.web.controller.GifController Error:(97, 6) java: cannot find symbol symbol: class RequestMapping location: class com.teamtreehouse.giflib.web.controller.GifController Error:(107, 34) java: cannot find symbol symbol: class RequestParam location: class com.teamtreehouse.giflib.web.controller.GifController Error:(106, 6) java: cannot find symbol symbol: class RequestMapping location: class com.teamtreehouse.giflib.web.controller.GifController E:UsersJiaminOneDriveDocumentsProgramminggiflib-gradle-buildersrcmainjavacomteamtreehousegiflibwebcontrollerCategoryController.java Error:(4, 38) java: package org.springframework.stereotype does not exist Error:(5, 30) java: package org.springframework.ui does not exist Error:(6, 47) java: package org.springframework.web.bind.annotation does not exist Error:(7, 47) java: package org.springframework.web.bind.annotation does not exist Error:(8, 47) java: package org.springframework.web.bind.annotation does not exist Error:(13, 2) java: cannot find symbol symbol: class Controller Error:(18, 34) java: cannot find symbol symbol: class Model location: class com.teamtreehouse.giflib.web.controller.CategoryController Error:(28, 59) java: cannot find symbol symbol: class Model location: class com.teamtreehouse.giflib.web.controller.CategoryController Error:(38, 35) java: cannot find symbol symbol: class Model location: class com.teamtreehouse.giflib.web.controller.CategoryController Error:(46, 67) java: cannot find symbol symbol: class Model location: class com.teamtreehouse.giflib.web.controller.CategoryController Error:(17, 6) java: cannot find symbol symbol: class RequestMapping location: class com.teamtreehouse.giflib.web.controller.CategoryController Error:(28, 29) java: cannot find symbol symbol: class PathVariable location: class com.teamtreehouse.giflib.web.controller.CategoryController Error:(27, 6) java: cannot find symbol symbol: class RequestMapping location: class com.teamtreehouse.giflib.web.controller.CategoryController Error:(37, 6) java: cannot find symbol symbol: class RequestMapping location: class com.teamtreehouse.giflib.web.controller.CategoryController Error:(46, 37) java: cannot find symbol symbol: class PathVariable location: class com.teamtreehouse.giflib.web.controller.CategoryController Error:(45, 6) java: cannot find symbol symbol: class RequestMapping location: class com.teamtreehouse.giflib.web.controller.CategoryController Error:(53, 6) java: cannot find symbol symbol: class RequestMapping location: class com.teamtreehouse.giflib.web.controller.CategoryController Error:(62, 6) java: cannot find symbol symbol: class RequestMapping location: class com.teamtreehouse.giflib.web.controller.CategoryController Error:(72, 35) java: cannot find symbol symbol: class PathVariable location: class com.teamtreehouse.giflib.web.controller.CategoryController Error:(71, 6) java: cannot find symbol symbol: class RequestMapping location: class com.teamtreehouse.giflib.web.controller.CategoryController E:UsersJiaminOneDriveDocumentsProgramminggiflib-gradle-buildersrcmainjavacomteamtreehousegiflibconfigAppConfig.java Error:(3, 19) java: package org.hashids does not exist Error:(4, 52) java: package org.springframework.beans.factory.annotation does not exist Error:(5, 46) java: package org.springframework.context.annotation does not exist Error:(6, 46) java: package org.springframework.context.annotation does not exist Error:(7, 46) java: package org.springframework.context.annotation does not exist Error:(8, 36) java: package org.springframework.core.env does not exist Error:(11, 2) java: cannot find symbol symbol: class Configuration Error:(12, 2) java: cannot find symbol symbol: class PropertySource Error:(15, 13) java: cannot find symbol symbol: class Environment location: class com.teamtreehouse.giflib.config.AppConfig Error:(18, 12) java: cannot find symbol symbol: class Hashids location: class com.teamtreehouse.giflib.config.AppConfig Error:(14, 6) java: cannot find symbol symbol: class Autowired location: class com.teamtreehouse.giflib.config.AppConfig Error:(17, 6) java: cannot find symbol symbol: class Bean location: class com.teamtreehouse.giflib.config.AppConfig Error:(19, 20) java: cannot find symbol symbol: class Hashids location: class com.teamtreehouse.giflib.config.AppConfig
I might reinstall IntelliJ if that might be helpful.
Пытаюсь запустить первое приложение Spring MVC и не могу понять ошибку.
import javax.servlet.ServletContext;
import javax.servlet.ServletException;
import javax.servlet.ServletRegistration;
import org.springframework.web.WebApplicationInitializer;
import org.springframework.web.context.support.AnnotationConfigWebApplicationContext;
import org.springframework.web.servlet.DispatcherServlet;
import org.springframework.web.servlet.support.AbstractAnnotationConfigDispatcherServletInitializer;
public class SpringWebAppInitializer extends
AbstractAnnotationConfigDispatcherServletInitializer {
@Override
protected Class<?>[] getRootConfigClasses() {
return new Class[] {ApplicationContextConfig.class};
//return null;
}
@Override
protected Class<?>[] getServletConfigClasses() {
return null;
}
@Override
protected String[] getServletMappings() {
return new String[] { "/" };
}
}
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.EnableWebMvc;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
import org.springframework.web.servlet.view.InternalResourceViewResolver;
import org.springframework.web.servlet.view.JstlView;
@Configuration
@ComponentScan(basePackages = { "com.vokmar" })
@EnableWebMvc
public class ApplicationContextConfig implements WebMvcConfigurer {
@Bean(name = "viewResolver")
public InternalResourceViewResolver getViewResolver() {
InternalResourceViewResolver viewResolver = new
InternalResourceViewResolver();
viewResolver.setPrefix("/WEB-INF/views/");
viewResolver.setSuffix(".jsp");
return viewResolver;
}
}
import java.util.Locale;
import javax.enterprise.inject.Model;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.servlet.ModelAndView;
@Controller
public class HelloWorldController {
@RequestMapping(value = "/boqpv", method = RequestMethod.GET)
public String home() {
return "home";
}
}
Как решить эту проблему?
Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'routerFunctionMapping' defined in org.springframework.web.servlet.config.annotation.DelegatingWebMvcConfiguration: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.web.servlet.function.support.RouterFunctionMapping]: Factory method 'routerFunctionMapping' threw exception; nested exception is java.lang.NoClassDefFoundError: com/fasterxml/jackson/databind/exc/InvalidDefinitionException|#]
Context initialization failed
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'routerFunctionMapping' defined in org.springframework.web.servlet.config.annotation.DelegatingWebMvcConfiguration: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.web.servlet.function.support.RouterFunctionMapping]: Factory method 'routerFunctionMapping' threw exception; nested exception is java.lang.NoClassDefFoundError: com/fasterxml/jackson/databind/exc/InvalidDefinitionException
at org.springframework.beans.factory.support.ConstructorResolver.instantiate(ConstructorResolver.java:645)
at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:625)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1338)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1177)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:557)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:517)
at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:323)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:321)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:202)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:879)
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:878)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:550)
at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:401)
at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:292)
at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:103)
at org.apache.catalina.core.StandardContext.contextListenerStart(StandardContext.java:5043)
at com.sun.enterprise.web.WebModule.contextListenerStart(WebModule.java:592)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:5612)
at com.sun.enterprise.web.WebModule.start(WebModule.java:540)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:917)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:900)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:684)
at com.sun.enterprise.web.WebContainer.loadWebModule(WebContainer.java:2044)
at com.sun.enterprise.web.WebContainer.loadWebModule(WebContainer.java:1690)
at com.sun.enterprise.web.WebApplication.start(WebApplication.java:107)
at org.glassfish.internal.data.EngineRef.start(EngineRef.java:122)
at org.glassfish.internal.data.ModuleInfo.start(ModuleInfo.java:291)
at org.glassfish.internal.data.ApplicationInfo.start(ApplicationInfo.java:352)
at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:500)
at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:219)
at org.glassfish.deployment.admin.DeployCommand.execute(DeployCommand.java:491)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$2$1.run(CommandRunnerImpl.java:540)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$2$1.run(CommandRunnerImpl.java:536)
at java.security.AccessController.doPrivileged(Native Method)
at javax.security.auth.Subject.doAs(Subject.java:360)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$2.execute(CommandRunnerImpl.java:535)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$3.run(CommandRunnerImpl.java:566)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$3.run(CommandRunnerImpl.java:558)
at java.security.AccessController.doPrivileged(Native Method)
at javax.security.auth.Subject.doAs(Subject.java:360)
at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:557)
at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:1465)
at com.sun.enterprise.v3.admin.CommandRunnerImpl.access$1300(CommandRunnerImpl.java:110)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1847)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1723)
at com.sun.enterprise.v3.admin.AdminAdapter.doCommand(AdminAdapter.java:534)
at com.sun.enterprise.v3.admin.AdminAdapter.onMissingResource(AdminAdapter.java:224)
at org.glassfish.grizzly.http.server.StaticHttpHandlerBase.service(StaticHttpHandlerBase.java:190)
at com.sun.enterprise.v3.services.impl.ContainerMapper$HttpHandlerCallable.call(ContainerMapper.java:463)
at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:168)
at org.glassfish.grizzly.http.server.HttpHandler.runService(HttpHandler.java:206)
at org.glassfish.grizzly.http.server.HttpHandler.doHandle(HttpHandler.java:180)
at org.glassfish.grizzly.http.server.HttpServerFilter.handleRead(HttpServerFilter.java:242)
at org.glassfish.grizzly.filterchain.ExecutorResolver$9.execute(ExecutorResolver.java:119)
at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeFilter(DefaultFilterChain.java:284)
at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeChainPart(DefaultFilterChain.java:201)
at org.glassfish.grizzly.filterchain.DefaultFilterChain.execute(DefaultFilterChain.java:133)
at org.glassfish.grizzly.filterchain.DefaultFilterChain.process(DefaultFilterChain.java:112)
at org.glassfish.grizzly.ProcessorExecutor.execute(ProcessorExecutor.java:77)
at org.glassfish.grizzly.nio.transport.TCPNIOTransport.fireIOEvent(TCPNIOTransport.java:539)
at org.glassfish.grizzly.strategies.AbstractIOStrategy.fireIOEvent(AbstractIOStrategy.java:112)
at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.run0(WorkerThreadIOStrategy.java:117)
at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.access$100(WorkerThreadIOStrategy.java:56)
at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy$WorkerThreadRunnable.run(WorkerThreadIOStrategy.java:137)
at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:593)
at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.run(AbstractThreadPool.java:573)
at java.lang.Thread.run(Thread.java:748)
Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.web.servlet.function.support.RouterFunctionMapping]: Factory method 'routerFunctionMapping' threw exception; nested exception is java.lang.NoClassDefFoundError: com/fasterxml/jackson/databind/exc/InvalidDefinitionException
at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:185)
at org.springframework.beans.factory.support.ConstructorResolver.instantiate(ConstructorResolver.java:640)
... 67 more
----------
...
<properties>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
<endorsed.dir>${project.build.directory}/endorsed</endorsed.dir>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<failOnMissingWebXml>false</failOnMissingWebXml>
<jakartaee>8.0</jakartaee>
<spring.version>5.2.1.RELEASE</spring.version>
<jstl.version>1.2.1</jstl.version>
<tld.version>1.1.2</tld.version>
<servlets.version>3.1.0</servlets.version>
<jsp.version>2.3.1</jsp.version>
</properties>
....
Помогите, кто может…

