tomcat - Deploying Spring Boot app to AWS beanstalk -
i trying since yesterday deploy spring boot in tomcat on aws beanstalk , have exception being raised :
caused by: org.springframework.beans.factory.beancreationexception: error creating bean name 'errorpagefilter': initialization of bean failed; ..... caused by: java.lang.classcastexception: org.springframework.boot.context.web.errorpagefilter cannot cast org.springframework.boot.context.embedded.tomcat.tomcatembeddedservletcontainerfactory @ org.coursera.symptomserver.auth.config.oauth2securityconfiguration$1.customize(oauth2securityconfiguration.java:212) @ org.springframework.boot.context.embedded.embeddedservletcontainercustomizerbeanpostprocessor.postprocessbeforeinitialization(embeddedservletcontainercustomizerbeanpostprocessor.java:67) @ org.springframework.boot.context.embedded.embeddedservletcontainercustomizerbeanpostprocessor.postprocessbeforeinitialization(embeddedservletcontainercustomizerbeanpostprocessor.java:54) ...
in local dev environment, don't have error. in local dev, developped on tomcat 7 '1.0.2.release' version.
i created war deploy on tomcat 7 instance in aws beanstalk , error below comes out. how can fix error?
when deploy spring boot application standalone servlet container, uses special "embedded" servlet container, errorpagefilter
, handle application errors forwarding requests configured error pages. code in org.coursera.symptomserver.auth.config.oauth2securityconfiguration$1
incorrectly assuming class org.springframework.boot.context.embedded.tomcat.tomcatembeddedservletcontainerfactory
resulting in classcastexception
.
the first thing make code more robust adding instanceof
check attempts cast when knows it'll succeed. secondly, you're deploying standalone tomcat instance, you'll need apply customisation tomcat changing server.xml
or context.xml
rather doing programatically.
Comments
Post a Comment