Tomcat 10要改用Jakarta EE了!


  • ACG

    前因是Eclipse Foundation与Oracle谈判破裂,因此Eclipse Foundation与Jakarta EE社区不再能使用javax.*包空间,因此代码必须做出改变,把javax.*下的内容迁移到jakarta.*(Oracle法务部牛逼)


    然后,Tomcat 10,2020年2月开始测试,使用的是新的包空间,因此几乎所有涉及到Java代码的web应用都需要做出更改,SpringFramework也不能幸免
    刚才我去Tomcat官网下载了10.0.0-M5版本并把我部署在Tomcat 9上的SpringBoot应用部署到上面,果然在启动阶段就直接报错了:

    java.lang.IllegalStateException: Failed to load ApplicationContext
    Caused by: org.springframework.beans.factory.BeanDefinitionStoreException: Failed to parse configuration class [org.bkcloud.HelloMVCApplication]; nested exception is java.lang.IllegalStateException: Failed to introspect annotated methods on class org.springframework.boot.web.servlet.support.SpringBootServletInitializer
    Caused by: java.lang.IllegalStateException: Failed to introspect annotated methods on class org.springframework.boot.web.servlet.support.SpringBootServletInitializer
    Caused by: java.lang.IllegalStateException: Failed to introspect Class [org.springframework.boot.web.servlet.support.SpringBootServletInitializer] from ClassLoader [jdk.internal.loader.ClassLoaders$AppClassLoader@15db9742]
    Caused by: java.lang.NoClassDefFoundError: javax/servlet/ServletContext
    Caused by: java.lang.ClassNotFoundException: javax.servlet.ServletContext
    

    Tomcat 10提供了官方的迁移工具,可以把9的项目迁移到10,但是需要从GitHub下载源码,自己编译,而且版本号居然是0.0.1
    总之,目前完全没动力从9迁移到10,还是等Spring和Tomcat适配完毕再考虑吧,我还是比较喜欢无痛迁移


Log in to reply