Skip to content
This repository has been archived by the owner on Feb 23, 2023. It is now read-only.

RestController with Annotations at the Service Interface is not working in native Mode #955

Closed
goafabric opened this issue Aug 6, 2021 · 6 comments
Labels
status: feedback-provided Feedback has been provided type: compatibility Native image compatibility issue
Milestone

Comments

@goafabric
Copy link

Imagine an interface and an Implementing Restcontroller Class like below.
While everything works like a charm in JVM mode and I've been using this for years,
its not working in native mode.

The Application crashes with the Exception below:

org.springframework.http.converter.HttpMessageNotWritableException: No converter for [class org.goafabric.calleeservice.service.Callee] with preset Content-Type 'null'

Calle is just a simple Pojo ....

--- Interface ---
@RequestMapping(value = "callees", produces = MediaType.APPLICATION_JSON_VALUE)
public interface CalleeService {
@GetMapping("sayMyName")
Callee sayMyName (@RequestParam String name);

@GetMapping("sayMyOtherName/{name}")
Callee sayMyOtherName(@PathVariable String name);

}

--- Implementing class ---
And an implementing class
@RestController
public class CalleeServiceBean implements CalleeService {
@Autowired
CalleeLogic calleeLogic;

public Callee sayMyName (@RequestParam String name) {
    return calleeLogic.sayMyName(name);
}

}

--- Complete Exception ---

org.springframework.http.converter.HttpMessageNotWritableException: No converter for [class org.goafabric.calleeservice.service.Callee] with preset Content-Type 'null'
at org.springframework.web.servlet.mvc.method.annotation.AbstractMessageConverterMethodProcessor.writeWithMessageConverters(AbstractMessageConverterMethodProcessor.java:312) ~[na:na]
at org.springframework.web.servlet.mvc.method.annotation.RequestResponseBodyMethodProcessor.handleReturnValue(RequestResponseBodyMethodProcessor.java:183) ~[na:na]
at org.springframework.web.method.support.HandlerMethodReturnValueHandlerComposite.handleReturnValue(HandlerMethodReturnValueHandlerComposite.java:78) ~[na:na]
at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:124) ~[na:na]
at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:895) ~[org.goafabric.calleeservice.Application:5.3.9]

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged or decided on label Aug 6, 2021
@sdeleuze sdeleuze added this to the 0.11.0 milestone Aug 17, 2021
@sdeleuze sdeleuze added type: compatibility Native image compatibility issue and removed status: waiting-for-triage An issue we've not yet triaged or decided on labels Aug 17, 2021
@sdeleuze sdeleuze modified the milestones: 0.11.0-M1, 0.11.x Sep 24, 2021
@sdeleuze
Copy link
Contributor

sdeleuze commented Oct 5, 2021

@goafabric Could you test if this is still an issue with 0.11.0-SNAPSHOT or the upcoming 0.11.0-M1?

@sdeleuze sdeleuze added the status: waiting-for-feedback We need additional information before we can continue label Oct 5, 2021
@goafabric
Copy link
Author

@sdeleuze yes sure, can do that,thx

@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 Oct 7, 2021
@goafabric
Copy link
Author

@sdeleuze because of the breaking change concerning unit tests, i cannot test this currently easily, you might close the ticket for now and i will check it later on ...

@goafabric
Copy link
Author

goafabric commented Oct 11, 2021

@sdeleuze Nope does not seem to work .. same exception with spring native 11.0-M1 + Spring Boot 2.6.0-M1
...

Additionally Spring Security now seems to be broken

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'springSecurityFilterChain': Unexpected exception during bean creation; nested exception is java.lang.RuntimeException: Authentication event class org.springframework.security.authentication.event.AuthenticationFailureBadCredentialsEvent has no suitable constructor

As well springdoc-openapi-ui .. which now complains about a missing Property(PlaceHolder)

... However wont raise issues for this, as this is an M1

@sdeleuze
Copy link
Contributor

Please provide a repro for this using 0.11.0-RC1 and I will have a deeper loop. Please avoid adding springdoc-openapi-ui to the mix.

@sdeleuze sdeleuze added status: waiting-for-feedback We need additional information before we can continue and removed status: feedback-provided Feedback has been provided labels Nov 24, 2021
@goafabric
Copy link
Author

@sdeleuze thx for your time and support .. Service Interface seems to work with 0.11.0-RC1 and for the Spring Security Problem we already have another issue .. so i think you can close this one

one more thing, concerning #949 I added another comment after it's closed, at least with 10.4 the issue is till open for me
but i can retry with 0.11-0-RC

thx again for your time and effort for everything spring native,
regards
Andreas

@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 Nov 26, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
status: feedback-provided Feedback has been provided type: compatibility Native image compatibility issue
Development

No branches or pull requests

3 participants