krud-dev / ostara

Ostara is a cross-platform desktop app for managing and monitoring Spring Boot applications using the Actuator API, providing comprehensive insights and effortless control.
https://ostara.dev
Apache License 2.0
319 stars 11 forks source link

Could not load logfile from actuator #741

Open daring2 opened 10 months ago

daring2 commented 10 months ago

Ostara cannot load logfile data from one of our application. The logfile tab shows the error:

Error loading data. Could not load logfile from actuator.

The application configured correctly, logfile endpoint works in browser. The application log contains the following errors related to Ostara requests:

Resolved [org.springframework.web.HttpMediaTypeNotAcceptableException: Could not find acceptable representation]

As I understand the problem occurs because Ostara does not use "Accept" header for logfile requests. Our application sets "ContentNegotiationConfigurer#defaultContentType" parameter to MediaType.APPLICATION_JSON and this type is used if "Accept" header is missing.

Stacktrace:

org.springframework.web.HttpMediaTypeNotAcceptableException: Could not find acceptable representation
    at org.springframework.web.servlet.mvc.method.annotation.AbstractMessageConverterMethodProcessor.writeWithMessageConverters(AbstractMessageConverterMethodProcessor.java:249)
    at org.springframework.web.servlet.mvc.method.annotation.RequestResponseBodyMethodProcessor.handleReturnValue(RequestResponseBodyMethodProcessor.java:183)
    at org.springframework.web.method.support.HandlerMethodReturnValueHandlerComposite.handleReturnValue(HandlerMethodReturnValueHandlerComposite.java:78)
    at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:135)
    at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:895)
    at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:808)
    at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:87)
...

Expected Behavior

Logfile data is loaded correctly.

Current Behavior

The logfile tab shows the error "Could not load logfile from actuator".

Steps to Reproduce

  1. Create an application with ContentNegotiationConfigurer#defaultContentType parameter.
  2. Connect to the application and open logfile tab.

Possible Solution

Add "Accept" header for logfile requests.

Environment