1

I'm having trouble running my Springboot Maven application. The problem started with a missing dependency which let to another issue i cant get fixed, i have tried multiple suggestions from throughout the web to no avail. I did remove the .m2 folder and did a fresh build but the same error comes back.

The error in my console:

***************************
APPLICATION FAILED TO START
***************************

Description:

An attempt was made to call a method that does not exist. The attempt was made from the following location:

    org.apache.shiro.spring.config.web.autoconfigure.ShiroWebFilterConfiguration.filterShiroFilterRegistrationBean(ShiroWebFilterConfiguration.java:63)

The following method did not exist:

    'void org.springframework.boot.web.servlet.FilterRegistrationBean.setDispatcherTypes(javax.servlet.DispatcherType, javax.servlet.DispatcherType[])'

The calling method's class, org.apache.shiro.spring.config.web.autoconfigure.ShiroWebFilterConfiguration, was loaded from the following location:

    jar:file:/E:/Mysoftware/apache-maven-3.9.5/repo/org/apache/shiro/shiro-spring-boot-starter/2.0.1/shiro-spring-boot-starter-2.0.1.jar!/org/apache/shiro/spring/config/web/autoconfigure/ShiroWebFilterConfiguration.class

The called method's class, org.springframework.boot.web.servlet.FilterRegistrationBean, is available from the following locations:

    jar:file:/E:/Mysoftware/apache-maven-3.9.5/repo/org/springframework/boot/spring-boot/3.3.1/spring-boot-3.3.1.jar!/org/springframework/boot/web/servlet/FilterRegistrationBean.class

The called method's class hierarchy was loaded from the following locations:

    org.springframework.boot.web.servlet.FilterRegistrationBean: file:/E:/Mysoftware/apache-maven-3.9.5/repo/org/springframework/boot/spring-boot/3.3.1/spring-boot-3.3.1.jar
    org.springframework.boot.web.servlet.AbstractFilterRegistrationBean: file:/E:/Mysoftware/apache-maven-3.9.5/repo/org/springframework/boot/spring-boot/3.3.1/spring-boot-3.3.1.jar
    org.springframework.boot.web.servlet.DynamicRegistrationBean: file:/E:/Mysoftware/apache-maven-3.9.5/repo/org/springframework/boot/spring-boot/3.3.1/spring-boot-3.3.1.jar
    org.springframework.boot.web.servlet.RegistrationBean: file:/E:/Mysoftware/apache-maven-3.9.5/repo/org/springframework/boot/spring-boot/3.3.1/spring-boot-3.3.1.jar


Action:

Correct the classpath of your application so that it contains compatible versions of the classes org.apache.shiro.spring.config.web.autoconfigure.ShiroWebFilterConfiguration and org.springframework.boot.web.servlet.FilterRegistrationBean


Process finished with exit code 1

My pom.xml:

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>3.3.1</version>
        <relativePath/> <!-- lookup parent from repository -->
    </parent>
    <groupId>com.example</groupId>
    <artifactId>shiro_springboot</artifactId>
    <version>0.0.1-SNAPSHOT</version>
    <name>shiro_springboot</name>
    <description>shiro_springboot</description>
    <url/>
    <licenses>
        <license/>
    </licenses>
    <developers>
        <developer/>
    </developers>
    <scm>
        <connection/>
        <developerConnection/>
        <tag/>
        <url/>
    </scm>
    <properties>
        <maven.compiler.source>17</maven.compiler.source>
        <maven.compiler.target>17</maven.compiler.target>
    </properties>
    <dependencies>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter</artifactId>
        </dependency>

        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-test</artifactId>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>com.baomidou</groupId>
            <artifactId>mybatis-plus-spring-boot3-starter</artifactId>
            <version>3.5.7</version>
        </dependency>

        <dependency>
            <groupId>com.baomidou</groupId>
            <artifactId>mybatis-plus-generator</artifactId>
            <version>3.5.7</version>
        </dependency>

        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-freemarker</artifactId>
        </dependency>

        <dependency>
            <groupId>com.mysql</groupId>
            <artifactId>mysql-connector-j</artifactId>
            <scope>runtime</scope>
        </dependency>

        <dependency>
            <groupId>org.projectlombok</groupId>
            <artifactId>lombok</artifactId>
        </dependency>

        <dependency>
            <groupId>org.apache.shiro</groupId>
            <artifactId>shiro-spring-boot-web-starter</artifactId>
            <version>2.0.1</version>
        </dependency>

        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
        </dependency>

        <dependency>
            <groupId>javax.servlet</groupId>
            <artifactId>javax.servlet-api</artifactId>
            <version>4.0.1</version>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
                <configuration>
                    <excludes>
                        <exclude>
                            <groupId>org.projectlombok</groupId>
                            <artifactId>lombok</artifactId>
                        </exclude>
                    </excludes>
                </configuration>
            </plugin>
        </plugins>
    </build>

</project>

Any input is welcome.

1 Answer 1

0

SpringBoot version is not compatible with Shiro'version

In class(org.springframework.boot.web.servlet.FilterRegistrationBean), the method setDispatcherTypes(javax.servlet.DispatcherType, javax.servlet.DispatcherType[]) does not exist in SpringBoot, But Shiro need it.

You need to downgrade or upgrade version of SpringBoot/Shiro.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.