daifuku1011
@daifuku1011

Are you sure you want to delete the question?

If your question is resolved, you may close it.

Leaving a resolved question undeleted may help others!

We hope you find it useful!

Spring Bootフレームワークで作成したWebアプリがデプロイできない

解決したいこと

デプロイしたWebアプリケーションが正常に動作するようにしたい。

AmazonなどのECサイトに自分が出品している商品を管理するWebアプリを作っています。
Eclipse上やローカルのtomcat上で実行すると正常に動作しますが、VPSサーバーにデプロイ後、「http://ホスト名:8080/App名/」にアクセスしても404エラーが表示されてしまいます。
解決方法を教えていただけませんでしょうか。

当方初心者のため、情報に不足等あるかと思いますので、ぜひご指摘いただけますと幸いです。

言語:Java (jdk20)
フレームワーク:SpringBoot(ver.3.1.2) + Thymeleaf
ORマッパー:Mybatis
ビルド:Gradle
IDE:Eclipse

【デプロイ環境】
さくらVPS
サーバー想定:Web+AP サーバー (DBサーバーのみ別)
スペック:仮想3Core、メモリ2GB、SSD100GB
OS:Ubuntu(22.04)
apache2:インストール済み、環境設定済み、デフォルトページ稼働確認済み
JDK(20.0.2):インストール済み、環境設定済み、javacテスト、java稼働テスト済み
tomcat(10.1.15):インストール済み、環境設定済み、Sampleアプリ稼働確認済み(tomcatサンプルページ)
apache2とtomcat連携済み

発生している問題・エラー

