java - SpringBoot and DynamoDb-Local Embedded -
i have spring-boot (1.2.6) webapp. use dynamodb event store app. in integration tests use this approach start dynamodb-local integration test code.
however, after including dependency:
<dependency> <groupid>com.amazonaws</groupid> <artifactid>dynamodblocal</artifactid> <version>1.10.5.1</version> </dependency>
i following error when running integration test:
java.lang.illegalstateexception: failed load applicationcontext (....) caused by: org.springframework.context.applicationcontextexception: unable start embedded container; nested exception org.springframework.beans.factory.beancreationexception: error creating bean name 'jettyembeddedservletcontainerfactory' defined in class path resource [org/springframework/boot/autoconfigure/web/embeddedservletcontainerautoconfiguration$embeddedjetty.class]: bean instantiation via factory method failed; nested exception org.springframework.beans.beaninstantiationexception: failed instantiate [org.springframework.boot.context.embedded.jetty.jettyembeddedservletcontainerfactory]: factory method 'jettyembeddedservletcontainerfactory' threw exception; nested exception java.lang.noclassdeffounderror: org/eclipse/jetty/webapp/webappcontext (....) caused by: org.springframework.beans.factory.beancreationexception: error creating bean name 'jettyembeddedservletcontainerfactory' defined in class path resource [org/springframework/boot/autoconfigure/web/embeddedservletcontainerautoconfiguration$embeddedjetty.class]: bean instantiation via factory method failed; nested exception org.springframework.beans.beaninstantiationexception: failed instantiate [org.springframework.boot.context.embedded.jetty.jettyembeddedservletcontainerfactory]: factory method 'jettyembeddedservletcontainerfactory' threw exception; nested exception java.lang.noclassdeffounderror: org/eclipse/jetty/webapp/webappcontext (....) caused by: org.springframework.beans.beaninstantiationexception: failed instantiate [org.springframework.boot.context.embedded.jetty.jettyembeddedservletcontainerfactory]: factory method 'jettyembeddedservletcontainerfactory' threw exception; nested exception java.lang.noclassdeffounderror: org/eclipse/jetty/webapp/webappcontext (....) caused by: java.lang.noclassdeffounderror: org/eclipse/jetty/webapp/webappcontext (....) caused by: java.lang.classnotfoundexception: org.eclipse.jetty.webapp.webappcontext
i did not add code integration test, literally added repo , dependency pom (as described in aws forum announcement linked above). without dependency runs fine. can attach pom if needed. ideas?
com.amazonaws:dynamodblocal
depends on of jetty. jetty's presence on classpath confusing spring boot thinking want use jetty, though of parts of jetty needs aren't available. bug in spring boot. letting know it. i've opened an issue can fix it.
in meantime, can work around problem adding bean application explicitly tells spring boot want use tomcat:
@bean public embeddedservletcontainerfactory tomcatcontainerfactory() { return new tomcatembeddedservletcontainerfactory(); }
Comments
Post a Comment