一、结语
前段时间接了个相等于BizTalk的工程项目,在她们工程项目中软件系统两个WebSocket的服务器端,嗯机能只不过无从,但后方有坑。
责任编辑主要就来历史记录呵呵,假如没了腾讯,在工程项目开启就抛极度、或是许多譬如的难题,靠她们是并非去摸查难题,反之亦然有时并并非大部份的难题都能透过浏览器来化解。
除力矩,那他们就只剩:极度重要信息、源码、和这类实战经验。
工程项目架构用的是SpringBoot,接着软件系统WebSocketxml,在软件系统的操作过程中,当中有一步棋须要实用性两个Bean。
@ComponentpublicclassWsConfig{@BeanpublicServerEndpointExporterserverEndpointExporter(){
ServerEndpointExporter serverEndpointExporter =newServerEndpointExporter();returnserverEndpointExporter;
}
接着在工程项目开启的时候抛出了极度重要信息:
org.springframework.beans.factory.BeanCreationException:Error creating bean with name serverEndpointExporter defined in class path resource [org/springblade/modules/hol/config/WsConfig.class]: Invocation of init method failed; nested exception is java.lang.IllegalStateException: javax.websocket.server.ServerContainer not availableatorg.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1769)atorg.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:592)atorg.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:514)atorg.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:321)atorg.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:226)atorg.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:319)atorg.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:199)atorg.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:863)atorg.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:878)atorg.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:550)atorg.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:141)atorg.springframework.boot.SpringApplication.refresh(SpringApplication.java:744)atorg.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:391)atorg.springframework.boot.SpringApplication.run(SpringApplication.java:312)atorg.springframework.boot.builder.SpringApplicationBuilder.run(SpringApplicationBuilder.java:140)atorg.springblade.core.launch.BladeApplication.run(BladeApplication.java:50)atorg.springblade.Application.main(Application.java:18)Causedby: java.lang.IllegalStateException: javax.websocket.server.ServerContainer not availableatorg.springframework.util.Assert.state(Assert.java:73)atorg.springframework.web.socket.server.standard.ServerEndpointExporter.afterPropertiesSet(ServerEndpointExporter.java:107)atorg.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1828)atorg.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1765)...16 common frames omitted
二、难题预测
Error creating bean with name serverEndpointExporter defined in class path resource [org/springblade/modules/hol/config/WsConfig.class]: Invocation of init method failed; nested exception is java.lang.IllegalStateException: javax.websocket.server.ServerContainer not available
透过极度的第一行就能得知,是在Spring创建serverEndpointExporterbean的时候抛出来的,是这个WsConfig类,原因是:ServerContainer这个对象不可使用。
抛出极度的类是:AbstractAutowireCapableBeanFactory.java:1769
预测到这里就能得知,是在spring创建serverEndpointExporter的时候极度了,那么极度的原因是甚么呢?,为甚么ServerContainer不可用呢?接着预测
透过控制台点击到对应的源码重要信息如下:AbstractAutowireCapableBeanFactory.java:1769
protectedObjectinitializeBean(StringbeanName,Objectbean,@NullableRootBeanDefinition mbd) {if(System.getSecurityManager() !=null) {
AccessController.doPrivileged((PrivilegedAction
1.本站所有资源来源于用户上传和网络,如有侵权请邮件联系站长!
2.分享目的仅供大家学习和交流,您必须在下载后24小时内删除!
3.不得使用于非法商业用途,不得违反国家法律。否则后果自负!
4.本站提供的源码、模板、插件等其他资源,都不包含技术服务请大家谅解!
5.如有链接无法下载或失效,请联系管理员处理!
6.本站资源售价只是赞助,收取费用仅维持本站的日常运营所需!