org.springframework.context.ApplicationContextException: Unable to start web server
        at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.onRefresh(ServletWebServerApplicationContext.java:164) ~[spring-boot-3.1.2.jar:3.1.2]
        at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:602) ~[spring-context-6.0.11.jar:6.0.11]
        at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:146) ~[spring-boot-3.1.2.jar:3.1.2]
        at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:734) ~[spring-boot-3.1.2.jar:3.1.2]
        at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:436) ~[spring-boot-3.1.2.jar:3.1.2]
        at org.springframework.boot.SpringApplication.run(SpringApplication.java:312) ~[spring-boot-3.1.2.jar:3.1.2]
        at org.springframework.boot.web.servlet.support.SpringBootServletInitializer.run(SpringBootServletInitializer.java:174) ~[spring-boot-3.1.2.jar:3.1.2]
        at org.springframework.boot.web.servlet.support.SpringBootServletInitializer.createRootApplicationContext(SpringBootServletInitializer.java:154) ~[spring-boot-3.1.2.jar:3.1.2]
        at org.springframework.boot.web.servlet.support.SpringBootServletInitializer.onStartup(SpringBootServletInitializer.java:96) ~[spring-boot-3.1.2.jar:3.1.2]
        at org.springframework.web.SpringServletContainerInitializer.onStartup(SpringServletContainerInitializer.java:171) ~[spring-web-6.0.11.jar:6.0.11]
        at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:4850) ~[catalina.jar:10.1.15]
        at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:171) ~[catalina.jar:10.1.15]
        at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:683) ~[catalina.jar:10.1.15]
        at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:658) ~[catalina.jar:10.1.15]
        at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:712) ~[catalina.jar:10.1.15]
        at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:975) ~[catalina.jar:10.1.15]
        at org.apache.catalina.startup.HostConfig$DeployWar.run(HostConfig.java:1952) ~[catalina.jar:10.1.15]
        at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:577) ~[na:na]
        at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:317) ~[na:na]
        at org.apache.tomcat.util.threads.InlineExecutorService.execute(InlineExecutorService.java:75) ~[tomcat-util.jar:10.1.15]
        at java.base/java.util.concurrent.AbstractExecutorService.submit(AbstractExecutorService.java:123) ~[na:na]
        at org.apache.catalina.startup.HostConfig.deployWARs(HostConfig.java:776) ~[catalina.jar:10.1.15]
        at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:426) ~[catalina.jar:10.1.15]
        at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1659) ~[catalina.jar:10.1.15]
        at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:309) ~[catalina.jar:10.1.15]
        at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:114) ~[catalina.jar:10.1.15]
        at org.apache.catalina.util.LifecycleBase.setStateInternal(LifecycleBase.java:402) ~[catalina.jar:10.1.15]
        at org.apache.catalina.util.LifecycleBase.setState(LifecycleBase.java:345) ~[catalina.jar:10.1.15]
        at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:893) ~[catalina.jar:10.1.15]
        at org.apache.catalina.core.StandardHost.startInternal(StandardHost.java:845) ~[catalina.jar:10.1.15]
        at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:171) ~[catalina.jar:10.1.15]
        at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1332) ~[catalina.jar:10.1.15]
        at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1322) ~[catalina.jar:10.1.15]
        at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:317) ~[na:na]
        at org.apache.tomcat.util.threads.InlineExecutorService.execute(InlineExecutorService.java:75) ~[tomcat-util.jar:10.1.15]
        at java.base/java.util.concurrent.AbstractExecutorService.submit(AbstractExecutorService.java:145) ~[na:na]
        at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:866) ~[catalina.jar:10.1.15]
        at org.apache.catalina.core.StandardEngine.startInternal(StandardEngine.java:240) ~[catalina.jar:10.1.15]
        at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:171) ~[catalina.jar:10.1.15]
        at org.apache.catalina.core.StandardService.startInternal(StandardService.java:433) ~[catalina.jar:10.1.15]
        at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:171) ~[catalina.jar:10.1.15]
        at org.apache.catalina.core.StandardServer.startInternal(StandardServer.java:917) ~[catalina.jar:10.1.15]
        at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:171) ~[catalina.jar:10.1.15]
        at org.apache.catalina.startup.Catalina.start(Catalina.java:795) ~[catalina.jar:10.1.15]
        at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:104) ~[na:na]
        at java.base/java.lang.reflect.Method.invoke(Method.java:578) ~[na:na]
        at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:347) ~[bootstrap.jar:10.1.15]
        at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:478) ~[bootstrap.jar:10.1.15]
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'formContentFilter' defined in class path resource [org/springframework/boot/autoconfigure/web/servlet/WebMvcAutoConfiguration.class]: Failed to instantiate [org.springframework.boot.web.servlet.filter.OrderedFormContentFilter]: Factory method 'formContentFilter' threw exception with message: Could not initialize class com.fasterxml.jackson.databind.SerializationConfig
        at org.springframework.beans.factory.support.ConstructorResolver.instantiate(ConstructorResolver.java:659) ~[spring-beans-6.0.11.jar:6.0.11]
        at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:493) ~[spring-beans-6.0.11.jar:6.0.11]
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1332) ~[spring-beans-6.0.11.jar:6.0.11]
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1162) ~[spring-beans-6.0.11.jar:6.0.11]
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:560) ~[spring-beans-6.0.11.jar:6.0.11]
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:520) ~[spring-beans-6.0.11.jar:6.0.11]
        at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:326) ~[spring-beans-6.0.11.jar:6.0.11]
        at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234) ~[spring-beans-6.0.11.jar:6.0.11]
        at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:324) ~[spring-beans-6.0.11.jar:6.0.11]
        at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:205) ~[spring-beans-6.0.11.jar:6.0.11]
        at org.springframework.boot.web.servlet.ServletContextInitializerBeans.getOrderedBeansOfType(ServletContextInitializerBeans.java:210) ~[spring-boot-3.1.2.jar:3.1.2]
        at org.springframework.boot.web.servlet.ServletContextInitializerBeans.addAsRegistrationBean(ServletContextInitializerBeans.java:173) ~[spring-boot-3.1.2.jar:3.1.2]
        at org.springframework.boot.web.servlet.ServletContextInitializerBeans.addAsRegistrationBean(ServletContextInitializerBeans.java:168) ~[spring-boot-3.1.2.jar:3.1.2]
        at org.springframework.boot.web.servlet.ServletContextInitializerBeans.addAdaptableBeans(ServletContextInitializerBeans.java:153) ~[spring-boot-3.1.2.jar:3.1.2]
        at org.springframework.boot.web.servlet.ServletContextInitializerBeans.<init>(ServletContextInitializerBeans.java:86) ~[spring-boot-3.1.2.jar:3.1.2]
        at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.getServletContextInitializerBeans(ServletWebServerApplicationContext.java:261) ~[spring-boot-3.1.2.jar:3.1.2]
        at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.selfInitialize(ServletWebServerApplicationContext.java:235) ~[spring-boot-3.1.2.jar:3.1.2]
        at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.createWebServer(ServletWebServerApplicationContext.java:192) ~[spring-boot-3.1.2.jar:3.1.2]
        at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.onRefresh(ServletWebServerApplicationContext.java:161) ~[spring-boot-3.1.2.jar:3.1.2]
        ... 47 common frames omitted
Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.boot.web.servlet.filter.OrderedFormContentFilter]: Factory method 'formContentFilter' threw exception with message: Could not initialize class com.fasterxml.jackson.databind.SerializationConfig
        at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:171) ~[spring-beans-6.0.11.jar:6.0.11]
        at org.springframework.beans.factory.support.ConstructorResolver.instantiate(ConstructorResolver.java:655) ~[spring-beans-6.0.11.jar:6.0.11]
        ... 65 common frames omitted
