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

Numerous logs mentioning a failed JNDI lookup when using Jetty #22241

Closed
filpano opened this issue Jul 7, 2020 · 5 comments
Closed

Numerous logs mentioning a failed JNDI lookup when using Jetty #22241

filpano opened this issue Jul 7, 2020 · 5 comments
Assignees
Labels
type: regression A regression from a previous release
Milestone

Comments

@filpano
Copy link

filpano commented Jul 7, 2020

Affects: 5.2.7.RELEASE

After migrating to Spring Boot 2.3.1.RELEASE / Spring 5.2.7.RELEASE, I am seeing the following DEBUG logs upon application startup (in fact, they are the very first log messages printed out):

2020-07-07 09:16:12.407 DEBUG 12015 --- [           main] org.springframework.jndi.JndiTemplate    : Looking up JNDI object with name [java:comp/env/logging.group]
2020-07-07 09:16:12.413 DEBUG 12015 --- [           main] o.e.jetty.jndi.InitialContextFactory     : InitialContextFactory.getInitialContext()
2020-07-07 09:16:12.413 DEBUG 12015 --- [           main] o.e.jetty.jndi.InitialContextFactory     : Created initial context delegate for local namespace:org.eclipse.jetty.jndi.local.localContextRoot@2fba3fc4
2020-07-07 09:16:12.414 DEBUG 12015 --- [           main] o.e.j.jndi.java.javaURLContextFactory    : >>> new root context requested 
2020-07-07 09:16:12.414 DEBUG 12015 --- [           main] org.eclipse.jetty.jndi.NamingContext     : Looking up name="comp/env/logging.group"
2020-07-07 09:16:12.415 DEBUG 12015 --- [           main] org.eclipse.jetty.jndi.ContextFactory    : Trying thread context classloader
2020-07-07 09:16:12.419 DEBUG 12015 --- [           main] org.eclipse.jetty.jndi.NamingContext     : Looking up name="env/logging.group"
2020-07-07 09:16:12.419 DEBUG 12015 --- [           main] o.s.jndi.JndiLocatorDelegate             : Converted JNDI name [java:comp/env/logging.group] not found - trying original name [logging.group]. javax.naming.NameNotFoundException: env is not bound; remaining name 'env/logging.group'
2020-07-07 09:16:12.419 DEBUG 12015 --- [           main] org.springframework.jndi.JndiTemplate    : Looking up JNDI object with name [logging.group]
2020-07-07 09:16:12.419 DEBUG 12015 --- [           main] o.e.jetty.jndi.InitialContextFactory     : InitialContextFactory.getInitialContext()
2020-07-07 09:16:12.419 DEBUG 12015 --- [           main] o.e.jetty.jndi.InitialContextFactory     : Created initial context delegate for local namespace:org.eclipse.jetty.jndi.local.localContextRoot@4bf48f6
2020-07-07 09:16:12.419 DEBUG 12015 --- [           main] o.e.jetty.jndi.local.localContextRoot    : Looking up name="logging.group"
2020-07-07 09:16:12.420 DEBUG 12015 --- [           main] o.s.jndi.JndiPropertySource              : JNDI lookup for name [logging.group] threw NamingException with message: null. Returning null.
2020-07-07 09:16:12.422 DEBUG 12015 --- [           main] org.springframework.jndi.JndiTemplate    : Looking up JNDI object with name [java:comp/env/logging.group]
2020-07-07 09:16:12.422 DEBUG 12015 --- [           main] o.e.jetty.jndi.InitialContextFactory     : InitialContextFactory.getInitialContext()
2020-07-07 09:16:12.422 DEBUG 12015 --- [           main] o.e.jetty.jndi.InitialContextFactory     : Created initial context delegate for local namespace:org.eclipse.jetty.jndi.local.localContextRoot@1c852c0f
2020-07-07 09:16:12.423 DEBUG 12015 --- [           main] o.e.j.jndi.java.javaURLContextFactory    : >>> new root context requested 
2020-07-07 09:16:12.423 DEBUG 12015 --- [           main] org.eclipse.jetty.jndi.NamingContext     : Looking up name="comp/env/logging.group"
2020-07-07 09:16:12.423 DEBUG 12015 --- [           main] org.eclipse.jetty.jndi.ContextFactory    : Trying thread context classloader
2020-07-07 09:16:12.423 DEBUG 12015 --- [           main] org.eclipse.jetty.jndi.NamingContext     : Looking up name="env/logging.group"
2020-07-07 09:16:12.423 DEBUG 12015 --- [           main] o.s.jndi.JndiLocatorDelegate             : Converted JNDI name [java:comp/env/logging.group] not found - trying original name [logging.group]. javax.naming.NameNotFoundException: env is not bound; remaining name 'env/logging.group'
2020-07-07 09:16:12.423 DEBUG 12015 --- [           main] org.springframework.jndi.JndiTemplate    : Looking up JNDI object with name [logging.group]
2020-07-07 09:16:12.423 DEBUG 12015 --- [           main] o.e.jetty.jndi.InitialContextFactory     : InitialContextFactory.getInitialContext()
2020-07-07 09:16:12.424 DEBUG 12015 --- [           main] o.e.jetty.jndi.InitialContextFactory     : Created initial context delegate for local namespace:org.eclipse.jetty.jndi.local.localContextRoot@a37aefe
2020-07-07 09:16:12.424 DEBUG 12015 --- [           main] o.e.jetty.jndi.local.localContextRoot    : Looking up name="logging.group"
2020-07-07 09:16:12.424 DEBUG 12015 --- [           main] o.s.jndi.JndiPropertySource              : JNDI lookup for name [logging.group] threw NamingException with message: null. Returning null.
2020-07-07 09:16:12.426 DEBUG 12015 --- [           main] org.springframework.jndi.JndiTemplate    : Looking up JNDI object with name [java:comp/env/logging.level]
2020-07-07 09:16:12.426 DEBUG 12015 --- [           main] o.e.jetty.jndi.InitialContextFactory     : InitialContextFactory.getInitialContext()
2020-07-07 09:16:12.426 DEBUG 12015 --- [           main] o.e.jetty.jndi.InitialContextFactory     : Created initial context delegate for local namespace:org.eclipse.jetty.jndi.local.localContextRoot@24c4ddae
2020-07-07 09:16:12.426 DEBUG 12015 --- [           main] o.e.j.jndi.java.javaURLContextFactory    : >>> new root context requested 
2020-07-07 09:16:12.426 DEBUG 12015 --- [           main] org.eclipse.jetty.jndi.NamingContext     : Looking up name="comp/env/logging.level"
2020-07-07 09:16:12.427 DEBUG 12015 --- [           main] org.eclipse.jetty.jndi.ContextFactory    : Trying thread context classloader
2020-07-07 09:16:12.427 DEBUG 12015 --- [           main] org.eclipse.jetty.jndi.NamingContext     : Looking up name="env/logging.level"
2020-07-07 09:16:12.427 DEBUG 12015 --- [           main] o.s.jndi.JndiLocatorDelegate             : Converted JNDI name [java:comp/env/logging.level] not found - trying original name [logging.level]. javax.naming.NameNotFoundException: env is not bound; remaining name 'env/logging.level'
2020-07-07 09:16:12.427 DEBUG 12015 --- [           main] org.springframework.jndi.JndiTemplate    : Looking up JNDI object with name [logging.level]
2020-07-07 09:16:12.427 DEBUG 12015 --- [           main] o.e.jetty.jndi.InitialContextFactory     : InitialContextFactory.getInitialContext()
2020-07-07 09:16:12.427 DEBUG 12015 --- [           main] o.e.jetty.jndi.InitialContextFactory     : Created initial context delegate for local namespace:org.eclipse.jetty.jndi.local.localContextRoot@37fb0bed
2020-07-07 09:16:12.427 DEBUG 12015 --- [           main] o.e.jetty.jndi.local.localContextRoot    : Looking up name="logging.level"
2020-07-07 09:16:12.428 DEBUG 12015 --- [           main] o.s.jndi.JndiPropertySource              : JNDI lookup for name [logging.level] threw NamingException with message: null. Returning null.
2020-07-07 09:16:12.428 DEBUG 12015 --- [           main] org.springframework.jndi.JndiTemplate    : Looking up JNDI object with name [java:comp/env/logging.level]
2020-07-07 09:16:12.429 DEBUG 12015 --- [           main] o.e.jetty.jndi.InitialContextFactory     : InitialContextFactory.getInitialContext()
2020-07-07 09:16:12.429 DEBUG 12015 --- [           main] o.e.jetty.jndi.InitialContextFactory     : Created initial context delegate for local namespace:org.eclipse.jetty.jndi.local.localContextRoot@a82c5f1
2020-07-07 09:16:12.429 DEBUG 12015 --- [           main] o.e.j.jndi.java.javaURLContextFactory    : >>> new root context requested 
2020-07-07 09:16:12.429 DEBUG 12015 --- [           main] org.eclipse.jetty.jndi.NamingContext     : Looking up name="comp/env/logging.level"
2020-07-07 09:16:12.429 DEBUG 12015 --- [           main] org.eclipse.jetty.jndi.ContextFactory    : Trying thread context classloader
2020-07-07 09:16:12.429 DEBUG 12015 --- [           main] org.eclipse.jetty.jndi.NamingContext     : Looking up name="env/logging.level"
2020-07-07 09:16:12.430 DEBUG 12015 --- [           main] o.s.jndi.JndiLocatorDelegate             : Converted JNDI name [java:comp/env/logging.level] not found - trying original name [logging.level]. javax.naming.NameNotFoundException: env is not bound; remaining name 'env/logging.level'
2020-07-07 09:16:12.430 DEBUG 12015 --- [           main] org.springframework.jndi.JndiTemplate    : Looking up JNDI object with name [logging.level]
2020-07-07 09:16:12.430 DEBUG 12015 --- [           main] o.e.jetty.jndi.InitialContextFactory     : InitialContextFactory.getInitialContext()
2020-07-07 09:16:12.430 DEBUG 12015 --- [           main] o.e.jetty.jndi.InitialContextFactory     : Created initial context delegate for local namespace:org.eclipse.jetty.jndi.local.localContextRoot@7b7fdc8
2020-07-07 09:16:12.430 DEBUG 12015 --- [           main] o.e.jetty.jndi.local.localContextRoot    : Looking up name="logging.level"
2020-07-07 09:16:12.430 DEBUG 12015 --- [           main] o.s.jndi.JndiPropertySource              : JNDI lookup for name [logging.level] threw NamingException with message: null. Returning null.
2020-07-07 09:16:12.433 DEBUG 12015 --- [           main] org.springframework.jndi.JndiTemplate    : Looking up JNDI object with name [java:comp/env/logging.level.org.company]
2020-07-07 09:16:12.433 DEBUG 12015 --- [           main] o.e.jetty.jndi.InitialContextFactory     : InitialContextFactory.getInitialContext()
2020-07-07 09:16:12.433 DEBUG 12015 --- [           main] o.e.jetty.jndi.InitialContextFactory     : Created initial context delegate for local namespace:org.eclipse.jetty.jndi.local.localContextRoot@7fc4780b
2020-07-07 09:16:12.433 DEBUG 12015 --- [           main] o.e.j.jndi.java.javaURLContextFactory    : >>> new root context requested 
2020-07-07 09:16:12.433 DEBUG 12015 --- [           main] org.eclipse.jetty.jndi.NamingContext     : Looking up name="comp/env/logging.level.org.company"
2020-07-07 09:16:12.434 DEBUG 12015 --- [           main] org.eclipse.jetty.jndi.ContextFactory    : Trying thread context classloader
2020-07-07 09:16:12.434 DEBUG 12015 --- [           main] org.eclipse.jetty.jndi.NamingContext     : Looking up name="env/logging.level.org.company"
2020-07-07 09:16:12.434 DEBUG 12015 --- [           main] o.s.jndi.JndiLocatorDelegate             : Converted JNDI name [java:comp/env/logging.level.org.company] not found - trying original name [logging.level.org.company]. javax.naming.NameNotFoundException: env is not bound; remaining name 'env/logging.level.org.company'
... some more

