在jetty embedded中使用wars,websocket无需工厂升级

在jetty embedded中使用wars,websocket无需工厂升级,websocket,jetty,war,Websocket,Jetty,War,我有两场战争,我正试图在一个防波堤上进行。其中一个使用WebSocket。使用浏览器,除了WebSocket之外,我可以很好地获得对两场战争的回应。当我降低日志级别进行调试时,我看到以下错误。是否存在我尚未在WebAppContext上配置的工厂 2020-09-09 10:35:10.204:DBUG:oejs.HttpChannelOverHttp:qtp38997010-16:升级HttpChannelOverHttp@3627c323{s=HttpChannelState@42e23fe

我有两场战争,我正试图在一个防波堤上进行。其中一个使用WebSocket。使用浏览器,除了WebSocket之外,我可以很好地获得对两场战争的回应。当我降低日志级别进行调试时,我看到以下错误。是否存在我尚未在WebAppContext上配置的工厂

2020-09-09 10:35:10.204:DBUG:oejs.HttpChannelOverHttp:qtp38997010-16:升级HttpChannelOverHttp@3627c323{s=HttpChannelState@42e23fe6{s=IDLE rs=BLOCKING os=OPEN is=IDLE awp=false se=false i=true al=0},r=0,c=false/false,a=IDLE,uri=null,age=0}升级:websocket 2020-09-09 10:35:10.204:DBUG:oejs.HttpChannelOverHttp:qtp38997010-16:无升级工厂ServerConnector@6073f712{HTTP/1.1,(HTTP/1.1)}{0.0.0.0:9191}

资料来源:

publicstaticvoidmain(字符串[]args)引发异常{
服务器=新服务器();
ServerConnector连接器=新的ServerConnector(服务器);
setConnectors(新连接器[]{Connector});
//战争#1
WebAppContext portalContext=新的WebAppContext();
portalContext.setContextPath(“/portal”);
portalContext.setWar(“/path/to/war/file/app1.war”)
//战争#2(与websocket的战争)
WebAppContext hubContext=新的WebAppContext();
setContextPath(“/hub”);
setWar(“/path/to/war/file/app2.war”)
HandlerCollection HandlerCollection=新HandlerCollection();
SetHandlerCollection.setHandlers(新处理程序[]{hubContext,portalContext});
setHandler(handlerCollection);
试一试{
server.start();
System.in.read();
server.stop();
join();
}捕获(例外e){
e、 printStackTrace();
系统出口(100);
}
}

在服务器级别启用字节码扫描

Server server = new Server();
Configuration.ClassList classlist = Configuration.ClassList
    .setServerDefault(server);

classlist.addBefore(
    "org.eclipse.jetty.webapp.JettyWebXmlConfiguration",
    "org.eclipse.jetty.annotations.AnnotationConfiguration");

这将对所有部署的webappcontext应用注释配置。

在服务器级别启用字节码扫描

Server server = new Server();
Configuration.ClassList classlist = Configuration.ClassList
    .setServerDefault(server);

classlist.addBefore(
    "org.eclipse.jetty.webapp.JettyWebXmlConfiguration",
    "org.eclipse.jetty.annotations.AnnotationConfiguration");

这将对所有部署的WebAppContext应用AnnotationConfiguration。

请编辑您的问题,并包含一段代码片段,说明如何为这些war文件创建(和配置)WebAppContext。由于您似乎缺少一些
配置
类型和/或字节码扫描。已使用源代码进行更新。请编辑您的问题,并包含有关如何为这些war文件创建(和配置)WebAppContext的代码片段。似乎您缺少一些
配置
类型和/或字节码扫描。已使用源代码更新。