Caused by: java.lang.NoClassDefFoundError: Could not initialize class com.fasterxml.jackson.databind.SerializationConfig
        at com.fasterxml.jackson.databind.ObjectMapper.<init>(ObjectMapper.java:670) ~[jackson-databind-2.15.2.jar:2.15.2]
        at com.fasterxml.jackson.databind.ObjectMapper.<init>(ObjectMapper.java:576) ~[jackson-databind-2.15.2.jar:2.15.2]
        at org.springframework.http.converter.json.Jackson2ObjectMapperBuilder.build(Jackson2ObjectMapperBuilder.java:699) ~[spring-web-6.0.11.jar:6.0.11]
        at org.springframework.http.converter.json.MappingJackson2HttpMessageConverter.<init>(MappingJackson2HttpMessageConverter.java:63) ~[spring-web-6.0.11.jar:6.0.11]
        at org.springframework.http.converter.support.AllEncompassingFormHttpMessageConverter.<init>(AllEncompassingFormHttpMessageConverter.java:85) ~[spring-web-6.0.11.jar:6.0.11]
        at org.springframework.web.filter.FormContentFilter.<init>(FormContentFilter.java:61) ~[spring-web-6.0.11.jar:6.0.11]
        at org.springframework.boot.web.servlet.filter.OrderedFormContentFilter.<init>(OrderedFormContentFilter.java:29) ~[spring-boot-3.1.2.jar:3.1.2]
        at org.springframework.boot.autoconfigure.web.servlet.WebMvcAutoConfiguration.formContentFilter(WebMvcAutoConfiguration.java:175) ~[spring-boot-autoconfigure-3.1.2.jar:3.1.2]
        at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:104) ~[na:na]
        at java.base/java.lang.reflect.Method.invoke(Method.java:578) ~[na:na]
        at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:139) ~[spring-beans-6.0.11.jar:6.0.11]
        ... 66 common frames omitted
Caused by: java.lang.ExceptionInInitializerError: Exception java.lang.NoSuchMethodError: 'com.fasterxml.jackson.annotation.JsonFormat$Value com.fasterxml.jackson.annotation.JsonFormat$Value.empty()' [in thread "background-preinit"]
        at com.fasterxml.jackson.databind.cfg.MapperConfig.<clinit>(MapperConfig.java:56) ~[jackson-databind-2.15.2.jar:2.15.2]
        at com.fasterxml.jackson.databind.ObjectMapper.<init>(ObjectMapper.java:670) ~[jackson-databind-2.15.2.jar:2.15.2]
        at com.fasterxml.jackson.databind.ObjectMapper.<init>(ObjectMapper.java:576) ~[jackson-databind-2.15.2.jar:2.15.2]
        at org.springframework.http.converter.json.Jackson2ObjectMapperBuilder.build(Jackson2ObjectMapperBuilder.java:699) ~[spring-web-6.0.11.jar:6.0.11]
        at org.springframework.http.converter.json.MappingJackson2HttpMessageConverter.<init>(MappingJackson2HttpMessageConverter.java:63) ~[spring-web-6.0.11.jar:6.0.11]
        at org.springframework.http.converter.support.AllEncompassingFormHttpMessageConverter.<init>(AllEncompassingFormHttpMessageConverter.java:85) ~[spring-web-6.0.11.jar:6.0.11]
        at org.springframework.boot.autoconfigure.BackgroundPreinitializer$MessageConverterInitializer.run(BackgroundPreinitializer.java:141) ~[spring-boot-autoconfigure-3.1.2.jar:3.1.2]
        at org.springframework.boot.autoconfigure.BackgroundPreinitializer$1.runSafely(BackgroundPreinitializer.java:115) ~[spring-boot-autoconfigure-3.1.2.jar:3.1.2]
        at org.springframework.boot.autoconfigure.BackgroundPreinitializer$1.run(BackgroundPreinitializer.java:103) ~[spring-boot-autoconfigure-3.1.2.jar:3.1.2]
        at java.base/java.lang.Thread.run(Thread.java:1623) ~[na:na]