In my bootstrap.yaml I have the following:

logging:
  pattern:
    console: ${pattern.json}
  level:
    org.company: DEBUG
    root: INFO

This does not seem to affect my application at all, seeing how we do not use JNDI. However, I have been unable to turn these messages off and I am even surprised that they are logged at all (seeing how the root logger is set to INFO). The fact that it is trying to do a JNDI lookup for logging.level makes me think that this is some standard logging that is enabled in Spring itself, before Logback configuration has even been picked up.

@snicoll snicoll transferred this issue from spring-projects/spring-framework Jul 7, 2020
@snicoll
Copy link
Member

snicoll commented Jul 7, 2020

This does not seem to be related to the core framework so I've moved this issue to Spring Boot. It sounds like you're reporting an upgrade problem but you didn't mention the version of Spring Boot that you were using previously that didn't have the problem. If you revert to this version without changing anything else (including the Spring Cloud version), are those logs going away?

@snicoll snicoll added status: waiting-for-feedback We need additional information before we can continue status: waiting-for-triage An issue we've not yet triaged labels Jul 7, 2020
@filpano
Copy link
Author

filpano commented Jul 7, 2020

Thanks for the reply. I had initially created the issue in the main Spring tracker as the org.sprinfgramework.jndi.JndiTemplate that produces said logs is a spring-context component.

