You can't use the WEB-INF/web.xml to set that.
Its too late in the process to disable websocket in that file.

You can use a Jetty Context XML deployable and set it there.
https://github.com/eclipse/jetty.project/blob/jetty-9.1.0.v20131115/tests/test-webapps/test-jetty-webapp/src/main/config/demo-base/webapps/test.xml#L32-L36

Example:

<?xml version="1.0"  encoding="ISO-8859-1"?>
<!DOCTYPE Configure PUBLIC "-//Jetty//Configure//EN"
    "http://www.eclipse.org/jetty/configure_9_0.dtd";>
<Configure class="org.eclipse.jetty.webapp.WebAppContext">
  ...
  <Set name="contextPath">/test</Set>
  <Set name="war"><Property name="jetty.webapps"
default="."/>/test.war</Set>
  ...

  <!-- Disable WebSocket container -->
  <Call name="setAttribute">
    <Arg>org.eclipse.jetty.websocket.jsr356</Arg>
    <Arg type="Boolean">false</Arg>
  </Call>
</Configure>



--
Joakim Erdfelt <[email protected]>
webtide.com <http://www.webtide.com/> - intalio.com/jetty
Expert advice, services and support from from the Jetty & CometD experts
eclipse.org/jetty - cometd.org


On Tue, Jan 7, 2014 at 1:09 PM, Gaurav Kumar <[email protected]>wrote:

> My web.xml looks like this -
>
>     <context-param>
>         <param-name>org.eclipse.jetty.websocket.jsr356</param-name>
>         <param-value>Boolean.FALSE</param-value>
>     </context-param>
>
> But I am still getting very same error message. Interestingly when I run
> the servlet in embedded Jetty, everything works fine. I am happy to send
> you a small war file (off list) with code which reproduces this issue.
>
> Thanks,
> Gaurav
>
>
> On Mon, Jan 6, 2014 at 6:34 PM, Joakim Erdfelt <[email protected]> wrote:
>
>> 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 <[email protected]>
>> webtide.com <http://www.webtide.com/> - intalio.com/jetty
>> Expert advice, services and support from from the Jetty & CometD experts
>> eclipse.org/jetty - cometd.org
>>
>>
>> On Mon, Jan 6, 2014 at 6:54 PM, Gaurav Kumar <[email protected]>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
>>> [email protected]
>>> https://dev.eclipse.org/mailman/listinfo/jetty-users
>>>
>>>
>>
>> _______________________________________________
>> jetty-users mailing list
>> [email protected]
>> https://dev.eclipse.org/mailman/listinfo/jetty-users
>>
>>
>
> _______________________________________________
> jetty-users mailing list
> [email protected]
> https://dev.eclipse.org/mailman/listinfo/jetty-users
>
>
_______________________________________________
jetty-users mailing list
[email protected]
https://dev.eclipse.org/mailman/listinfo/jetty-users

Reply via email to