Невозможно проверить URL службы поддержки привода - PullRequest
0 голосов
/ 28 февраля 2020

Я использую верблюжий маршрут для предоставления службы отдыха, и я хотел проверить состояние работоспособности службы с базовой аутентификацией c с помощью привода с пружинной загрузкой. Итак, если служба (http://localhost: 8093 / risk / travelDocument ) запущена и работает, то служба здравоохранения (http://localhost: 8093 / привод / здоровье ) должна показать статус as ({"status": "UP"}).

Теперь я попробовал следующий код для вызова службы привода:

public class ActuatorSecurity extends WebSecurityConfigurerAdapter {

    @Value("${user.name}")
    private String systemUser;

    @Value("${user.password}")
    private String systemPassword;

    @Override
    protected void configure(final AuthenticationManagerBuilder auth)
            throws Exception {
        auth
                .inMemoryAuthentication()
                .withUser(systemUser)
                .password("{noop}" + systemPassword);
    }

    @Override
    protected void configure(final HttpSecurity http) throws Exception {
        http.csrf().disable()
        .authorizeRequests()
        .antMatchers("/**/*").authenticated()
        .and()
        .httpBasic();

    }
}

Мои application.properties выглядят следующим образом:

user.name=hello
user.password=hello

Я пытаюсь прочитать пароль пользователя из этого файла свойств и хочу выполнить базовую c аутентификацию службы работоспособности. Я могу получить всплывающее окно в браузере, но всякий раз, когда я пытаюсь ввести пароль, он выдает мне сообщение об ошибке:

ERROR 2020-02-28T02:28:16,894 [http-nio-8093-exec-7] []: [localhost] - Exception Processing ErrorPage[errorCode=0, location=/error]
java.lang.NoSuchMethodError: javax.servlet.http.HttpServletRequest.getHttpServletMapping()Ljavax/servlet/http/HttpServletMapping;
    at org.apache.catalina.core.ApplicationHttpRequest.setRequest(ApplicationHttpRequest.java:690) ~[tomcat-embed-core-9.0.17.jar:9.0.17]
    at org.apache.catalina.core.ApplicationHttpRequest.<init>(ApplicationHttpRequest.java:114) ~[tomcat-embed-core-9.0.17.jar:9.0.17]
    at org.apache.catalina.core.ApplicationDispatcher.wrapRequest(ApplicationDispatcher.java:917) ~[tomcat-embed-core-9.0.17.jar:9.0.17]
    at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:358) ~[tomcat-embed-core-9.0.17.jar:9.0.17]
    at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:312) ~[tomcat-embed-core-9.0.17.jar:9.0.17]
    at org.apache.catalina.core.StandardHostValve.custom(StandardHostValve.java:394) [tomcat-embed-core-9.0.17.jar:9.0.17]
    at org.apache.catalina.core.StandardHostValve.status(StandardHostValve.java:253) [tomcat-embed-core-9.0.17.jar:9.0.17]
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:175) [tomcat-embed-core-9.0.17.jar:9.0.17]
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:92) [tomcat-embed-core-9.0.17.jar:9.0.17]
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:74) [tomcat-embed-core-9.0.17.jar:9.0.17]
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:343) [tomcat-embed-core-9.0.17.jar:9.0.17]
    at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:408) [tomcat-embed-core-9.0.17.jar:9.0.17]
    at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66) [tomcat-embed-core-9.0.17.jar:9.0.17]
    at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:834) [tomcat-embed-core-9.0.17.jar:9.0.17]
    at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1415) [tomcat-embed-core-9.0.17.jar:9.0.17]
    at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49) [tomcat-embed-core-9.0.17.jar:9.0.17]
    at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) [?:1.8.0_181]
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) [?:1.8.0_181]
    at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) [tomcat-embed-core-9.0.17.jar:9.0.17]
    at java.lang.Thread.run(Unknown Source) [?:1.8.0_181]
