J
J
Jake Taylor2021-10-29 18:22:34
Spring
Jake Taylor, 2021-10-29 18:22:34

What is the reason for the An attempt was made to call a method that does not exist error?

I'm trying to start a Spring Boot application and I get an error:

Description:
An attempt was made to call a method that does not exist. The attempt was made from the following location:
org.springframework.context.expression.StandardBeanExpressionResolver.evaluate(StandardBeanExpressionResolver.java:160)

The following method did not exist:
org.springframework.expression.spel.support.StandardTypeConverter.<init>(Ljava/util/function/Supplier;)V

The method's class, org.springframework.expression.spel.support.StandardTypeConverter, is available from the following locations:
jar:file:/C:/Users/n199a/.m2/repository/org/springframework/spring-expression/5.3.10/spring-expression-5.3.10.jar!/org/springframework/expression/spel/support/StandardTypeConverter.class

The class hierarchy was loaded from the following locations:
org.springframework.expression.spel.support.StandardTypeConverter: file:/C:/Users/n199a/.m2/repository/org/springframework/spring-expression/5.3.10/spring-expression-5.3.10.jar

Action:
Correct the classpath of your application so that it contains a single, compatible version of org.springframework.expression.spel.support.StandardTypeConverter

Process finished with exit code 1


The only thing I suspect is my custom Enum to String converter:
EsmConfiguration.java

@Profile("dev")
@Configuration
@EnableTransactionManagement
public class EsmConfiguration implements WebMvcConfigurer {
    
    @Override
    public void addFormatters(FormatterRegistry registry) {
        registry.addConverter(new StringToColumnNameConverter());
        registry.addConverter(new StringToSqlSortOperatorConverter());
        registry.addConverter(new StringToRequestParameterConverter());
    }
}


This is what one of the converters looks like inside (nothing out of the ordinary):
public class StringToColumnNameConverter implements Converter<String, ColumnName> {
    @Override
    public ColumnName convert(@NotBlank String source) {
        return ColumnName.valueOf(source.toUpperCase());
    }
}

Answer the question

In order to leave comments, you need to log in

1 answer(s)
J
Jake Taylor, 2021-10-29
@n199a

Found, in `pom.xml` there were inconsistencies in the versions of the connected libraries. I have had:

<dependency> <!-- For annotations -->
                <groupId>org.springframework</groupId>
                <artifactId>spring-context</artifactId>
                <version>5.3.12</version>
</dependency>

But you must:
<dependency> <!-- For annotations -->
                <groupId>org.springframework</groupId>
                <artifactId>spring-context</artifactId>
                <version>5.3.10</version>
</dependency>

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question