You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
public class WebsocketListener implements ServletContextListener { @OverRide
public void contextDestroyed(ServletContextEvent arg0) {
}
private Server server = null; @OverRide
public void contextInitialized(ServletContextEvent servletContextEvent) {
logger.info("initial start");
this.server = new Server(8080);
try {
ServletContext servletContext = servletContextEvent.getServletContext();
String contextPath = servletContext.getContextPath();
ServletContextHandler context = new ServletContextHandler(ServletContextHandler.SESSIONS);
context.setContextPath(contextPath);
server.setHandler(context);
ServerContainer container = WebSocketServerContainerInitializer.configureContext(context);
container.addEndpoint(EchoEndpoint.class);
server.start();
server.join(); // wait for server to stop
} catch (Exception e) {
e.printStackTrace();
} finally {
logger.info("initial end");
}
}
`
the error is : Exception in thread "main" java.lang.LinkageError: loader constraint violation: when resolving method "org.eclipse.jetty.websocket.jsr356.server.deploy.WebSocketServerContainerInitializer.configureContext(Lorg/eclipse/jetty/servlet/ServletContextHandler;)Lorg/eclipse/jetty/websocket/jsr356/server/ServerContainer;" the class loader (instance of runjettyrun/ProjectClassLoader) of the current class, com/dena/server/listener/WebsocketListener, and the class loader (instance of sun/misc/Launcher$AppClassLoader) for the method's defining class, org/eclipse/jetty/websocket/jsr356/server/deploy/WebSocketServerContainerInitializer, have different Class objects for the type org/eclipse/jetty/servlet/ServletContextHandler used in the signature at XXX.XXXXX.listener.WebsocketListener.contextInitialized(WebsocketListener.java:51) at org.eclipse.jetty.server.handler.ContextHandler.callContextInitialized(ContextHandler.java:890) at org.eclipse.jetty.servlet.ServletContextHandler.callContextInitialized(ServletContextHandler.java:532) at org.eclipse.jetty.server.handler.ContextHandler.startContext(ContextHandler.java:853) at org.eclipse.jetty.servlet.ServletContextHandler.startContext(ServletContextHandler.java:344) at org.eclipse.jetty.webapp.WebAppContext.startWebapp(WebAppContext.java:1515) at org.eclipse.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1477) at org.eclipse.jetty.server.handler.ContextHandler.doStart(ContextHandler.java:785) at org.eclipse.jetty.servlet.ServletContextHandler.doStart(ServletContextHandler.java:261) at org.eclipse.jetty.webapp.WebAppContext.doStart(WebAppContext.java:545) at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68) at org.eclipse.jetty.util.component.ContainerLifeCycle.start(ContainerLifeCycle.java:133) at org.eclipse.jetty.server.Server.start(Server.java:418) at org.eclipse.jetty.util.component.ContainerLifeCycle.doStart(ContainerLifeCycle.java:107) at org.eclipse.jetty.server.handler.AbstractHandler.doStart(AbstractHandler.java:113) at org.eclipse.jetty.server.Server.doStart(Server.java:385) at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68) at runjettyrun.Bootstrap.main(Bootstrap.java:89)
The text was updated successfully, but these errors were encountered:
RJR with Jetty version
jetty version is 9.4.8v20171121
Java version
jdk 8
Question
have a error about jsr356 when start in eclipse used RJR
my project is websocket.
thanks!
the code is:
`
import javax.servlet.ServletContext;
import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener;
import org.eclipse.jetty.server.Server;
import org.eclipse.jetty.servlet.ServletContextHandler;
import org.eclipse.jetty.websocket.jsr356.server.ServerContainer;
import org.eclipse.jetty.websocket.jsr356.server.deploy.WebSocketServerContainerInitializer;
public class WebsocketListener implements ServletContextListener {
@OverRide
public void contextDestroyed(ServletContextEvent arg0) {
}
private Server server = null;
@OverRide
public void contextInitialized(ServletContextEvent servletContextEvent) {
logger.info("initial start");
this.server = new Server(8080);
try {
ServletContext servletContext = servletContextEvent.getServletContext();
String contextPath = servletContext.getContextPath();
ServletContextHandler context = new ServletContextHandler(ServletContextHandler.SESSIONS);
context.setContextPath(contextPath);
server.setHandler(context);
}
`
the error is :
Exception in thread "main" java.lang.LinkageError: loader constraint violation: when resolving method "org.eclipse.jetty.websocket.jsr356.server.deploy.WebSocketServerContainerInitializer.configureContext(Lorg/eclipse/jetty/servlet/ServletContextHandler;)Lorg/eclipse/jetty/websocket/jsr356/server/ServerContainer;" the class loader (instance of runjettyrun/ProjectClassLoader) of the current class, com/dena/server/listener/WebsocketListener, and the class loader (instance of sun/misc/Launcher$AppClassLoader) for the method's defining class, org/eclipse/jetty/websocket/jsr356/server/deploy/WebSocketServerContainerInitializer, have different Class objects for the type org/eclipse/jetty/servlet/ServletContextHandler used in the signature at XXX.XXXXX.listener.WebsocketListener.contextInitialized(WebsocketListener.java:51) at org.eclipse.jetty.server.handler.ContextHandler.callContextInitialized(ContextHandler.java:890) at org.eclipse.jetty.servlet.ServletContextHandler.callContextInitialized(ServletContextHandler.java:532) at org.eclipse.jetty.server.handler.ContextHandler.startContext(ContextHandler.java:853) at org.eclipse.jetty.servlet.ServletContextHandler.startContext(ServletContextHandler.java:344) at org.eclipse.jetty.webapp.WebAppContext.startWebapp(WebAppContext.java:1515) at org.eclipse.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1477) at org.eclipse.jetty.server.handler.ContextHandler.doStart(ContextHandler.java:785) at org.eclipse.jetty.servlet.ServletContextHandler.doStart(ServletContextHandler.java:261) at org.eclipse.jetty.webapp.WebAppContext.doStart(WebAppContext.java:545) at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68) at org.eclipse.jetty.util.component.ContainerLifeCycle.start(ContainerLifeCycle.java:133) at org.eclipse.jetty.server.Server.start(Server.java:418) at org.eclipse.jetty.util.component.ContainerLifeCycle.doStart(ContainerLifeCycle.java:107) at org.eclipse.jetty.server.handler.AbstractHandler.doStart(AbstractHandler.java:113) at org.eclipse.jetty.server.Server.doStart(Server.java:385) at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68) at runjettyrun.Bootstrap.main(Bootstrap.java:89)
The text was updated successfully, but these errors were encountered: