Удаление ненужных jar-файлов из внешней библиотеки для развертывания на сервере Tomcat - PullRequest
0 голосов
/ 16 января 2020

Я пытаюсь выполнить развертывание на сервере Tomcat и получаю сообщение об ошибке ниже даже после удаления дублированных зависимостей (из maven я нажимаю «Очистить, а затем установить»).

Ошибка:

Description:

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

    org.springframework.boot.autoconfigure.security.oauth2.client.OAuth2ClientPropertiesRegistrationAdapter.getBuilderFromIssuerIfPossible(OAuth2ClientPropertiesRegistrationAdapter.java:83)

The following method did not exist:

    org.springframework.security.oauth2.client.registration.ClientRegistrations.fromIssuerLocation(Ljava/lang/String;)Lorg/springframework/security/oauth2/client/registration/ClientRegistration$Builder;

The method's class, org.springframework.security.oauth2.client.registration.ClientRegistrations, is available from the following locations:

    jar:file:/C:/Users/user/Desktop/apache-tomcat-8.5.50/webapps/E-Services-Portal-0.0.1-SNAPSHOT/WEB-INF/lib/spring-security-oauth2-client-5.1.0.RELEASE.jar!/org/springframework/security/oauth2/client/registration/ClientRegistrations.class
    jar:file:/C:/Users/user/Desktop/apache-tomcat-8.5.50/webapps/E-Services-Portal-0.0.1-SNAPSHOT/WEB-INF/lib/spring-security-oauth2-client-5.1.7.RELEASE.jar!/org/springframework/security/oauth2/client/registration/ClientRegistrations.class
    jar:file:/C:/Users/user/Desktop/apache-tomcat-8.5.50/webapps/E-Services-Portal-0.0.1-SNAPSHOT/WEB-INF/lib/spring-security-oauth2-client-5.2.1.RELEASE.jar!/org/springframework/security/oauth2/client/registration/ClientRegistrations.class

It was loaded from the following location:

    file:/C:/Users/user/Desktop/apache-tomcat-8.5.50/webapps/E-Services-Portal-0.0.1-SNAPSHOT/WEB-INF/lib/spring-security-oauth2-client-5.1.0.RELEASE.jar


Action:

Correct the classpath of your application so that it contains a single, compatible version of org.springframework.security.oauth2.client.registration.ClientRegistrations

Эта ошибка появляется после того, как я создаю свой war-файл, нажав «Установить» и скопировав файл и вставив его в папку webapp на сервере Tomcat, после чего при запуске tomcat для развертывания я получу ту же ошибку.

Это мой POM-файл, я думаю, что ошибка идет отсюда:

<?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>2.2.2.RELEASE</version>
    </parent>


    <groupId>com.baeldung.keycloak</groupId>
    <artifactId>E-Services-Portal</artifactId>
    <version>0.0.1-SNAPSHOT</version>
    <packaging>war</packaging>
    <name>E.Services.Portal</name>



    <properties>
        <java.version>1.8</java.version>
    </properties>

    <dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>org.keycloak.bom</groupId>
                <artifactId>keycloak-adapter-bom</artifactId>
                <version>3.3.0.Final</version>
                <type>pom</type>
                <scope>provided</scope>
            </dependency>
        </dependencies>
    </dependencyManagement>

        <dependencies>


            <dependency>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-starter-web</artifactId>
            </dependency>
            <dependency>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-starter-security</artifactId>
            </dependency>
            <dependency>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-starter-oauth2-client</artifactId>
            </dependency>
            <dependency>
                <groupId>org.springframework.security</groupId>
                <artifactId>spring-security-config</artifactId>
                <version>5.2.1.RELEASE</version>
            </dependency>

            <dependency>
                <groupId>org.springframework.security</groupId>
                <artifactId>spring-security-oauth2-jose</artifactId>
                <version>5.2.1.RELEASE</version>
            </dependency>
            <dependency>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-starter-tomcat</artifactId>
                <scope>provided</scope>
            </dependency>
            <dependency>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-starter-test</artifactId>
                <scope>test</scope>
                <exclusions>
                    <exclusion>
                        <groupId>org.junit.vintage</groupId>
                        <artifactId>junit-vintage-engine</artifactId>
                    </exclusion>
                </exclusions>
            </dependency>

            <dependency>
                <groupId>org.apache.tomcat.embed</groupId>
                <artifactId>tomcat-embed-jasper</artifactId>
                <scope>provided</scope>
            </dependency>
            <dependency>
                <groupId>javax.servlet</groupId>
                <artifactId>jstl</artifactId>
                <scope>provided</scope>
            </dependency>
            <dependency>
                <groupId>org.glassfish.web</groupId>
                <artifactId>el-impl</artifactId>
                <version>2.2</version>
            </dependency>

        </dependencies>


    <repositories>
        <repository>
            <id>central</id>
            <name>Maven Plugin Repository</name>
            <url>https://repo.maven.apache.org/maven2</url>
            <layout>default</layout>
            <snapshots>
                <enabled>false</enabled>
            </snapshots>
            <releases>
                <updatePolicy>never</updatePolicy>
            </releases>
        </repository>

    </repositories>

    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-war-plugin</artifactId>
                <version>3.2.3</version>
                <configuration>
                    <webappDirectory>/sample/servlet/container/deploy/directory</webappDirectory>
                </configuration>
            </plugin>

            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
            </plugin>
        </plugins>
    </build>

</project>
...