question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Exception starting filter [CustomFilter]

See original GitHub issue

Expected Behavior

Application should start

Current Behavior

Application does not start.

Instead the application fails to start and results in the exception

java.lang.NullPointerException: null
        at org.apache.catalina.core.ApplicationFilterConfig.initFilter(ApplicationFilterConfig.java:270)
	at org.apache.catalina.core.ApplicationFilterConfig.<init>(ApplicationFilterConfig.java:106)
	at org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:4530)
	at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5169)
	at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)

The affected line of code is in the class org.springframework.web.filter.GenericFilterBean. The application can not initialize the logger variable and therefore results in a NullPointerException.

Possible Solution

Unknown to me

Steps to Reproduce

Not needed. Just start the application with the chaos-monkey profile. When omitted the application will start normally.

Context (Environment)

  • A custom filter that extends the org.springframework.web.filter.GenericFilterBean
  • Spring Boot 2.1.7
  • JDK Amazon Corretto 11.04

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:1
  • Comments:10 (4 by maintainers)

github_iconTop GitHub Comments

3reactions
buderrecommented, Nov 29, 2019

Hey guys. I will try to reproduce the behavior with a small code example and reach out to you guys. Sorry for the delay.

2reactions
dkdewcommented, Jun 7, 2021

hi,

i was facing this issue with custom-filters in my spring-boot app. The application fails to run with chaos-monkey profile active, when we have declared the CustomFilter with @component annotation. The simple workaround is to create the filter with @Bean annotations.

Here is the example code, how i did it. https://github.com/dkdew/spring-boot-chaos-monkey-starting-filter

Read more comments on GitHub >

github_iconTop Results From Across the Web

SEVERE: Exception starting filter springSecurityFilterChain
The problem was an incompatibility between my version of Spring and the JDK. I used Spring 3.2 and JDK 1.8. When I changed...
Read more >
Custom Filter in the Spring Security Filter Chain - Baeldung
A quick guide to show steps to add custom filter in Spring Security ... We'll start by implementing the org.springframework.web.filter.
Read more >
Bugsnag docs › Product › Custom filters
Use custom filters to prioritize application errors. Filter errors by custom metrics, like pricing tier, A/B test variant, or anything else you choose....
Read more >
Custom filter fields - Analytics Help
Custom filter fields. The following tables list each available field and its purpose. Content ...
Read more >
Custom Filter in Spring Security | Java Development Journal
In this article, we will look at adding a custom filter in Spring Security ... FilterChain filterChain) throws IOException, ServletException ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found