chenyuguxing 发表于 2019-12-25 10:59:17

war包部署报错-已解决

本帖最后由 chenyuguxing 于 2019-12-25 11:04 编辑

想使用外部tomcat开发和部署, 但是按照官方文档的方法还是报错, 貌似是因为websocket的问题, 有人遇到了吗
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'serverEndpointExporter' defined in class path resource : Invocation of init method failed; nested exception is java.lang.IllegalStateException: javax.websocket.server.ServerContainer not available
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1762)
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:593)
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:515)
      at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:320)
      at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
      at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:318)
      at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:199)
      at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:849)
      at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:877)
      at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:549)
      at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:142)
      at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:775)
      at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:397)
      at org.springframework.boot.SpringApplication.run(SpringApplication.java:316)
      at org.springframework.boot.web.servlet.support.SpringBootServletInitializer.run(SpringBootServletInitializer.java:157)
      at org.springframework.boot.web.servlet.support.SpringBootServletInitializer.createRootApplicationContext(SpringBootServletInitializer.java:137)
      at org.springframework.boot.web.servlet.support.SpringBootServletInitializer.onStartup(SpringBootServletInitializer.java:91)
      at org.springframework.web.SpringServletContainerInitializer.onStartup(SpringServletContainerInitializer.java:171)
      at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5225)
      at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
      at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:754)
      at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:730)
      at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:744)
      at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:980)
      at org.apache.catalina.startup.HostConfig$DeployWar.run(HostConfig.java:1851)
      at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
      at java.util.concurrent.FutureTask.run(FutureTask.java:266)
      at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
      at java.lang.Thread.run(Thread.java:748)
Caused by: java.lang.IllegalStateException: javax.websocket.server.ServerContainer not available
      at org.springframework.util.Assert.state(Assert.java:73)
      at org.springframework.web.socket.server.standard.ServerEndpointExporter.afterPropertiesSet(ServerEndpointExporter.java:106)
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1821)
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1758)
      ... 29 common frames omitted
25-Dec-2019 10:40:53.608 严重 org.apache.catalina.core.ContainerBase.addChildInternal ContainerBase.addChild: start:
      org.apache.catalina.LifecycleException: Failed to start component .StandardHost.StandardContext]
                at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:167)
                at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:754)
                at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:730)
                at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:744)
                at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:980)
                at org.apache.catalina.startup.HostConfig$DeployWar.run(HostConfig.java:1851)
                at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
                at java.util.concurrent.FutureTask.run(FutureTask.java:266)
                at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
                at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
                at java.lang.Thread.run(Thread.java:748)
      Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'serverEndpointExporter' defined in class path resource : Invocation of init method failed; nested exception is java.lang.IllegalStateException: javax.websocket.server.ServerContainer not available
                at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1762)
                at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:593)
                at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:515)
                at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:320)
                at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
                at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:318)
                at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:199)
                at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:849)
                at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:877)
                at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:549)
                at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:142)
                at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:775)
                at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:397)
                at org.springframework.boot.SpringApplication.run(SpringApplication.java:316)
                at org.springframework.boot.web.servlet.support.SpringBootServletInitializer.run(SpringBootServletInitializer.java:157)
                at org.springframework.boot.web.servlet.support.SpringBootServletInitializer.createRootApplicationContext(SpringBootServletInitializer.java:137)
                at org.springframework.boot.web.servlet.support.SpringBootServletInitializer.onStartup(SpringBootServletInitializer.java:91)
                at org.springframework.web.SpringServletContainerInitializer.onStartup(SpringServletContainerInitializer.java:171)
                at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5225)
                at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
                ... 10 more
      Caused by: java.lang.IllegalStateException: javax.websocket.server.ServerContainer not available
                at org.springframework.util.Assert.state(Assert.java:73)
                at org.springframework.web.socket.server.standard.ServerEndpointExporter.afterPropertiesSet(ServerEndpointExporter.java:106)
                at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1821)
                at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1758)
                ... 29 more
25-Dec-2019 10:40:53.609 严重 org.apache.catalina.startup.HostConfig.deployWAR Error deploying web application archive
      java.lang.IllegalStateException: ContainerBase.addChild: start: org.apache.catalina.LifecycleException: Failed to start component .StandardHost.StandardContext]
                at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:758)
                at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:730)
                at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:744)
                at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:980)
                at org.apache.catalina.startup.HostConfig$DeployWar.run(HostConfig.java:1851)
                at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
                at java.util.concurrent.FutureTask.run(FutureTask.java:266)
                at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
                at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
                at java.lang.Thread.run(Thread.java:748)

chenyuguxing 发表于 2019-12-25 11:03:49

已解决

liuzs518 发表于 2020-1-9 13:11:51

chenyuguxing 发表于 2019-12-25 11:03 static/image/common/back.gif
已解决

什么原因?如何解决?

lycplayer 发表于 2020-1-10 09:34:04

常见问题里已收纳, 部署到tomcat里要注释掉serverEndpointExporter
//    @Bean
//    public ServerEndpointExporter serverEndpointExporter() {
//      return new ServerEndpointExporter();
//    }
页: [1]
查看完整版本: war包部署报错-已解决