23-Oct-2023 09:48:59.308 SEVERE [main] org.apache.catalina.startup.HostConfig.deployWAR Error deploying web application archive [/usr/libexec/tomcat10/webapps/sellerAutoApp.war]
        java.lang.IllegalStateException: Error starting child
                at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:686)
                at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:658)
                at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:712)
                at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:975)
                at org.apache.catalina.startup.HostConfig$DeployWar.run(HostConfig.java:1952)
                at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:577)
                at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:317)
                at org.apache.tomcat.util.threads.InlineExecutorService.execute(InlineExecutorService.java:75)
                at java.base/java.util.concurrent.AbstractExecutorService.submit(AbstractExecutorService.java:123)
                at org.apache.catalina.startup.HostConfig.deployWARs(HostConfig.java:776)
                at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:426)
                at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1659)
                at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:309)
                at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:114)
                at org.apache.catalina.util.LifecycleBase.setStateInternal(LifecycleBase.java:402)
                at org.apache.catalina.util.LifecycleBase.setState(LifecycleBase.java:345)
                at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:893)
                at org.apache.catalina.core.StandardHost.startInternal(StandardHost.java:845)
                at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:171)
                at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1332)
                at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1322)
                at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:317)
                at org.apache.tomcat.util.threads.InlineExecutorService.execute(InlineExecutorService.java:75)
                at java.base/java.util.concurrent.AbstractExecutorService.submit(AbstractExecutorService.java:145)
                at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:866)
                at org.apache.catalina.core.StandardEngine.startInternal(StandardEngine.java:240)
                at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:171)
                at org.apache.catalina.core.StandardService.startInternal(StandardService.java:433)
                at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:171)
                at org.apache.catalina.core.StandardServer.startInternal(StandardServer.java:917)
                at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:171)
                at org.apache.catalina.startup.Catalina.start(Catalina.java:795)
                at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:104)
                at java.base/java.lang.reflect.Method.invoke(Method.java:578)
                at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:347)
                at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:478)
        Caused by: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/sellerAutoApp]]
                at org.apache.catalina.util.LifecycleBase.handleSubClassException(LifecycleBase.java:419)
                at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:186)
                at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:683)
                ... 35 more
        Caused by: org.springframework.context.ApplicationContextException: Unable to start web server
                at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.onRefresh(ServletWebServerApplicationContext.java:164)
                at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:602)
                at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:146)
                at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:734)
                at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:436)
                at org.springframework.boot.SpringApplication.run(SpringApplication.java:312)
                at org.springframework.boot.web.servlet.support.SpringBootServletInitializer.run(SpringBootServletInitializer.java:174)
                at org.springframework.boot.web.servlet.support.SpringBootServletInitializer.createRootApplicationContext(SpringBootServletInitializer.java:154)
                at org.springframework.boot.web.servlet.support.SpringBootServletInitializer.onStartup(SpringBootServletInitializer.java:96)
                at org.springframework.web.SpringServletContainerInitializer.onStartup(SpringServletContainerInitializer.java:171)
                at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:4850)
                at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:171)
                ... 36 more
        Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'formContentFilter' defined in class path resource [org/springframework/boot/autoconfigure/web/servlet/WebMvcAutoConfiguration.class]: Failed to instantiate [org.springframework.boot.web.servlet.filter.OrderedFormContentFilter]: Factory method 'formContentFilter' threw exception with message: Could not initialize class com.fasterxml.jackson.databind.SerializationConfig
                at org.springframework.beans.factory.support.ConstructorResolver.instantiate(ConstructorResolver.java:659)
                at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:493)
                at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1332)
                at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1162)
                at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:560)
                at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:520)
                at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:326)
                at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234)
                at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:324)
                at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:205)
                at org.springframework.boot.web.servlet.ServletContextInitializerBeans.getOrderedBeansOfType(ServletContextInitializerBeans.java:210)
                at org.springframework.boot.web.servlet.ServletContextInitializerBeans.addAsRegistrationBean(ServletContextInitializerBeans.java:173)
                at org.springframework.boot.web.servlet.ServletContextInitializerBeans.addAsRegistrationBean(ServletContextInitializerBeans.java:168)
                at org.springframework.boot.web.servlet.ServletContextInitializerBeans.addAdaptableBeans(ServletContextInitializerBeans.java:153)
                at org.springframework.boot.web.servlet.ServletContextInitializerBeans.<init>(ServletContextInitializerBeans.java:86)
                at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.getServletContextInitializerBeans(ServletWebServerApplicationContext.java:261)
                at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.selfInitialize(ServletWebServerApplicationContext.java:235)
                at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.createWebServer(ServletWebServerApplicationContext.java:192)
                at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.onRefresh(ServletWebServerApplicationContext.java:161)
                ... 47 more
        Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.boot.web.servlet.filter.OrderedFormContentFilter]: Factory method 'formContentFilter' threw exception with message: Could not initialize class com.fasterxml.jackson.databind.SerializationConfig
                at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:171)
                at org.springframework.beans.factory.support.ConstructorResolver.instantiate(ConstructorResolver.java:655)
                ... 65 more
        Caused by: java.lang.NoClassDefFoundError: Could not initialize class com.fasterxml.jackson.databind.SerializationConfig
                at com.fasterxml.jackson.databind.ObjectMapper.<init>(ObjectMapper.java:670)
                at com.fasterxml.jackson.databind.ObjectMapper.<init>(ObjectMapper.java:576)
                at org.springframework.http.converter.json.Jackson2ObjectMapperBuilder.build(Jackson2ObjectMapperBuilder.java:699)
                at org.springframework.http.converter.json.MappingJackson2HttpMessageConverter.<init>(MappingJackson2HttpMessageConverter.java:63)
                at org.springframework.http.converter.support.AllEncompassingFormHttpMessageConverter.<init>(AllEncompassingFormHttpMessageConverter.java:85)
                at org.springframework.web.filter.FormContentFilter.<init>(FormContentFilter.java:61)
                at org.springframework.boot.web.servlet.filter.OrderedFormContentFilter.<init>(OrderedFormContentFilter.java:29)
                at org.springframework.boot.autoconfigure.web.servlet.WebMvcAutoConfiguration.formContentFilter(WebMvcAutoConfiguration.java:175)
                at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:104)
                at java.base/java.lang.reflect.Method.invoke(Method.java:578)
                at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:139)
                ... 66 more
        Caused by: java.lang.ExceptionInInitializerError: Exception java.lang.NoSuchMethodError: 'com.fasterxml.jackson.annotation.JsonFormat$Value com.fasterxml.jackson.annotation.JsonFormat$Value.empty()' [in thread "background-preinit"]
                at com.fasterxml.jackson.databind.cfg.MapperConfig.<clinit>(MapperConfig.java:56)
                at com.fasterxml.jackson.databind.ObjectMapper.<init>(ObjectMapper.java:670)
                at com.fasterxml.jackson.databind.ObjectMapper.<init>(ObjectMapper.java:576)
                at org.springframework.http.converter.json.Jackson2ObjectMapperBuilder.build(Jackson2ObjectMapperBuilder.java:699)
                at org.springframework.http.converter.json.MappingJackson2HttpMessageConverter.<init>(MappingJackson2HttpMessageConverter.java:63)
                at org.springframework.http.converter.support.AllEncompassingFormHttpMessageConverter.<init>(AllEncompassingFormHttpMessageConverter.java:85)
                at org.springframework.boot.autoconfigure.BackgroundPreinitializer$MessageConverterInitializer.run(BackgroundPreinitializer.java:141)
                at org.springframework.boot.autoconfigure.BackgroundPreinitializer$1.runSafely(BackgroundPreinitializer.java:115)
                at org.springframework.boot.autoconfigure.BackgroundPreinitializer$1.run(BackgroundPreinitializer.java:103)
                at java.base/java.lang.Thread.run(Thread.java:1623)