We migrated from Spring Boot 2.1.3.RELEASE / Spring 5.1.5.RELEASE. Unfortunately, I cannot run the application without changing anything else as there are incompatible Class changes between the versions.

Edit: FWIW, we also updated from Spring Cloud Stream Greenwich.SR2 to Hoxton.SR6. However, I don't think this has any bearing on the issue - our services which do not use Spring Cloud Stream are also showing this issue.

@spring-projects-issues spring-projects-issues added status: feedback-provided Feedback has been provided and removed status: waiting-for-feedback We need additional information before we can continue labels Jul 7, 2020
@silh
Copy link

silh commented Jul 20, 2020

There was an issue with Jetty JNDI being enabled by default in Spring Boot 1.X and it was fixed here - #4710.
Looks like the transitive dependency was reintroduced.
As a temporary fix you could exclude it in your pom, as it most like not used in Spring Boot application.

        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-jetty</artifactId>
            <exclusions>
                <exclusion>
                    <groupId>org.eclipse.jetty</groupId>
                    <artifactId>jetty-jndi</artifactId>
                </exclusion>
            </exclusions>
        </dependency>

The issue is not present in Spring Boot 2.1.0.RELEASE and is present in 2.3.1.RELEASE (I know the distance between the versions is long...).
The relevant part of dependency tree in 2.1.0:

