Spring AWS: Access denied error when deploying war on Elastic Beanstalk - java

I'm seeing the below error when deploying war with Spring AWS on AWS EB:
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'embeddedServletContainerCustomizerBeanPostProcessor': Initialization of bean failed;
nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.transaction.annotation.ProxyTransactionManagementConfiguration': Initialization of bean failed;
nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.cache.annotation.ProxyCachingConfiguration': Injection of autowired dependencies failed;
nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire method: void org.springframework.cache.annotation.AbstractCachingConfiguration.setConfigurers(java.util.Collection);
nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.cloud.aws.cache.config.annotation.ElastiCacheCachingConfiguration': Injection of autowired dependencies failed;
nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private org.springframework.cloud.aws.core.env.stack.ListableStackResourceFactory org.springframework.cloud.aws.cache.config.annotation.ElastiCacheCachingConfiguration.stackResourceFactory;
nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'stackResourceRegistryFactoryBean' defined in class path resource [org/springframework/cloud/aws/autoconfigure/context/ContextStackAutoConfiguration$StackAutoDetectConfiguration.class]: Bean instantiation via factory method failed;
nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.cloud.aws.core.env.stack.config.StackResourceRegistryFactoryBean]: Factory method 'stackResourceRegistryFactoryBean' threw exception;
nested exception is com.amazonaws.AmazonServiceException: User: arn:aws:sts::<id>:assumed-role/aws-elasticbeanstalk-ec2-role/<id> is not authorized to perform: cloudformation:DescribeStackResources (Service: AmazonCloudFormation; Status Code: 403; Error Code: AccessDenied; Request ID: <request-id>)
The username shown is apparently a temp user created during the process.
Not sure what all info I need to provide -- please let me know, and I shall add.
Thanks!

This was apparently due to a problem in the spring config file. Some xsd URLs where invalid, and so the aws credentials provided weren't being used.
Fixing the URLs fixed the issue.

Related

Geoserver WPS Plugin not installing (Context initialization failed)

I am attempting to install a WPS plugin for Geoserver to my local Windows machine, and moving *.jar files into WEB-INF/inf folder causes error that doesn't allow to load Geoserver unless I delete them from there.
The version of Geoserver is 2.20.3 and it's web instance gets loaded with the built-in Jetty web server.
The error message:
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'wmtsCapabilitiesProvider' defined in URL [jar:file:/C:/Program%20Files/GeoServer/webapps/geoserver/WEB-INF/lib/gs-gwc-2.20.3.jar!/applicationContext.xml]: Cannot resolve reference to bean 'geoServer' while setting constructor argument;
nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'geoServer' defined in URL [jar:file:/C:/Program%20Files/GeoServer/webapps/geoserver/WEB-INF/lib/gs-main-2.20.3.jar!/applicationContext.xml]: Cannot resolve reference to bean 'catalog' while setting bean property 'catalog'; nested exception is
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'localWorkspaceCatalog' defined in URL [jar:file:/C:/Program%20Files/GeoServer/webapps/geoserver/WEB-INF/lib/gs-main-2.20.3.jar!/applicationContext.xml]: Cannot resolve reference to bean 'advertisedCatalog' while setting constructor argument; nested exception is
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'advertisedCatalog' defined in URL [jar:file:/C:/Program%20Files/GeoServer/webapps/geoserver/WEB-INF/lib/gs-main-2.20.3.jar!/applicationContext.xml]: Cannot resolve reference to bean 'secureCatalog' while setting constructor argument; nested exception is
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'secureCatalog' defined in URL [jar:file:/C:/Program%20Files/GeoServer/webapps/geoserver/WEB-INF/lib/gs-main-2.20.3.jar!/applicationContext.xml]: Bean instantiation via constructor failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.geoserver.security.SecureCatalogImpl]: Constructor threw exception; nested exception is
java.lang.NullPointerException at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:314)

Jhipster-registry showing > Error creating bean with name 'clientRegistrationRepository' defined in class path resource

I have deployed Jhispter-registry on gce (vm), and keycloak is again deployed on another gce vm. The keycloak is configured properly and up and running. But when trying to access the registry page, it throws following error;
"Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'clientRegistrationRepository' defined in class path resource [org/springframework/boot/autoconfigure/security/oauth2/client/servlet/OAuth2ClientRegistrationRepositoryConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.security.oauth2.client.registration.InMemoryClientRegistrationRepository]: Factory method 'clientRegistrationRepository' threw exception; nested exception is java.lang.IllegalArgumentException: Unable to resolve Configuration with the provided Issuer of "http://keycloa.vm.ip.masked:8080/auth/realms/jhipster"
any hints/ pointers to resolve the issue. Thanks a ton in advance!