DEBUG 2020-02-28T02:28:16,902 [http-nio-8093-exec-8] []: FilterChainProxy - /actuator/health at position 1 of 11 in additional filter chain; firing Filter: 'WebAsyncManagerIntegrationFilter'
DEBUG 2020-02-28T02:28:16,902 [http-nio-8093-exec-8] []: FilterChainProxy - /actuator/health at position 2 of 11 in additional filter chain; firing Filter: 'SecurityContextPersistenceFilter'
DEBUG 2020-02-28T02:28:16,902 [http-nio-8093-exec-8] []: HttpSessionSecurityContextRepository - HttpSession returned null object for SPRING_SECURITY_CONTEXT
DEBUG 2020-02-28T02:28:16,902 [http-nio-8093-exec-8] []: HttpSessionSecurityContextRepository - No SecurityContext was available from the HttpSession: org.apache.catalina.session.StandardSessionFacade@1d532f1c. A new one will be created.
DEBUG 2020-02-28T02:28:16,902 [http-nio-8093-exec-8] []: FilterChainProxy - /actuator/health at position 3 of 11 in additional filter chain; firing Filter: 'HeaderWriterFilter'
DEBUG 2020-02-28T02:28:16,902 [http-nio-8093-exec-8] []: FilterChainProxy - /actuator/health at position 4 of 11 in additional filter chain; firing Filter: 'LogoutFilter'
DEBUG 2020-02-28T02:28:16,902 [http-nio-8093-exec-8] []: OrRequestMatcher - Trying to match using Ant [pattern='/logout', GET]
DEBUG 2020-02-28T02:28:16,902 [http-nio-8093-exec-8] []: AntPathRequestMatcher - Checking match of request : '/actuator/health'; against '/logout'
DEBUG 2020-02-28T02:28:16,902 [http-nio-8093-exec-8] []: OrRequestMatcher - Trying to match using Ant [pattern='/logout', POST]
DEBUG 2020-02-28T02:28:16,903 [http-nio-8093-exec-8] []: AntPathRequestMatcher - Request 'GET /actuator/health' doesn't match 'POST /logout'
DEBUG 2020-02-28T02:28:16,903 [http-nio-8093-exec-8] []: OrRequestMatcher - Trying to match using Ant [pattern='/logout', PUT]
DEBUG 2020-02-28T02:28:16,903 [http-nio-8093-exec-8] []: AntPathRequestMatcher - Request 'GET /actuator/health' doesn't match 'PUT /logout'
DEBUG 2020-02-28T02:28:16,903 [http-nio-8093-exec-8] []: OrRequestMatcher - Trying to match using Ant [pattern='/logout', DELETE]
DEBUG 2020-02-28T02:28:16,903 [http-nio-8093-exec-8] []: AntPathRequestMatcher - Request 'GET /actuator/health' doesn't match 'DELETE /logout'
DEBUG 2020-02-28T02:28:16,903 [http-nio-8093-exec-8] []: OrRequestMatcher - No matches found
DEBUG 2020-02-28T02:28:16,903 [http-nio-8093-exec-8] []: FilterChainProxy - /actuator/health at position 5 of 11 in additional filter chain; firing Filter: 'BasicAuthenticationFilter'
DEBUG 2020-02-28T02:28:16,903 [http-nio-8093-exec-8] []: FilterChainProxy - /actuator/health at position 6 of 11 in additional filter chain; firing Filter: 'RequestCacheAwareFilter'
DEBUG 2020-02-28T02:28:16,903 [http-nio-8093-exec-8] []: DefaultSavedRequest - pathInfo: arg1=/actuator/health; arg2=/actuator/health (property equals)
DEBUG 2020-02-28T02:28:16,903 [http-nio-8093-exec-8] []: DefaultSavedRequest - queryString: both null (property equals)
DEBUG 2020-02-28T02:28:16,903 [http-nio-8093-exec-8] []: DefaultSavedRequest - requestURI: arg1=/actuator/health; arg2=/actuator/health (property equals)
DEBUG 2020-02-28T02:28:16,903 [http-nio-8093-exec-8] []: DefaultSavedRequest - serverPort: arg1=8093; arg2=8093 (property equals)
DEBUG 2020-02-28T02:28:16,903 [http-nio-8093-exec-8] []: DefaultSavedRequest - requestURL: arg1=http://localhost:8093/actuator/health; arg2=http://localhost:8093/actuator/health (property equals)
DEBUG 2020-02-28T02:28:16,903 [http-nio-8093-exec-8] []: DefaultSavedRequest - scheme: arg1=http; arg2=http (property equals)
DEBUG 2020-02-28T02:28:16,903 [http-nio-8093-exec-8] []: DefaultSavedRequest - serverName: arg1=localhost; arg2=localhost (property equals)
DEBUG 2020-02-28T02:28:16,903 [http-nio-8093-exec-8] []: DefaultSavedRequest - contextPath: arg1=; arg2= (property equals)
DEBUG 2020-02-28T02:28:16,903 [http-nio-8093-exec-8] []: DefaultSavedRequest - servletPath: arg1=; arg2= (property equals)

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>aero.travel.gsl.servicebus</groupId>
        <artifactId>servicebus-parent</artifactId>
        <version>4.11</version>
    </parent>

    <groupId>aero.travel.gsl.ee.services</groupId>
    <artifactId>risk-assessment</artifactId>
    <version>1.0.2-SNAPSHOT</version>
    <name>risk-assessment</name>
    <description>RiskAssessmentService</description>

    <properties>
        <artifact.name>bcRiskAssessmentSrv</artifact.name>
        <java.version>1.8</java.version>
        <riskmanager.api.version>6.2</riskmanager.api.version>
        <servicebus.utilities.version>7.2</servicebus.utilities.version>
        <camel.version>2.24.0</camel.version>
        <org.jvnet.jaxb2_commons.version>0.12.0
        </org.jvnet.jaxb2_commons.version>
        <tomcat.version>8.5.37</tomcat.version>
        <project.scm.id>pse-gitlab</project.scm.id> 
    </properties>
    <scm>
        <developerConnection>scm:git:https://prodgit.lon.dc.travel.aero:9443/bordermanagement/components/primary-line/services/risk-assessment.git</developerConnection>
        <tag>HEAD</tag>
    </scm>
    <dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>org.apache.camel</groupId>
                <artifactId>camel-spring-boot-dependencies</artifactId>
                <version>${camel.version}</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>
            <dependency>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-dependencies</artifactId>
                <version>2.1.4.RELEASE</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>
        </dependencies>
    </dependencyManagement>

    <!-- <distributionManagement>
        <site>
            <id>www.travel.aero</id>
            using scp avoids the localhost directory
            <url>scp://</url>
        </site>
        <snapshotRepository>
            <id>snapshots</id>
            <name>travel Entry Exit Private Internal Repository</name>
            <url>http://10.70.101.235:8080/nexus/repository/snapshots</url>
        </snapshotRepository>
    </distributionManagement> -->
    <dependencies>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter</artifactId>
            <exclusions>
                <exclusion>
                    <groupId>org.springframework.boot</groupId>
                    <artifactId>spring-boot-starter-logging</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-security</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-actuator</artifactId>
        </dependency>
        <dependency>
            <groupId>org.apache.camel</groupId>
            <artifactId>camel-servlet-starter</artifactId>
        </dependency>
        <dependency>
            <groupId>org.apache.camel</groupId>
            <artifactId>camel-jackson</artifactId>
        </dependency>
        <dependency>
            <groupId>org.apache.camel</groupId>
            <artifactId>camel-stream-starter</artifactId>
        </dependency>
        <dependency>
            <groupId>io.springfox</groupId>
            <artifactId>springfox-swagger2</artifactId>
            <version>2.9.2</version>
        </dependency>
        <dependency>
            <groupId>org.jvnet.jaxb2_commons</groupId>
            <artifactId>jaxb2-basics-runtime</artifactId>
            <version>${org.jvnet.jaxb2_commons.version}</version>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-log4j2</artifactId>
        </dependency>
        <dependency>
            <groupId>aero.travel.gsl.eventmanager</groupId>
            <artifactId>eventmanager-api</artifactId>
            <version>37.4</version>
        </dependency>
        <dependency>
            <groupId>aero.travel.gsl.ee</groupId>
            <artifactId>services-api</artifactId>
            <version>1.0.0</version>
            <scope>compile</scope>
        </dependency>
    </dependencies>
    <build>
        <finalName>${artifact.name}</finalName>
        <plugins>
            <plugin>
                <artifactId>maven-deploy-plugin</artifactId>
                <version>2.8.2</version>
                <executions>
                    <execution>
                        <id>default-deploy</id>
                        <configuration>
                            <skip>true</skip>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-dependency-plugin</artifactId>
                <executions>
                    <execution>
                        <id>unpack-common-schemas</id>
                        <phase>initialize</phase>
                        <goals>
                            <goal>unpack</goal>
                        </goals>
                        <configuration>
                            <artifactItems>
                                <artifactItem>
                                    <groupId>aero.travel.gsl.common</groupId>
                                    <artifactId>common-xmlBindings</artifactId>
                                    <type>jar</type>
                                    <overWrite>true</overWrite>
                                </artifactItem>
                                <artifactItem>
                                    <groupId>aero.travel.gsl.common</groupId>
                                    <artifactId>common-external-xmlInterfaces</artifactId>
                                    <type>jar</type>
                                    <overWrite>true</overWrite>
                                </artifactItem>
                                <artifactItem>
                                    <groupId>aero.travel.gsl.eventmanager</groupId>
                                    <artifactId>eventmanager-api</artifactId>
                                    <type>jar</type>
                                    <overWrite>true</overWrite>
                                </artifactItem>
                                <artifactItem>
                                    <groupId>aero.travel.gsl.person</groupId>
                                    <artifactId>person-api</artifactId>
                                    <type>jar</type>
                                    <overWrite>true</overWrite>
                                </artifactItem>
                                <artifactItem>
                                    <groupId>aero.travel.gsl.common</groupId>
                                    <artifactId>common-xmlInterfaces</artifactId>
                                    <type>jar</type>
                                    <overWrite>true</overWrite>
                                </artifactItem>
                            </artifactItems>
                            <outputDirectory>${project.build.directory}</outputDirectory>
                            <includes>
                                schema/common/**/CommonTypes.xsd,
                                schema/irisk/**/RiskCommon.xsd,
                                external/schema/common/**/externalCommonTypes.xsd,
                                external/schema/common/**/externalCommonDomainTypes.xsd,
                                external/schema/event/common/**/externalEventCommonTypes.xsd,
                                external/schema/event/**/externalEventTypes.xsd,
                                external/schema/event/expected/**/externalExpectedMovementEventTypes.xsd,
                                external/schema/event/movement/**/externalMovementEventTypes.xsd,
                                external/schema/event/risk/**/externalRiskAssessmentEventTypes.xsd,
                                external/schema/identity/**/externalIdentityTypes.xsd,
                                schema/common/*-types.xsd,
                                bindings/common-binding.xjb
                            </includes>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-resources-plugin</artifactId>
                <executions>
                    <execution>
                        <id>copy-internal-assessrisk-resources</id>
                        <phase>initialize</phase>
                        <goals>
                            <goal>copy-resources</goal>
                        </goals>
                        <configuration>
                            <outputDirectory>${project.build.directory}/external/schema
                            </outputDirectory>
                            <resources>
                                <resource>
                                    <directory>${project.basedir}/src/main/resources/external/schema
                                    </directory>
                                    <filtering>false</filtering>
                                </resource>
                            </resources>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.jvnet.jaxb2.maven2</groupId>
                <artifactId>maven-jaxb2-plugin</artifactId>
                <executions>
                    <execution>
                        <id>jaxb2-generate-code-from-schemas</id>
                        <phase>generate-sources</phase>
                        <goals>
                            <goal>generate</goal>
                        </goals>
                        <configuration>
                            <generateDirectory>${project.build.directory}/generated-sources/model
                            </generateDirectory>
                            <removeOldOutput>false</removeOldOutput>
                            <forceRegenerate>false</forceRegenerate>
                            <extension>true</extension>
                            <strict>false</strict>
                            <schemaDirectory>${project.build.directory}/external/schema
                            </schemaDirectory>
                            <schemaIncludes>
                                <include>assessrisk/**/RiskAssessmentServiceTypes.xsd</include>
                                <include>eventservice/EventServiceWsdlType.xsd</include>
                            </schemaIncludes>
                            <bindingDirectory>${project.build.directory}/binding
                            </bindingDirectory>
                            <bindingIncludes>
                                <include>common-binding.xjb</include>
                            </bindingIncludes>
                            <addIfExistsToEpisodeSchemaBindings>true
                            </addIfExistsToEpisodeSchemaBindings>
                            <episodes>
                                <episode>
                                    <groupId>aero.travel.gsl.common</groupId>
                                    <artifactId>common-external-xmlInterfaces</artifactId>
                                </episode>
                                <episode>
                                    <groupId>aero.travel.gsl.eventmanager</groupId>
                                    <artifactId>eventmanager-api</artifactId>
                                </episode>
                                <episode>
                                    <groupId>aero.travel.gsl.person</groupId>
                                    <artifactId>person-api</artifactId>
                                </episode>
                            </episodes>
                            <args>
                                <arg>-camelcase-always</arg>
                                <arg>-bcsxjc-plugin</arg>
                                <arg>-extension</arg>
                                <arg>-nv</arg>
                                <arg>-verbose</arg>
                                <arg>-npa</arg>
                                <arg>-XtoString</arg>
                            </args>
                            <plugins>
                                <plugin>
                                    <groupId>nf.xjc.addon</groupId>
                                    <artifactId>camelcase-always-plugin</artifactId>
                                    <version>${camelcase-always-plugin.version}</version>
                                </plugin>
                                <plugin>
                                    <groupId>aero.travel.gsl.tools.xjc</groupId>
                                    <artifactId>bcsxjc</artifactId>
                                    <version>${bcs-xjc.version}</version>
                                </plugin>
                                <plugin>
                                    <groupId>org.jvnet.jaxb2_commons</groupId>
                                    <artifactId>jaxb2-basics</artifactId>
                                    <version>${org.jvnet.jaxb2_commons.version}</version>
                                </plugin>
                            </plugins>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>build-helper-maven-plugin</artifactId>
                <executions>
                    <execution>
                        <id>add-schemas</id>
                        <phase>generate-sources</phase>
                        <goals>
                            <goal>add-resource</goal>
                        </goals>
                        <configuration>
                            <resources>
                                <resource>
                                    <directory>target/external/schema</directory>
                                    <targetPath>external/schema</targetPath>
                                </resource>
                                <resource>
                                    <directory>target/schema</directory>
                                    <targetPath>schemas</targetPath>
                                </resource>
                            </resources>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
                <configuration>
                    <mainClass>aero.travel.gsl.ee.services.riskassessmentservice.RiskAssessmentApplication
                    </mainClass>
                </configuration>
                <executions>
                    <execution>
                        <goals>
                            <goal>repackage</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <artifactId>maven-assembly-plugin</artifactId>
                <configuration>
                    <descriptors>
                        <descriptor>assembly.xml</descriptor>
                    </descriptors>
                </configuration>
                <executions>
                    <execution>
                        <phase>package</phase>
                        <goals>
                            <goal>single</goal>
                        </goals>
                        <configuration>
                            <appendAssemblyId>false</appendAssemblyId>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
              <groupId>org.apache.maven.plugins</groupId>
              <artifactId>maven-checkstyle-plugin</artifactId>
              <version>${version.checkstyle.plugin}</version>
              <executions>
                <execution>
                  <id>checkstyle</id>
                  <goals>
                    <goal>check</goal>
                  </goals>
                </execution>
              </executions>
              <configuration>
                <encoding>UTF-8</encoding>
                <suppressionsLocation>CommonResources/resources/checkstyle-rules/checkstyle-suppressions.xml</suppressionsLocation>
                <propertyExpansion>samedir=${project.build.directory}</propertyExpansion>
                <configLocation>CommonResources/resources/checkstyle-rules/checkstyle-bcs.xml</configLocation>
                <outputDirectory>${project.build.directory}</outputDirectory>
                <enableFilesSummary>true</enableFilesSummary>
                <sourceDirectories>
                  <sourceDirectory>${project.basedir}/src/main/java/aero/</sourceDirectory>
                </sourceDirectories>
                <cacheFile>${project.build.directory}/checkstylecache</cacheFile>
                <failOnViolation>false</failOnViolation>
                <excludes>**/target/**/*,**/generated/**/*,**/riskassessmentservice/RiskAssessmentApplication.java</excludes>
                <resourceExcludes>**/target/**/*</resourceExcludes>
              </configuration>
              <dependencies>
                <dependency>
                  <groupId>aero.travel.gsl.common</groupId>
                  <artifactId>common-resources</artifactId>
                  <version>${common.resources.version}</version>
                </dependency>
                <dependency>
                  <groupId>com.puppycrawl.tools</groupId>
                  <artifactId>checkstyle</artifactId>
                  <version>${version.checkstyle}</version>
                </dependency>
              </dependencies>
            </plugin> 
        </plugins>
    </build>
</project>

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...