Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Warning from AprLifecycleListener when using Tomcat Native and Tomcat 9.0.55 or later #28814

Closed
joca-bt opened this issue Nov 25, 2021 · 2 comments
Labels
type: bug A general bug
Milestone

Comments

@joca-bt
Copy link
Contributor

joca-bt commented Nov 25, 2021

We've upgraded from Spring Boot 2.5.6 to Spring Boot 2.6.0 and noticed we are getting a new warning when using Tomcat with the Apache Tomcat Native library. This warning doesn't occur in 2.5.6.

2021-11-25 12:26:19.582  INFO 46736 --- [           main] com.example.demo.MainApplication         : Starting MainApplication using Java 17 on darkstar with PID 46736 (/home/joguerra/Workspace/api-tester/demo/target/classes started by joguerra in /home/joguerra/Workspace/api-tester/demo)
2021-11-25 12:26:19.584  INFO 46736 --- [           main] com.example.demo.MainApplication         : No active profile set, falling back to default profiles: default
2021-11-25 12:26:20.430  INFO 46736 --- [           main] o.s.b.w.embedded.tomcat.TomcatWebServer  : Tomcat initialized with port(s): 8080 (http)
2021-11-25 12:26:20.438  INFO 46736 --- [           main] o.apache.catalina.core.StandardService   : Starting service [Tomcat]
2021-11-25 12:26:20.439  INFO 46736 --- [           main] org.apache.catalina.core.StandardEngine  : Starting Servlet engine: [Apache Tomcat/9.0.55]
2021-11-25 12:26:20.440  WARN 46736 --- [           main] o.a.catalina.core.AprLifecycleListener   : This listener must only be nested within Server elements, but is in [TomcatEmbeddedContext].
2021-11-25 12:26:20.440  INFO 46736 --- [           main] o.a.catalina.core.AprLifecycleListener   : Loaded Apache Tomcat Native library [1.2.31] using APR version [1.7.0].
2021-11-25 12:26:20.440  INFO 46736 --- [           main] o.a.catalina.core.AprLifecycleListener   : APR capabilities: IPv6 [true], sendfile [true], accept filters [false], random [true], UDS [true].
2021-11-25 12:26:20.440  INFO 46736 --- [           main] o.a.catalina.core.AprLifecycleListener   : APR/OpenSSL configuration: useAprConnector [false], useOpenSSL [true]
2021-11-25 12:26:20.444  INFO 46736 --- [           main] o.a.catalina.core.AprLifecycleListener   : OpenSSL successfully initialized [OpenSSL 1.1.1l  24 Aug 2021]
2021-11-25 12:26:20.500  INFO 46736 --- [           main] o.a.c.c.C.[Tomcat].[localhost].[/]       : Initializing Spring embedded WebApplicationContext
2021-11-25 12:26:20.500  INFO 46736 --- [           main] w.s.c.ServletWebServerApplicationContext : Root WebApplicationContext: initialization completed in 873 ms
2021-11-25 12:26:20.829  INFO 46736 --- [           main] o.s.b.w.embedded.tomcat.TomcatWebServer  : Tomcat started on port(s): 8080 (http) with context path ''
2021-11-25 12:26:20.836  INFO 46736 --- [           main] com.example.demo.MainApplication         : Started MainApplication in 1.546 seconds (JVM running for 1.878)

Example minimal application:

package com.example.demo;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

@SpringBootApplication
public class MainApplication {
    public static void main(String[] args) {
        SpringApplication.run(MainApplication.class, args);
    }
}

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
                             http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <groupId>com.example</groupId>
    <artifactId>demo</artifactId>
    <version>1.0-SNAPSHOT</version>

    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>2.6.0</version>
    </parent>

    <properties>
        <java.version>11</java.version>
    </properties>

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

    <build>
        <plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
            </plugin>
        </plugins>
    </build>
</project>
@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Nov 25, 2021
@wilkinsona wilkinsona changed the title Warning from AprLifecycleListener in Spring Boot 2.6.0 when using Tomcat Native Warning from AprLifecycleListener when using Tomcat Native and Tomcat 9.0.55 or later Nov 25, 2021
@wilkinsona
Copy link
Member

Thanks for the report. The warning's due to a change in Tomcat 9.0.55. It's benign as Boot only has a single Context. Nevertheless, we should avoid it being logged by moving the listener to the Server.

@wilkinsona wilkinsona added type: bug A general bug and removed status: waiting-for-triage An issue we've not yet triaged labels Nov 25, 2021
@wilkinsona wilkinsona added this to the 2.5.x milestone Nov 25, 2021
@michael-o
Copy link

Thanks for the report. The warning's due to a change in Tomcat 9.0.55. It's benign as Boot only has a single Context. Nevertheless, we should avoid it being logged by moving the listener to the Server.

This is the outcome of #28472. You will have two distinct contexts when Actuator is on. Although it is not clear to me why it must create two Tomcat instances at all. Imho, one instances with two Servces should be enough.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug A general bug
Projects
None yet
Development

No branches or pull requests

4 participants