Servlet class org.glassfish.jersey.servlet.ServletContainer is not a javax.servlet.Servlet

文章讨论了一个在使用SpringBoot和Spark时遇到的错误,具体是由于ServletContainer类未被正确识别为Servlet导致的UnavailableException。作者提供的解决方案是关闭Spark的用户界面(SparkUI),通过设置spark.ui.enabled为false来避免该问题。

报错Caused by: javax.servlet.UnavailableException: Servlet class org.glassfish.jersey.servlet.ServletContainer is not a javax.servlet.Servlet

版本依赖:

<properties>
        <java.version>17</java.version>
        <springboot.version>3.0.4</springboot.version>
        <scala.version>2.12.15</scala.version>
        <scala.binary.version>2.12</scala.binary.version>
        <spark.version>3.3.2</spark.version>
        <jackson.version>2.13.2.2</jackson.version>
        <janino.version>3.0.16</janino.version>
        <hadoop.version>3.3.4</hadoop.version>
        <commons-pool2.version>2.8.0</commons-pool2.version>
        <fasterxml.jackson.version>2.10.5</fasterxml.jackson.version>
        <javacsv.version>2.0</javacsv.version>
    </properties>

解决方案:

直接关掉spark-ui,简单粗暴

sparkConf.set("spark.ui.enabled","false");

如下

SparkConf sparkConf = new SparkConf();
sparkConf.set("spark.ui.enabled","false");
SparkSession sparkSession = SparkSession
.builder()
.master("local[*]")
.appName("syncUpdate")
.config(sparkConf)
.getOrCreate();
<Sep 5, 2025 5:57:13,676 PM CST> <Error> <HTTP> <BEA-101165> <Could not load user defined filter in web.xml: com.yinhai.hfdata.common.core.mvc.WebSecurityRequestBlackListFilter. java.lang.AbstractMethodError at weblogic.servlet.internal.FilterManager$FilterInitAction.run(FilterManager.java:400) at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:344) at weblogic.security.service.SecurityManager.runAsForUserCode(SecurityManager.java:197) at weblogic.servlet.provider.WlsSecurityProvider.runAsForUserCode(WlsSecurityProvider.java:203) at weblogic.servlet.provider.WlsSubjectHandle.run(WlsSubjectHandle.java:71) Truncated. > Sep 05, 2025 5:57:14 PM org.glassfish.jersey.server.ApplicationHandler bindProvidersAndResources WARNING: Component of class interface org.keycloak.admin.client.resource.ServerInfoResource cannot be instantiated and will be ignored. <Sep 5, 2025 5:57:14,018 PM CST> <Warning> <org.glassfish.jersey.server.ApplicationHandler> <BEA-000000> <Component of class interface org.keycloak.admin.client.resource.ServerInfoResource cannot be instantiated and will be ignored.> Sep 05, 2025 5:57:14 PM org.glassfish.jersey.server.ApplicationHandler bindProvidersAndResources WARNING: Component of class interface org.keycloak.admin.client.resource.RealmsResource cannot be instantiated and will be ignored. <Sep 5, 2025 5:57:14,019 PM CST> <Warning> <org.glassfish.jersey.server.ApplicationHandler> <BEA-000000> <Component of class interface org.keycloak.admin.client.resource.RealmsResource cannot be instantiated and will be ignored.>
最新发布
09-06
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值