You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Feb 23, 2023. It is now read-only.
Hi, I've updated my project to spring-boot 2.4.6 (spring native is 0.9.2) and I am having the exception below when setting SPRING_PROFILES_ACTIVE to a Docker native image
In order to solve it, I needed to add @TypeHint(types = {Set.class, LinkedHashSet.class}) to my Spring application class.
Thanks!
[main] DEBUG org.springframework.boot.diagnostics.LoggingFailureAnalysisReporter - Application failed to start due to an exception
org.springframework.boot.context.properties.bind.BindException: Failed to bind properties under 'spring.profiles.active' to java.util.Set<java.lang.String>
at org.springframework.boot.context.properties.bind.Binder.handleBindError(Binder.java:363)
at org.springframework.boot.context.properties.bind.Binder.bind(Binder.java:323)
at org.springframework.boot.context.properties.bind.Binder.bind(Binder.java:308)
at org.springframework.boot.context.properties.bind.Binder.bind(Binder.java:238)
at org.springframework.boot.context.properties.bind.Binder.bind(Binder.java:199)
at org.springframework.boot.context.config.Profiles.getProfiles(Profiles.java:101)
at org.springframework.boot.context.config.Profiles.getActivatedProfiles(Profiles.java:88)
at org.springframework.boot.context.config.Profiles.<init>(Profiles.java:82)
at org.springframework.boot.context.config.ConfigDataEnvironment.withProfiles(ConfigDataEnvironment.java:278)
at org.springframework.boot.context.config.ConfigDataEnvironment.processAndApply(ConfigDataEnvironment.java:234)
at org.springframework.boot.context.config.ConfigDataEnvironmentPostProcessor.postProcessEnvironment(ConfigDataEnvironmentPostProcessor.java:102)
at org.springframework.boot.context.config.ConfigDataEnvironmentPostProcessor.postProcessEnvironment(ConfigDataEnvironmentPostProcessor.java:94)
at org.springframework.boot.env.EnvironmentPostProcessorApplicationListener.onApplicationEnvironmentPreparedEvent(EnvironmentPostProcessorApplicationListener.java:100)
at org.springframework.boot.env.EnvironmentPostProcessorApplicationListener.onApplicationEvent(EnvironmentPostProcessorApplicationListener.java:86)
at org.springframework.context.event.SimpleApplicationEventMulticaster.doInvokeListener(SimpleApplicationEventMulticaster.java:176)
at org.springframework.context.event.SimpleApplicationEventMulticaster.invokeListener(SimpleApplicationEventMulticaster.java:169)
at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:143)
at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:131)
at org.springframework.boot.context.event.EventPublishingRunListener.environmentPrepared(EventPublishingRunListener.java:82)
at org.springframework.boot.SpringApplicationRunListeners.lambda$environmentPrepared$2(SpringApplicationRunListeners.java:63)
at java.util.ArrayList.forEach(ArrayList.java:1541)
at org.springframework.boot.SpringApplicationRunListeners.doWithListeners(SpringApplicationRunListeners.java:117)
at org.springframework.boot.SpringApplicationRunListeners.doWithListeners(SpringApplicationRunListeners.java:111)
at org.springframework.boot.SpringApplicationRunListeners.environmentPrepared(SpringApplicationRunListeners.java:62)
at org.springframework.boot.SpringApplication.prepareEnvironment(SpringApplication.java:375)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:333)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1329)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1318)
at com.mycompany.springbootjpamysql.SpringbootJpaMysqlApplication.main(SpringbootJpaMysqlApplication.java:10)
Caused by: org.springframework.core.convert.ConversionFailedException: Failed to convert from type [java.util.ArrayList<?>] to type [java.util.LinkedHashSet<java.lang.String>] for value '[native]'; nested exception is java.lang.IllegalArgumentException: Could not instantiate Collection type: java.util.LinkedHashSet
at org.springframework.core.convert.support.ConversionUtils.invokeConverter(ConversionUtils.java:47)
at org.springframework.core.convert.support.GenericConversionService.convert(GenericConversionService.java:192)
at org.springframework.boot.context.properties.bind.BindConverter$CompositeConversionService.convert(BindConverter.java:170)
at org.springframework.boot.context.properties.bind.BindConverter.convert(BindConverter.java:96)
at org.springframework.boot.context.properties.bind.IndexedElementsBinder.convert(IndexedElementsBinder.java:142)
at org.springframework.boot.context.properties.bind.IndexedElementsBinder.bindValue(IndexedElementsBinder.java:97)
at org.springframework.boot.context.properties.bind.IndexedElementsBinder.bindIndexed(IndexedElementsBinder.java:83)
at org.springframework.boot.context.properties.bind.IndexedElementsBinder.bindIndexed(IndexedElementsBinder.java:70)
at org.springframework.boot.context.properties.bind.CollectionBinder.bindAggregate(CollectionBinder.java:49)
at org.springframework.boot.context.properties.bind.AggregateBinder.bind(AggregateBinder.java:56)
at org.springframework.boot.context.properties.bind.Binder.lambda$bindAggregate$3(Binder.java:414)
at org.springframework.boot.context.properties.bind.Binder$Context.withIncreasedDepth(Binder.java:571)
at org.springframework.boot.context.properties.bind.Binder$Context.access$100(Binder.java:512)
at org.springframework.boot.context.properties.bind.Binder.bindAggregate(Binder.java:414)
at org.springframework.boot.context.properties.bind.Binder.bindObject(Binder.java:375)
at org.springframework.boot.context.properties.bind.Binder.bind(Binder.java:319)
... 27 common frames omitted
Caused by: java.lang.IllegalArgumentException: Could not instantiate Collection type: java.util.LinkedHashSet
at org.springframework.core.CollectionFactory.createCollection(CollectionFactory.java:212)
at org.springframework.core.convert.support.CollectionToCollectionConverter.convert(CollectionToCollectionConverter.java:81)
at org.springframework.core.convert.support.ConversionUtils.invokeConverter(ConversionUtils.java:41)
... 42 common frames omitted
Caused by: java.lang.NoSuchMethodException: java.util.LinkedHashSet.<init>()
at java.lang.Class.getConstructor0(DynamicHub.java:3349)
at java.lang.Class.getDeclaredConstructor(DynamicHub.java:2553)
at org.springframework.util.ReflectionUtils.accessibleConstructor(ReflectionUtils.java:185)
at org.springframework.core.CollectionFactory.createCollection(CollectionFactory.java:208)
... 44 common frames omitted
10:01:03.526 [main] ERROR org.springframework.boot.diagnostics.LoggingFailureAnalysisReporter -
***************************
APPLICATION FAILED TO START
***************************
Description:
Failed to bind properties under 'spring.profiles.active' to java.util.Set<java.lang.String>:
Property: spring.profiles.active
Value: native
Origin: System Environment Property "SPRING_PROFILES_ACTIVE"
Reason: failed to convert java.util.ArrayList<?> to java.util.LinkedHashSet<java.lang.String>
Action:
Update your application's configuration
I added recently LinkedHashSet to Spring Boot hints, could you please try with 0.10.0-SNAPSHOT and Spring Boot 2.5.0? I have not added Set hint so maybe I need to refine it, let see based on your feedback.
I tried using spring-boot 2.5.0 and spring-native 0.10.0-SNAPSHOT. I am getting
Exception in thread "main" java.lang.IllegalArgumentException: Cannot instantiate interface org.springframework.context.ApplicationContextInitializer : org.springframework.boot.autoconfigure.SharedMetadataReaderFactoryContextInitializer
at org.springframework.boot.SpringApplication.createSpringFactoriesInstances(SpringApplication.java:479)
at org.springframework.boot.SpringApplication.getSpringFactoriesInstances(SpringApplication.java:461)
at org.springframework.boot.SpringApplication.getSpringFactoriesInstances(SpringApplication.java:454)
at org.springframework.boot.SpringApplication.<init>(SpringApplication.java:285)
at org.springframework.boot.SpringApplication.<init>(SpringApplication.java:265)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1336)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1325)
at com.mycompany.springbootjpamysql.SpringbootJpaMysqlApplication.main(SpringbootJpaMysqlApplication.java:10)
Caused by: java.lang.ClassNotFoundException: org.springframework.boot.autoconfigure.SharedMetadataReaderFactoryContextInitializer
at com.oracle.svm.core.hub.ClassForNameSupport.forName(ClassForNameSupport.java:60)
at java.lang.Class.forName(DynamicHub.java:1260)
at org.springframework.util.ClassUtils.forName(ClassUtils.java:284)
at org.springframework.boot.SpringApplication.createSpringFactoriesInstances(SpringApplication.java:472)
... 7 more
Hi, I've updated my project to spring-boot
2.4.6
(spring native is0.9.2
) and I am having the exception below when settingSPRING_PROFILES_ACTIVE
to a Docker native imageIn order to solve it, I needed to add
@TypeHint(types = {Set.class, LinkedHashSet.class})
to my Spring application class.Thanks!
How to reproduce
The text was updated successfully, but these errors were encountered: