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

Simple native Kotlin function app fails to start in Docker - Could not resolve matching constructor #652

Closed
frayneposset opened this issue Mar 23, 2021 · 4 comments
Assignees
Labels
type: compatibility Native image compatibility issue
Milestone

Comments

@frayneposset
Copy link

The initial issue was raised here, but Oleg asked me to move it and add a repo that replicates it.

spring-cloud/spring-cloud-function#675

Reproduction steps

Clone this repo https://github.com/frayneposset/functionnative.git

Build the docker image:

./gradlew build bootBuildImage

Run the docker image:

docker run functionnative:0.0.1-SNAPSHOT

This results in the following error:

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'toUpperCase_registration': Could not resolve matching constructor (hint: specify index/type/name arguments for simple parameters to avoid type ambiguities)
        at org.springframework.beans.factory.support.ConstructorResolver.autowireConstructor(ConstructorResolver.java:279) ~[na:na]
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireConstructor(AbstractAutowireCapableBeanFactory.java:1354) ~[na:na]
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1204) ~[na:na]
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:564) ~[na:na]
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:524) ~[na:na]
        at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:335) ~[na:na]
        at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234) ~[na:na]
        at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:333) ~[na:na]
        at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:208) ~[na:na]
        at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:925) ~[na:na]
        at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:918) ~[na:na]
        at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:583) ~[na:na]
        at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:144) ~[na:na]
        at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:769) ~[com.example.functionnative.FunctioningApplicationKt:na]
        at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:761) ~[com.example.functionnative.FunctioningApplicationKt:na]
        at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:426) ~[com.example.functionnative.FunctioningApplicationKt:na]
        at org.springframework.boot.SpringApplication.run(SpringApplication.java:326) ~[com.example.functionnative.FunctioningApplicationKt:na]
        at org.springframework.boot.SpringApplication.run(SpringApplication.java:1313) ~[com.example.functionnative.FunctioningApplicationKt:na]
        at org.springframework.boot.SpringApplication.run(SpringApplication.java:1302) ~[com.example.functionnative.FunctioningApplicationKt:na]
        at com.example.functionnative.FunctioningApplicationKt.main(FunctioningApplication.kt:21) ~[na:na]

@sdeleuze
Copy link
Contributor

Thanks I will have a look and share my feedback.

@olegz
Copy link
Contributor

olegz commented Mar 24, 2021

@sdeleuze just as a reminder; I did make questionable class public in case you decide to test against current snapshots of s-c-function or check if there is any difference between it being private (in the latest release - 3.1.2) and public (in the current snapshot - 3.1.3-SNAPSHOT)

@sdeleuze
Copy link
Contributor

@olegz Nope same error with 3.1.3-SNAPSHOT.

@sdeleuze sdeleuze added this to the 0.9.2 milestone Mar 26, 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 Mar 26, 2021
@frayneposset
Copy link
Author

Thanks for fixing this so quickly.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
type: compatibility Native image compatibility issue
Development

No branches or pull requests

3 participants