I solved my problem the obvious way: stuck everything in the same classloader as Jetty (no WEB-INF/lib or WEB-INF/classes). Not pretty, but it works.
> On Aug 28, 2015, at 10:21 AM, Don Ferguson <[email protected]> wrote: > > Hi Martin, > > I'm already doing that (I encountered your earlier post which got me this > far). This means that WebServerEndpointConfig must be in Jetty's classpath, > along with its dependencies. I'm ending up with the bulk of wicket in Jetty's > classpath (and duplicated in WEB-INF/lib) which leads to having two versions > of Application.class loaded by two different classloaders. The upshot is > that, when trying to upgrade the connection, WicketEndPoint.onOpen() tries to > get the Application object via: > WebApplication app = (WebApplication) WebApplication.get(appName); > which returns null, due to the classloader confusion (appName was registered > using the Application.class loaded in the webapp classloader). > The obvious solution would be to remove wicket from WEB-INF/lib, so that > there would only be the copy in jetty's classloader, but that lead to other > problems. Anyway, was just wondering how to structure the executable WAR to > avoid this nightmare. > -Don > > > On Fri, Aug 28, 2015 at 9:19 AM, Martin Grigorov <[email protected] > <mailto:[email protected]>> wrote: > Hi, > > You can use : > > ServerContainer serverContainer = > WebSocketServerContainerInitializer.configureContext(bb); > serverContainer.addEndpoint(new WicketServerEndpointConfig()); > > bb is: WebAppContext bb = new WebAppContext(); > > Martin Grigorov > Wicket Training and Consulting > https://twitter.com/mtgrigorov <https://twitter.com/mtgrigorov> > > On Fri, Aug 28, 2015 at 6:05 PM, Don Ferguson <[email protected] > <mailto:[email protected]>> > wrote: > > > I have an app built on Wicket 7.0,0 and Jetty 9.2.6 to which I am > > attempting to add WebSockets (wicket-native-websocket-javax). The app > > functions properly when running from the IDE, however I have not been able > > to get web sockets to work when running from an executable WAR file. The > > main issue appears to be classloader related. I’m struggling to figure out > > precisely what classes need to be alongside Jetty in the system > > classloader, and what needs to be part of the WAR. > > > > Before introducing WebSockets, all of the wicket jars were in the WebApp > > classloader (WEB-INF/lib). However now some classes (such as > > WicketServerEndpointConfig) need to be in Jetty’s classloader. But if I > > put all of wicket in the Jetty's classloader, I get other problems. > > Anyway, I would really appreciate some guidance if anyone has sorted this > > out. > > > > -Don > > > > > > --------------------------------------------------------------------- > > To unsubscribe, e-mail: [email protected] > > <mailto:[email protected]> > > For additional commands, e-mail: [email protected] > > <mailto:[email protected]> > > > > >
