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

"Cache miss for REQUEST dispatch to '/admin' error caused #31880

Closed
PgmJun opened this issue Dec 21, 2023 · 10 comments
Closed

"Cache miss for REQUEST dispatch to '/admin' error caused #31880

PgmJun opened this issue Dec 21, 2023 · 10 comments
Labels
status: invalid An issue that we don't feel is valid

Comments

@PgmJun
Copy link

PgmJun commented Dec 21, 2023

Affects: Springboot 3.2.0

I am currently using Spring Security.
However, when accessing the admin page, the error log written below occurs and 404 Not Found error occurs for all pages.
May I know what's causing this?

Error Log

WARN 9473 --- [nio-8080-exec-1] o.s.w.s.h.HandlerMappingIntrospector     : Cache miss for REQUEST dispatch to '/admin' (previous null). Performing CorsConfiguration lookup. This is logged once only at WARN level, and every time at TRACE. 
WARN 9473 --- [nio-8080-exec-1] o.s.w.s.h.HandlerMappingIntrospector     : Cache miss for REQUEST dispatch to '/admin' (previous null). Performing MatchableHandlerMapping lookup. This is logged once only at WARN level, and every time at TRACE.

ScreenShot

스크린샷 2023-12-21 오후 5 00 39

SecurityConfig

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.security.config.Customizer;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
import org.springframework.security.config.annotation.web.configurers.AbstractHttpConfigurer;
import org.springframework.security.web.SecurityFilterChain;

@Configuration
@EnableWebSecurity
public class SecurityConfig {

    @Bean
    public SecurityFilterChain securityFilterChain(HttpSecurity http) throws Exception {
        http
                .authorizeHttpRequests((authorize) -> authorize
                        .requestMatchers("/admin/**").authenticated()
                        .anyRequest().permitAll())
                .formLogin(Customizer.withDefaults())
                .httpBasic(Customizer.withDefaults())
                .csrf(AbstractHttpConfigurer::disable);

        return http.build();
    }
}

@PgmJun PgmJun changed the title I don't know why "Cache miss for REQUEST dispatch to '/admin" caused "Cache miss for REQUEST dispatch to '/admin' error caused Dec 21, 2023
@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged or decided on label Dec 21, 2023
@bclozel
Copy link
Member

bclozel commented Dec 21, 2023

The error log is related to spring-projects/spring-security#14128.

The 404 issue is completely independent. Is there a controller mapped at this endpoint? Can you share a minimal sample that demonstrates this?

@bclozel bclozel added the status: waiting-for-feedback We need additional information before we can continue label Dec 21, 2023
@PgmJun
Copy link
Author

PgmJun commented Dec 21, 2023

The 404 issue is completely independent. Is there a controller mapped at this endpoint? Can you share a minimal sample that demonstrates this?

sure!
this is controller code.

Controller

@Controller
@RequiredArgsConstructor(access = AccessLevel.PROTECTED)
public class ApplicantController {
    private final ApplicantService applicantService;

    @GetMapping("/admin")
    public String moveAdminPage(Model model) {
        model.addAttribute("applicants", applicantService.findAllApplicantInfo());
        return "admin";
    }

@PgmJun
Copy link
Author

PgmJun commented Dec 21, 2023

The error log is related to spring-projects/spring-security#14128.

thank you😃

@bclozel
Copy link
Member

bclozel commented Dec 21, 2023

This code snippet should work, there might be a problem somewhere else. Can you share a sample project?

@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 Dec 21, 2023
@bclozel bclozel added status: waiting-for-feedback We need additional information before we can continue and removed status: feedback-provided Feedback has been provided labels Dec 21, 2023
@PgmJun
Copy link
Author

PgmJun commented Dec 21, 2023

This code snippet should work, there might be a problem somewhere else. Can you share a sample project?

I'll leave a link to the git repository!

https://github.com/20-Testers/reviewerRecruiter-Server

@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 Dec 21, 2023
@bclozel
Copy link
Member

bclozel commented Dec 21, 2023

404 error is expected, I'm not seeing any controller in the project.

@bclozel bclozel added status: waiting-for-feedback We need additional information before we can continue and removed status: feedback-provided Feedback has been provided labels Dec 21, 2023
@PgmJun
Copy link
Author

PgmJun commented Dec 21, 2023

404 error is expected, I'm not seeing any controller in the project.

oh I'm really sorry.. i was implementing a feature in the feat/#1 branch, not the main branch.
I forgot to explan this.

@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 Dec 21, 2023
@bclozel
Copy link
Member

bclozel commented Dec 21, 2023

I can't reproduce the problem. Running with a the "local" profile and accessing http://localhost:8080/admin (after entering credentials) works for me.

@bclozel bclozel closed this as not planned Won't fix, can't repro, duplicate, stale Dec 21, 2023
@bclozel bclozel added status: invalid An issue that we don't feel is valid and removed status: waiting-for-triage An issue we've not yet triaged or decided on status: feedback-provided Feedback has been provided labels Dec 21, 2023
@PgmJun
Copy link
Author

PgmJun commented Dec 21, 2023

I can't reproduce the problem. Running with a the "local" profile and accessing http://localhost:8080/admin (after entering credentials) works for me.

To explain this problem in more detail,
Problems occurred when the spring boot application was restarted without closing the browser that accessed the 'http://localhost:8080/admin' url.

@bclozel
Copy link
Member

bclozel commented Dec 21, 2023

Sorry but I can't spend more time on this. We use this issue tracker for enhancement requests and bug reports. It seems you're describing the fact that the authentication session is not persisted between app restarts. There are projects dedicated to solving that, like Spring Session. For further questions, please use StackOverflow.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: invalid An issue that we don't feel is valid
Projects
None yet
Development

No branches or pull requests

3 participants