Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [jetty-users] Jetty 9.1.2 IncompatibleClassChangeError

Your code ...

context.setParentLoaderPriority(true);

... is subverting the standard webapp classloader behavior as well.

--
Joakim Erdfelt <joakim@xxxxxxxxxxx>
Expert advice, services and support from from the Jetty & CometD experts


On Mon, Feb 17, 2014 at 12:50 PM, Jason Fugate <saladyears@xxxxxxxxx> wrote:
My game is a full on server/client app, so I'm not sure how exactly to remove jetty from the WEB-INF/lib without breaking the game.  The index.html file for the game loads resources then opens a websocket to the jetty server from which it was just served.  The server code in the app has a websocket listener that processes all the communication from the client as players play the game. In production, the app is served from a jetty service that simply loads up the game's .war file and goes.

In testing, I just want to simulate the server by loading the war file directory programatically.  The test server looks like this:

import org.eclipse.jetty.server.Server;
import org.eclipse.jetty.webapp.WebAppContext;

public final class WebSocketServer {

public static void main (String[] args) throws Exception {
Server server = new Server(8081);
WebAppContext context = new WebAppContext();
context.setDescriptor("/tacan-app/war/WEB-INF/web.xml");
context.setResourceBase("/tacan-app/war");
context.setContextPath("/game");
context.setParentLoaderPriority(true);
server.setHandler(context);
server.start();
server.join();
}
}


On Mon, Feb 17, 2014 at 9:49 AM, Joakim Erdfelt <joakim@xxxxxxxxxxx> wrote:
You have the websocket classes both in the server side and also in the webapp side.

To fix, remove the websocket classes from your webapp's WEB-INF/lib/  tree.

--
Joakim Erdfelt <joakim@xxxxxxxxxxx>
Expert advice, services and support from from the Jetty & CometD experts


On Mon, Feb 17, 2014 at 9:34 AM, Jason Fugate <saladyears@xxxxxxxxx> wrote:

I'm updating my WebSocket game from Jetty 8 to Jetty 9.  I have a little embedded test server that I use to launch the game for debugging, which works in Jetty 8.  After updating the .jar files to 9 and refactoring my WebSocket classes to the new paradigm in 9, I can launch the embedded test server, but when I connect to it in the browser, I get the below error and stack trace.

Manually breakpointing the callstack shows that it is failing on loading org.eclipse.jetty.util.component.Container, which is strange because it seemingly creates such Containers with ease in the launch of the server.

This link is a screenshot of my build path in Eclipse: http://imgur.com/d7XOgsM  The app builds with GWT 2.6.  Any ideas on what I'm missing here?

java.lang.IncompatibleClassChangeError: Implementing class
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:800)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:449)
at java.net.URLClassLoader.access$100(URLClassLoader.java:71)
at java.net.URLClassLoader$1.run(URLClassLoader.java:361)
at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
at org.eclipse.jetty.webapp.WebAppClassLoader.loadClass(WebAppClassLoader.java:421)
at org.eclipse.jetty.webapp.WebAppClassLoader.loadClass(WebAppClassLoader.java:383)
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:800)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:449)
at java.net.URLClassLoader.access$100(URLClassLoader.java:71)
at java.net.URLClassLoader$1.run(URLClassLoader.java:361)
at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
at org.eclipse.jetty.webapp.WebAppClassLoader.loadClass(WebAppClassLoader.java:421)
at org.eclipse.jetty.webapp.WebAppClassLoader.loadClass(WebAppClassLoader.java:383)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:270)
at java.util.ServiceLoader$LazyIterator.next(ServiceLoader.java:363)
at java.util.ServiceLoader$1.next(ServiceLoader.java:445)
at org.eclipse.jetty.websocket.servlet.WebSocketServletFactory$Loader.load(WebSocketServletFactory.java:56)
at org.eclipse.jetty.websocket.servlet.WebSocketServletFactory$Loader.create(WebSocketServletFactory.java:42)
at org.eclipse.jetty.websocket.servlet.WebSocketServlet.init(WebSocketServlet.java:128)
at javax.servlet.GenericServlet.init(GenericServlet.java:244)
at org.eclipse.jetty.servlet.ServletHolder.initServlet(ServletHolder.java:534)
at org.eclipse.jetty.servlet.ServletHolder.getServlet(ServletHolder.java:417)
at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:659)
at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:501)
at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:137)
at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:557)
at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:231)
at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1086)
at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:428)
at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:193)
at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1020)
at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:135)
at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:116)
at org.eclipse.jetty.server.Server.handle(Server.java:366)
at org.eclipse.jetty.server.AbstractHttpConnection.handleRequest(AbstractHttpConnection.java:489)
at org.eclipse.jetty.server.AbstractHttpConnection.headerComplete(AbstractHttpConnection.java:949)
at org.eclipse.jetty.server.AbstractHttpConnection$RequestHandler.headerComplete(AbstractHttpConnection.java:1011)
at org.eclipse.jetty.http.HttpParser.parseNext(HttpParser.java:644)
at org.eclipse.jetty.http.HttpParser.parseAvailable(HttpParser.java:235)
at org.eclipse.jetty.server.AsyncHttpConnection.handle(AsyncHttpConnection.java:82)
at org.eclipse.jetty.io.nio.SelectChannelEndPoint.handle(SelectChannelEndPoint.java:668)
at org.eclipse.jetty.io.nio.SelectChannelEndPoint$1.run(SelectChannelEndPoint.java:52)
at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:608)
at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:543)
at java.lang.Thread.run(Thread.java:744)

_______________________________________________
jetty-users mailing list
jetty-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/jetty-users



_______________________________________________
jetty-users mailing list
jetty-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/jetty-users



_______________________________________________
jetty-users mailing list
jetty-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/jetty-users



Back to the top