Spring Boot SessionFactory instantiation failed but only when containerised

I have containerised a spring boot application. It is contained in a jar file. when I call the jar file separately It is working but when I run it through docker-compose up it yields the following error:
ConfigServletWebServerApplicationContext : Exception encountered
during context initialization - cancelling refresh attempt:
org.springframework.beans.factory.UnsatisfiedDependencyException:
Error creating bean with name 'crawlerController': Unsatisfied
dependency expressed through field 'campaignservice'; nested exception
is org.springframework.beans.factory.UnsatisfiedDependencyException:
Error creating bean with name 'campaignService': Unsatisfied
dependency expressed through field 'campaignrepository'; nested
exception is org.springframework.beans.factory.BeanCreationException:
Error creating bean with name 'campaignRepository': Cannot resolve
reference to bean
'org.springframework.data.neo4j.transaction.SharedSessionCreator#0'
while setting bean property 'session'; nested exception is
org.springframework.beans.factory.BeanCreationException: Error
creating bean with name
'org.springframework.data.neo4j.transaction.SharedSessionCreator#0':
Cannot resolve reference to bean 'sessionFactory' while setting
constructor argument; nested exception is
org.springframework.beans.factory.BeanCreationException: Error
creating bean with name 'sessionFactory' defined in class path
resource
[org/springframework/boot/autoconfigure/data/neo4j/Neo4jDataAutoConfiguration.class]:
Bean instantiation via factory method failed; nested exception is
org.springframework.beans.BeanInstantiationException: Failed to
instantiate [org.neo4j.ogm.session.SessionFactory]: Factory method
'sessionFactory' threw exception; nested exception is
java.lang.TypeNotPresentException: Type javafx.util.Pair not present
Given that the jar works when invoked separately I assume that all of the dependencies are contained in the classpath. so I do not understand why it does not work when called through Docker
the dockerFile is :
FROM openjdk:8-jre
VOLUME /tmp
ADD target/SpringNeoServer.jar /SpringNeoServer.jar
EXPOSE 7864
ENTRYPOINT ["java", "-jar", "SpringNeoServer.jar"]
JavaFX is not included in this version of openjdk.
Instructions to add it can be found here.

Configuring Hibernate with grails

I have created created a Grails application and created the Spring Security plugin set up into It.
When I run the application I get following error. Hibernate folder is empty. Can anyone help me resolve this?
2014-06-20 13:41:26,946 [http-bio-8080-exec-21] ERROR [/GrailsLoginWithSpring].[gsp] -
Servlet.service() for servlet [gsp] in context with path [/GrailsLoginWithSpring] threw exception
Message: org.springframework.beans.factory.BeanCreationException:
Error creating bean with name 'org.grails.internal.SESSION_FACTORY_HOLDER':
Cannot create inner bean '(inner bean)#3720a15d' of type
[org.codehaus.groovy.grails.orm.hibernate.ConfigurableLocalSessionFactoryBean]
while setting bean property 'sessionFactory';
nested exception is org.springframework.beans.factory.BeanCreationException:
Error creating bean with name '(inner bean)#3720a15d': Invocation of init method failed;
nested exception is java.io.FileNotFoundException: class path resource [hibernate.cfg.xml]
cannot be resolved to URL because it does not exist
Try adding
hibernate {
reload = false
}
As suggested by Graeme Rocher in this JIRA

I use load time weaving in spring. How can i set class loader in jetty?

I use load time weaving in spring. All works fine with websphere, because it has own class loader, but i have troubles in dev mode, where i use embedded jetty. How can i set class loader in jetty?
When i run it i see following error
[INFO] org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.context.weaving.AspectJWeavingEnabler#0': Initialization of bean failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'loadTimeWeaver': Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [org.springframework.instrument.classloading.ReflectiveLoadTimeWeaver]: Constructor threw exception; nested exception is java.lang.IllegalStateException: ClassLoader [com.google.gwt.dev.shell.jetty.JettyLauncher$WebAppContextWithReload$WebAppClassLoaderExtension] does NOT provide an 'addTransformer(ClassFileTransformer)' method.
I've resolved it by adding a "-Xbootclasspath/a:[path to jar]" as JvmArgs param.
Now it's looks like
<extraJvmArgs>-Xmx4g -XX:MaxPermSize=512m -javaagent:C:\Users\auldanov\.m2\repository\org\springframework\spring-instrument\3.1.4.RELEASE\spring-instrument-3.1.4.RELEASE.jar -Xbootclasspath/a:C:\Users\auldanov\.m2\repository\org\springframework\spring-instrument\3.1.4.RELEASE\spring-instrument-3.1.4.RELEASE.jar</extraJvmArgs>

Categories

Resources