Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [jetty-users] javax.servlet.ServletException: Not running on Jetty, JSR support disabled

Something replaced the ServletContext running in your Jetty with a non-Jetty version.

The ServletContext needs to be an instance of Jetty's ContextHandler in order for websockets to work.
Not sure how you managed to do that, as your stacktrace obviously shows a ContextHandler in the mix.

Here's the check ...
https://github.com/eclipse/jetty.project/blob/jetty-9.1.0.v20131115/jetty-websocket/javax-websocket-server-impl/src/main/java/org/eclipse/jetty/websocket/jsr356/server/deploy/WebSocketServerContainerInitializer.java#L86-L91

Now, as for disabling websockets, you can do that by adding an attribute with the name "org.eclipse.jetty.websocket.jsr356" and a value of Boolean.FALSE to the WebAppContext that you want it disabled on.


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


On Mon, Jan 6, 2014 at 6:54 PM, Gaurav Kumar <gauravphoenix@xxxxxxxxx> wrote:
I am trying to run a simple servlet sevlet packaged in a war file using jetty-runner-9.1.0.v20131115.jar but getting following message on start-up:

2014-01-06 17:37:36.734:INFO:oejr.Runner:main: Runner
2014-01-06 17:37:36.838:INFO:oejs.Server:main: jetty-9.1.0.v20131115
2014-01-06 17:37:40.726:INFO:/:main: Log4jServletContainerInitializer starting up Log4j in Servlet 3.0+ environment.
2014-01-06 17:37:40.774:WARN:oeja.ServletContainerInitializersStarter:main: 
javax.servlet.ServletException: Not running on Jetty, JSR support disabled
at org.eclipse.jetty.websocket.jsr356.server.deploy.WebSocketServerContainerInitializer.onStartup(WebSocketServerContainerInitializer.java:90)
at org.eclipse.jetty.plus.annotation.ContainerInitializer.callStartup(ContainerInitializer.java:110)
at org.eclipse.jetty.annotations.ServletContainerInitializersStarter.doStart(ServletContainerInitializersStarter.java:74)
at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:69)
at org.eclipse.jetty.util.component.ContainerLifeCycle.start(ContainerLifeCycle.java:117)
at org.eclipse.jetty.util.component.ContainerLifeCycle.doStart(ContainerLifeCycle.java:91)
at org.eclipse.jetty.server.handler.AbstractHandler.doStart(AbstractHandler.java:60)
at org.eclipse.jetty.server.handler.ScopedHandler.doStart(ScopedHandler.java:120)
at org.eclipse.jetty.server.handler.ContextHandler.startContext(ContextHandler.java:784)
at org.eclipse.jetty.servlet.ServletContextHandler.startContext(ServletContextHandler.java:284)
at org.eclipse.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1346)
at org.eclipse.jetty.server.handler.ContextHandler.doStart(ContextHandler.java:743)
at org.eclipse.jetty.webapp.WebAppContext.doStart(WebAppContext.java:491)
at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:69)
at org.eclipse.jetty.util.component.ContainerLifeCycle.start(ContainerLifeCycle.java:117)
at org.eclipse.jetty.util.component.ContainerLifeCycle.doStart(ContainerLifeCycle.java:99)
at org.eclipse.jetty.server.handler.AbstractHandler.doStart(AbstractHandler.java:60)
at org.eclipse.jetty.server.handler.ContextHandlerCollection.doStart(ContextHandlerCollection.java:154)
at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:69)
at org.eclipse.jetty.util.component.ContainerLifeCycle.start(ContainerLifeCycle.java:117)
at org.eclipse.jetty.util.component.ContainerLifeCycle.doStart(ContainerLifeCycle.java:99)
at org.eclipse.jetty.server.handler.AbstractHandler.doStart(AbstractHandler.java:60)
at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:69)
at org.eclipse.jetty.util.component.ContainerLifeCycle.start(ContainerLifeCycle.java:117)
at org.eclipse.jetty.server.Server.start(Server.java:355)
at org.eclipse.jetty.util.component.ContainerLifeCycle.doStart(ContainerLifeCycle.java:99)
at org.eclipse.jetty.server.handler.AbstractHandler.doStart(AbstractHandler.java:60)
at org.eclipse.jetty.server.Server.doStart(Server.java:324)
at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:69)
at org.eclipse.jetty.runner.Runner.run(Runner.java:519)
at org.eclipse.jetty.runner.Runner.main(Runner.java:567)

I don't intend to use websockets for now, how do I make the servlet run with disabled WebSockets? What is the right way to enable/disable websockets using web.xml? 







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



Back to the top