Reputation: 41
I am using SPRING AWS Cloud version 1.0.3.RELEASE packages - i.e. spring-cloud-aws-core, context, autoconfigure, jdbc and messaging in our SPRING BOOT executable jar application. But while application initialization getting the error - AWS credential profiles file not found in the given path.
The detail exception is as follows:
2015-12-11 08:52:45.778 DEBUG 2525 --- [ main] o.s.b.f.s.DefaultListableBeanFactory : Creating instance of bean '(inner bean)#566a55ed'
2015-12-11 08:52:45,789 8058 [main] DEBUG org.springframework.beans.BeanUtils -
- No property editor [com.amazonaws.auth.profile.ProfilesConfigFileEditor] found for type com.amazonaws.auth.profile.ProfilesConfigFile according to 'Editor' suffix convention
2015-12-11 08:52:45.789 DEBUG 2525 --- [ main] org.springframework.beans.BeanUtils : No property editor [com.amazonaws.auth.profile.ProfilesConfigFileEditor] found for type com.amazonaws.auth.profile.ProfilesConfigFile according to 'Editor' suffix convention
2015-12-11 08:52:45,793 8062 [main] DEBUG o.s.beans.TypeConverterDelegate -
- Construction via String failed for type [com.amazonaws.auth.profile.ProfilesConfigFile]
org.springframework.beans.BeanInstantiationException: Failed to instantiate [com.amazonaws.auth.profile.ProfilesConfigFile]: Constructor threw exception; nested exception is java.lang.IllegalArgumentException: AWS credential profiles file not found in the given path: /opt/wmc/myapp/bin/default
at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:163) ~[spring-beans-4.2.3.RELEASE.jar!/:4.2.3.RELEASE]
at org.springframework.beans.TypeConverterDelegate.convertIfNecessary(TypeConverterDelegate.java:238) [spring-beans-4.2.3.RELEASE.jar!/:4.2.3.RELEASE]
at org.springframework.beans.TypeConverterDelegate.convertIfNecessary(TypeConverterDelegate.java:108) [spring-beans-4.2.3.RELEASE.jar!/:4.2.3.RELEASE]
at org.springframework.beans.TypeConverterSupport.doConvert(TypeConverterSupport.java:64) [spring-beans-4.2.3.RELEASE.jar!/:4.2.3.RELEASE]
at org.springframework.beans.TypeConverterSupport.convertIfNecessary(TypeConverterSupport.java:47) [spring-beans-4.2.3.RELEASE.jar!/:4.2.3.RELEASE]
at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:704) [spring-beans-4.2.3.RELEASE.jar!/:4.2.3.RELEASE]
at org.springframework.beans.factory.support.ConstructorResolver.autowireConstructor(ConstructorResolver.java:185) [spring-beans-4.2.3.RELEASE.jar!/:4.2.3.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireConstructor(AbstractAutowireCapableBeanFactory.java:1143) [spring-beans-4.2.3.RELEASE.jar!/:4.2.3.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1046) [spring-beans-4.2.3.RELEASE.jar!/:4.2.3.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:510) [spring-beans-4.2.3.RELEASE.jar!/:4.2.3.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:482) [spring-beans-4.2.3.RELEASE.jar!/:4.2.3.RELEASE]
at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveInnerBean(BeanDefinitionValueResolver.java:299) [spring-beans-4.2.3.RELEASE.jar!/:4.2.3.RELEASE]
at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:129) [spring-beans-4.2.3.RELEASE.jar!/:4.2.3.RELEASE]
at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveManagedList(BeanDefinitionValueResolver.java:382) [spring-beans-4.2.3.RELEASE.jar!/:4.2.3.RELEASE]
Caused by: java.lang.IllegalArgumentException: AWS credential profiles file not found in the given path: /opt/wmc/myapp/bin/default
at com.amazonaws.auth.profile.internal.ProfilesConfigFileLoader.loadProfiles(ProfilesConfigFileLoader.java:45) ~[aws-java-sdk-core-1.10.36.jar!/:na]
at com.amazonaws.auth.profile.ProfilesConfigFile.loadProfiles(ProfilesConfigFile.java:194) ~[aws-java-sdk-core-1.10.36.jar!/:na]
at com.amazonaws.auth.profile.ProfilesConfigFile.<init>(ProfilesConfigFile.java:119) ~[aws-java-sdk-core-1.10.36.jar!/:na]
at com.amazonaws.auth.profile.ProfilesConfigFile.<init>(ProfilesConfigFile.java:101) ~[aws-java-sdk-core-1.10.36.jar!/:na]
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) ~[na:1.8.0_65]
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) ~[na:1.8.0_65]
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) ~[na:1.8.0_65]
at java.lang.reflect.Constructor.newInstance(Constructor.java:422) ~[na:1.8.0_65]
at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:147) ~[spring-beans-4.2.3.RELEASE.jar!/:4.2.3.RELEASE]
Upvotes: 3
Views: 1005
Reputation: 1661
Even when this issues comes from many years ago, is still happening and it's hard to find the right solution, so, let me try to help those who are facing the
AWS credential profiles file not found in the given path:
/path/to/some/app/default
issue, using AWS + spring boot.
One of the reason which provoques this error is because the application is looking for credentials profiles in
# the user home directory
~/.aws/credentials
after login in AWS from CLI (Short-term authentication).
The AWS libraries are looking for a [default]
profile, but in my case, credentials variables were saved under a very different profile (let's say as example [my-dev-profile]
). Having that, I tried passing env variable as parameter with the saved profile to the spring boot app didn't do any difference, the error was still there.
After I made myself sure the credentials were in the right place, under [default]
profile within ~/.aws/credentials
file, the error was gone and the app was able to start.
Upvotes: 0