项目

一般

简介

java.lang.IllegalStateException: Attribute 'javax.websocket.server.ServerContainer' not found in ServletContext

陈 泽豪将近 2 年 之前添加

异常:[2023-03-27T10:08:44] [] [INFO] [] [] [tid: _ThreadID=93 _ThreadName=ApusicLogManager] [timeMillis: 1679882924132] [levelValue: 800] [[
  2023-03-27T10:08:44.132+08:00 ERROR lm.license [AutoDeployer] [org.springframework.boot.SpringApplication:824] Application run failed
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'createWebSocketContainer' defined in class path resource [com/xxxx/lm/config/WebSocketConfig.class]: Invocation of init method failed; nested exception is java.lang.IllegalStateException: Attribute 'javax.websocket.server.ServerContainer' not found in ServletContext
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1804)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:620)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:542)
    at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:335)
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234)
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:333)
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:208)
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:936)
    at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:920)
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:583)
    at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:147)
    at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:734)
    at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:408)
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:308)
    at org.springframework.boot.web.servlet.support.SpringBootServletInitializer.run(SpringBootServletInitializer.java:175)
    at org.springframework.boot.web.servlet.support.SpringBootServletInitializer.createRootApplicationContext(SpringBootServletInitializer.java:155)
    at org.springframework.boot.web.servlet.support.SpringBootServletInitializer.onStartup(SpringBootServletInitializer.java:97)
    at org.springframework.web.SpringServletContainerInitializer.onStartup(SpringServletContainerInitializer.java:174)
    at org.apache.catalina.core.StandardContext.callServletContainerInitializers(StandardContext.java:5764)
    at com.sun.enterprise.web.WebModule.callServletContainerInitializers(WebModule.java:609)
    at org.apache.catalina.core.StandardContext.start(StandardContext.java:5660)
    at com.sun.enterprise.web.WebModule.start(WebModule.java:526)
    at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:885)
    at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:868)
    at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:644)
    at com.sun.enterprise.web.WebContainer.loadWebModule(WebContainer.java:2069)
    at com.sun.enterprise.web.WebContainer.loadWebModule(WebContainer.java:1690)
    at com.sun.enterprise.web.WebApplication.start(WebApplication.java:83)
    at com.apusic.aas.internal.data.EngineRef.start(EngineRef.java:98)
    at com.apusic.aas.internal.data.ModuleInfo.start(ModuleInfo.java:267)
    at com.apusic.aas.internal.data.ApplicationInfo.start(ApplicationInfo.java:358)
    at com.apusic.enterprise.v10.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:479)
    at com.apusic.enterprise.v10.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:197)
    at com.apusic.aas.deployment.admin.DeployCommand.execute(DeployCommand.java:489)
    at com.apusic.enterprise.v10.admin.CommandRunnerImpl$2$1.run(CommandRunnerImpl.java:523)
    at com.apusic.enterprise.v10.admin.CommandRunnerImpl$2$1.run(CommandRunnerImpl.java:519)
    at java.base/java.security.AccessController.doPrivileged(Native Method)
    at java.base/javax.security.auth.Subject.doAs(Subject.java:361)
    at com.apusic.enterprise.v10.admin.CommandRunnerImpl$2.execute(CommandRunnerImpl.java:518)
    at com.apusic.enterprise.v10.admin.CommandRunnerImpl$3.run(CommandRunnerImpl.java:549)
    at com.apusic.enterprise.v10.admin.CommandRunnerImpl$3.run(CommandRunnerImpl.java:541)
    at java.base/java.security.AccessController.doPrivileged(Native Method)
    at java.base/javax.security.auth.Subject.doAs(Subject.java:361)
    at com.apusic.enterprise.v10.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:540)
    at com.apusic.enterprise.v10.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:1448)
    at com.apusic.enterprise.v10.admin.CommandRunnerImpl.access$1500(CommandRunnerImpl.java:88)
    at com.apusic.enterprise.v10.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1842)
    at com.apusic.aas.deployment.autodeploy.AutoOperation.run(AutoOperation.java:143)
    at com.apusic.aas.deployment.autodeploy.AutoDeployer.deploy(AutoDeployer.java:580)
    at com.apusic.aas.deployment.autodeploy.AutoDeployer.deployAll(AutoDeployer.java:467)
    at com.apusic.aas.deployment.autodeploy.AutoDeployer.run(AutoDeployer.java:389)
    at com.apusic.aas.deployment.autodeploy.AutoDeployer.run(AutoDeployer.java:380)
    at com.apusic.aas.deployment.autodeploy.AutoDeployService$1.run(AutoDeployService.java:209)
    at java.base/java.util.TimerThread.mainLoop(Timer.java:556)
    at java.base/java.util.TimerThread.run(Timer.java:506)
Caused by: java.lang.IllegalStateException: Attribute 'javax.websocket.server.ServerContainer' not found in ServletContext
    at org.springframework.util.Assert.state(Assert.java:76)
    at org.springframework.web.socket.server.standard.ServletServerContainerFactoryBean.afterPropertiesSet(ServletServerContainerFactoryBean.java:117)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1863)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1800)
    ... 54 common frames omitted

处理:

1.如果是应用调用了serverEndpointExporter方法外,注释相应方法:https://www.jianshu.com/p/21b1224d4066

2.通过管控部署的话,勾选delegate部署

3.使用自动部署的方式,更换补丁包

备份ApusicAS/aas/modules下的aas-web-glue.jar、aas-deployment-autodeploy.jar到其他非中间件目录,用附件的两个补丁包进行替换