23-Oct-2023 09:48:59.311 INFO [main] org.apache.catalina.startup.HostConfig.deployWAR Deployment of web application archive [/usr/libexec/tomcat10/webapps/sellerAutoApp.war] has finished in [5,637] ms

該当するソースコード

エラーの内容から依存関係ではないかと思い、build.gradleの内容を記載します。

plugins {
	id 'java'
	id 'org.springframework.boot' version '3.1.2'
	id 'io.spring.dependency-management' version '1.1.2'
	id 'war'
}

group = 'com.example'
version = '0.0.1-SNAPSHOT'

java {
	sourceCompatibility = '20'
}

configurations {
	compileOnly {
		extendsFrom annotationProcessor
	}
}

repositories {
    mavenCentral()
}

dependencies {
	implementation 'org.springframework.boot:spring-boot-starter-thymeleaf'
	compileOnly 'org.projectlombok:lombok'
	developmentOnly 'org.springframework.boot:spring-boot-devtools'
	annotationProcessor 'org.projectlombok:lombok'
	testImplementation 'org.springframework.boot:spring-boot-starter-test'
	// https://mvnrepository.com/artifact/com.mashape.unirest/unirest-java
	implementation group: 'com.mashape.unirest', name: 'unirest-java', version: '1.4.9'
	// https://mvnrepository.com/artifact/org.apache.poi/poi
	implementation 'org.apache.poi:poi-ooxml:5.2.2'

	// 追記
    // https://mvnrepository.com/artifact/org.mybatis.spring.boot/mybatis-spring-boot-starter
	implementation group: 'org.mybatis.spring.boot', name: 'mybatis-spring-boot-starter', version: '3.0.1'
	runtimeOnly 'org.postgresql:postgresql'
	
	implementation files('/lib/amazon/sellingpartnerapi-aa-java-1.0.jar')
	implementation files('/lib/amazon/Sellers_JavaCL-1.0.jar')
	implementation files('/lib/amazon/productPricingV0_JavaCL-1.0.jar')
	implementation files('/lib/amazon/catalogItems_2022-04-01-1.0.jar')
	                   
	// https://mvnrepository.com/artifact/org.threeten/threetenbp
	implementation group: 'org.threeten', name: 'threetenbp', version: '1.5.0'
	// https://mvnrepository.com/artifact/io.gsonfire/gson-fire
	implementation group: 'io.gsonfire', name: 'gson-fire', version: '1.8.0'
	
	// https://mvnrepository.com/artifact/org.apache.httpcomponents/httpclient
	implementation group: 'org.apache.httpcomponents', name: 'httpclient', version: '4.5.13'
	
	// https://mvnrepository.com/artifact/com.alibaba/fastjson
	implementation group: 'com.alibaba', name: 'fastjson', version: '1.2.83'

	providedRuntime 'org.springframework.boot:spring-boot-starter-tomcat'
	implementation ('org.springframework.boot:spring-boot-starter-web') {
  		exclude group: 'org.springframework.boot', module: 'spring-boot-starter-tomcat'
	}

}

tasks.named('test') {
	useJUnitPlatform()
}

自分で試したこと

・OS再導入、再構築
・tomcat再インストール
・build.gradleの依存関係修正
 ①jackson-databindのバージョン変更
  もともとは2.14.2が依存関係に含まれていたが、2.12.5に変更 ⇒変化なし
 ②jackson-databindの依存関係削除
  spring boot(3.1.2)には、jackson-databind ver.2.15.2 の依存関係が含まれている
 ③jackson-databind、jackson-annotations、jackson-core (ver.2.14.2)の依存関係追加 ⇒White Label Page(500)エラー発生
・Localにtomcatインストールして動作確認 ⇒正常に稼働

0

1Answer

Comments

  1. @daifuku1011

    Questioner

    ご回答ありがとうございます!
    確認します。

Your answer might help someone💌