[INFO] |  +- org.eclipse.jetty.websocket:javax-websocket-server-impl:jar:9.4.10.v20180503:compile
[INFO] |  |  +- org.eclipse.jetty:jetty-annotations:jar:9.4.10.v20180503:compile
[INFO] |  |  |  +- org.eclipse.jetty:jetty-plus:jar:9.4.10.v20180503:compile
[INFO] |  |  |  +- org.ow2.asm:asm:jar:6.1.1:compile
[INFO] |  |  |  \- org.ow2.asm:asm-commons:jar:6.1.1:compile
[INFO] |  |  |     +- org.ow2.asm:asm-tree:jar:6.1.1:compile
[INFO] |  |  |     \- org.ow2.asm:asm-analysis:jar:6.1.1:compile

And in 2.3.1:

[INFO] |  +- org.eclipse.jetty.websocket:javax-websocket-server-impl:jar:9.4.29.v20200521:compile
[INFO] |  |  +- org.eclipse.jetty:jetty-annotations:jar:9.4.29.v20200521:compile
[INFO] |  |  |  +- org.eclipse.jetty:jetty-plus:jar:9.4.29.v20200521:compile
[INFO] |  |  |  |  \- org.eclipse.jetty:jetty-jndi:jar:9.4.29.v20200521:compile
[INFO] |  |  |  +- org.ow2.asm:asm:jar:7.3.1:compile
[INFO] |  |  |  \- org.ow2.asm:asm-commons:jar:7.3.1:compile
[INFO] |  |  |     +- org.ow2.asm:asm-tree:jar:7.3.1:compile
[INFO] |  |  |     \- org.ow2.asm:asm-analysis:jar:7.3.1:compile

@snicoll
Copy link
Member

snicoll commented Jul 21, 2020

@silh thank you very much for the great detective work. We'll review dependency management and see what we can do to avoid that in the future.

@snicoll
Copy link
Member

snicoll commented Jul 21, 2020

From a quick look, it looks like a regression of us moving to Gradle.

@snicoll snicoll added type: regression A regression from a previous release and removed status: feedback-provided Feedback has been provided status: waiting-for-triage An issue we've not yet triaged labels Jul 21, 2020
@snicoll snicoll added this to the 2.3.x milestone Jul 21, 2020
@wilkinsona wilkinsona changed the title Numerous logs mentioning a failed JNDI lookup Numerous logs mentioning a failed JNDI lookup when using Jetty Jul 21, 2020
@wilkinsona wilkinsona self-assigned this Jul 21, 2020
@wilkinsona wilkinsona modified the milestones: 2.3.x, 2.3.2 Jul 21, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: regression A regression from a previous release
Projects
None yet
Development

No branches or pull requests

5 participants