I still have a problem about websocket connection ..

The line NPE occur, is 201.. AbstractHttpConnection may be null..


198 
<http://download.eclipse.org/jetty/8.1.0.RC0/xref/org/eclipse/jetty/websocket/WebSocketFactory.html#198>
        AbstractHttpConnection
<http://download.eclipse.org/jetty/8.1.0.RC0/xref/org/eclipse/jetty/server/AbstractHttpConnection.html>
http = AbstractHttpConnection.getCurrentConnection();199
<http://download.eclipse.org/jetty/8.1.0.RC0/xref/org/eclipse/jetty/websocket/WebSocketFactory.html#199>
        *if* (http instanceof BlockingHttpConnection)200
<http://download.eclipse.org/jetty/8.1.0.RC0/xref/org/eclipse/jetty/websocket/WebSocketFactory.html#200>
            *throw* *new* IllegalStateException("Websockets not
supported on blocking connectors");201
<http://download.eclipse.org/jetty/8.1.0.RC0/xref/org/eclipse/jetty/websocket/WebSocketFactory.html#201>
        ConnectedEndPoint
<http://download.eclipse.org/jetty/8.1.0.RC0/xref/org/eclipse/jetty/io/ConnectedEndPoint.html>
endp = (ConnectedEndPoint)http.getEndPoint();


I used a listener class implementing ServletContextListener interface..

In the listener class, I create a jetty server with 8081 port.

and registered my class into web.xml as you see on attachment...


Is any problem in the way I use jetty api..?







On Mon, Dec 26, 2011 at 2:36 PM, Seonhong Ahn <[email protected]>wrote:

>
> Thank you, Joakim ^^
>
> I have changed jetty version 8.1.0.RC2.. but the result was the same..
>
> The browser that I used was "Chrome 16.0.912.63 m"
>
>
> I attached the project file (eclipse maven project)
>
> In pom.xml, I wrote jetty version.
>
>
>
>
>
>
> On Sat, Dec 24, 2011 at 12:41 AM, Joakim Erdfelt <[email protected]>wrote:
>
>> That line of code will only trigger if the "Sec-WebSocket-Extensions"
>> header is present.
>> The Sec-WebSocket-Extensions header is optional, so lack of it isn't
>> going to trigger that bug.
>>
>>  This has been filed as a bug at
>> https://bugs.eclipse.org/bugs/show_bug.cgi?id=367500
>>
>> Can you provide some details of the client/browser you are using?
>>
>> Also, have you tried the more recent jetty-websocket impls?
>> Try jetty "8.1.0.RC2" please.
>>
>> --
>> Joakim Erdfelt
>> [email protected]
>>
>> http://webtide.com | http://intalio.com
>> (the people behind jetty and cometd)
>>
>>
>>
>> On Fri, Dec 23, 2011 at 12:49 AM, Seonhong Ahn <[email protected]>wrote:
>>
>>>
>>> I found an available reason..
>>>
>>>
>>> 1. The handshake from client of Proposed Standard version of WebSocket.
>>>
>>>         GET /chat HTTP/1.1
>>>         Host: server.example.com
>>>         Upgrade: websocket
>>>         Connection: Upgrade
>>>         Sec-WebSocket-Key: dGhlIHNhbXBsZSBub25jZQ==
>>>         Origin: http://example.com
>>>         Sec-WebSocket-Protocol: chat, superchat
>>>         Sec-WebSocket-Version: 13
>>>
>>>
>>> I guess, chrome will send a message to server with this format.
>>>
>>> Error occurred at 201 line in upgrade method in WebSocketFactory class
>>> in jetty 8.0.4
>>>
>>> 200 
>>> <http://download.eclipse.org/jetty/stable-8/xref/org/eclipse/jetty/websocket/WebSocketFactory.html#200>
>>>          *for* (Enumeration 
>>> e=request.getHeaders("Sec-WebSocket-Extensions");e.hasMoreElements();)201 
>>> <http://download.eclipse.org/jetty/stable-8/xref/org/eclipse/jetty/websocket/WebSocketFactory.html#201>
>>>          {202 
>>> <http://download.eclipse.org/jetty/stable-8/xref/org/eclipse/jetty/websocket/WebSocketFactory.html#202>
>>>              QuotedStringTokenizer 
>>> <http://download.eclipse.org/jetty/stable-8/xref/org/eclipse/jetty/util/QuotedStringTokenizer.html>
>>>  tok = *new* QuotedStringTokenizer 
>>> <http://download.eclipse.org/jetty/stable-8/xref/org/eclipse/jetty/util/QuotedStringTokenizer.html>((String)e.nextElement(),",");203
>>>  
>>> <http://download.eclipse.org/jetty/stable-8/xref/org/eclipse/jetty/websocket/WebSocketFactory.html#203>
>>>              *while* (tok.hasMoreTokens())204 
>>> <http://download.eclipse.org/jetty/stable-8/xref/org/eclipse/jetty/websocket/WebSocketFactory.html#204>
>>>                  extensions_requested.add(tok.nextToken());205 
>>> <http://download.eclipse.org/jetty/stable-8/xref/org/eclipse/jetty/websocket/WebSocketFactory.html#205>
>>>          }206 
>>> <http://download.eclipse.org/jetty/stable-8/xref/org/eclipse/jetty/websocket/WebSocketFactory.html#206>
>>>
>>>
>>>
>>> Handshake from client has no "Sec-WebSocket-Extensions" header..
>>>
>>>
>>> This is the reason of NullPointerException I think....
>>>
>>>
>>> Is that right...?
>>>
>>>
>>> On Fri, Dec 23, 2011 at 4:24 PM, Seonhong Ahn <[email protected]>wrote:
>>>
>>>>
>>>> Hi all ^^
>>>>
>>>> I develop a websocket application with jetty 8.0.4..
>>>>
>>>> I have a problem like this..
>>>>
>>>>
>>>> -----------------------------------------------------------------------------------------------------------------------------------------------------------------------
>>>>
>>>> [INFO] Scanning for projects...
>>>> [WARNING] The POM for org.mortbay.jetty:maven-jetty-plugin:jar:8.0.4 is
>>>> missing, no dependency information available
>>>> [WARNING] Failed to retrieve plugin descriptor for
>>>> org.mortbay.jetty:maven-jetty-plugin:8.0.4: Plugin
>>>> org.mortbay.jetty:maven-jetty-plugin:8.0.4 or one of its dependencies could
>>>> not be resolved: Failed to read artifact descriptor for
>>>> org.mortbay.jetty:maven-jetty-plugin:jar:8.0.4
>>>> [INFO]
>>>>
>>>> [INFO]
>>>> ------------------------------------------------------------------------
>>>> [INFO] Building jetty8 Maven Webapp 0.0.1-SNAPSHOT
>>>> [INFO]
>>>> ------------------------------------------------------------------------
>>>> [WARNING] The POM for org.mortbay.jetty:maven-jetty-plugin:jar:8.0.4 is
>>>> missing, no dependency information available
>>>> [WARNING] Failed to retrieve plugin descriptor for
>>>> org.mortbay.jetty:maven-jetty-plugin:8.0.4: Plugin
>>>> org.mortbay.jetty:maven-jetty-plugin:8.0.4 or one of its dependencies could
>>>> not be resolved: Failed to read artifact descriptor for
>>>> org.mortbay.jetty:maven-jetty-plugin:jar:8.0.4
>>>> [INFO]
>>>> [INFO] >>> jetty-maven-plugin:8.1.0.RC1:run (default-cli) @ jetty8 >>>
>>>> [INFO]
>>>> [INFO] --- maven-resources-plugin:2.4.3:resources (default-resources) @
>>>> jetty8 ---
>>>> [WARNING] Using platform encoding (UTF-8 actually) to copy filtered
>>>> resources, i.e. build is platform dependent!
>>>> [INFO] Copying 0 resource
>>>> [INFO]
>>>> [INFO] --- maven-compiler-plugin:2.3.2:compile (default-compile) @
>>>> jetty8 ---
>>>> [INFO] Nothing to compile - all classes are up to date
>>>> [INFO]
>>>> [INFO] --- maven-resources-plugin:2.4.3:testResources
>>>> (default-testResources) @ jetty8 ---
>>>> [WARNING] Using platform encoding (UTF-8 actually) to copy filtered
>>>> resources, i.e. build is platform dependent!
>>>> [INFO] Copying 0 resource
>>>> [INFO]
>>>> [INFO] --- maven-compiler-plugin:2.3.2:testCompile
>>>> (default-testCompile) @ jetty8 ---
>>>> [INFO] Nothing to compile - all classes are up to date
>>>> [INFO]
>>>> [INFO] <<< jetty-maven-plugin:8.1.0.RC1:run (default-cli) @ jetty8 <<<
>>>> [INFO]
>>>> [INFO] --- jetty-maven-plugin:8.1.0.RC1:run (default-cli) @ jetty8 ---
>>>> [INFO] Configuring Jetty for project: jetty8 Maven Webapp
>>>> [INFO] webAppSourceDirectory
>>>> E:\eGovFrameDev-2.0.0-FullVer\workspace\jetty8\src\main\webapp does not
>>>> exist. Defaulting to
>>>> E:\eGovFrameDev-2.0.0-FullVer\workspace\jetty8\src\main\webapp
>>>> [INFO] Reload Mechanic: automatic
>>>> [INFO] Classes =
>>>> E:\eGovFrameDev-2.0.0-FullVer\workspace\jetty8\target\classes
>>>> 2011-12-23 15:39:42.578:INFO:oejs.Server:jetty-8.1.0.RC1
>>>> [INFO] Context path = /
>>>> [INFO] Tmp directory =
>>>> E:\eGovFrameDev-2.0.0-FullVer\workspace\jetty8\target\tmp
>>>> [INFO] Web defaults = org/eclipse/jetty/webapp/webdefault.xml
>>>> [INFO] Web overrides =  none
>>>> [INFO] web.xml file =
>>>> file:/E:/eGovFrameDev-2.0.0-FullVer/workspace/jetty8/src/main/webapp/WEB-INF/web.xml
>>>> [INFO] Webapp directory =
>>>> E:\eGovFrameDev-2.0.0-FullVer\workspace\jetty8\src\main\webapp
>>>> 2011-12-23 15:39:43.244:INFO:oejpw.PlusConfiguration:No Transaction
>>>> manager found - if your webapp requires one, please configure one.
>>>> 2011-12-23 15:39:45.531:INFO:oejsh.ContextHandler:started
>>>> o.m.j.p.JettyWebAppContext{/,file:/E:/eGovFrameDev-2.0.0-FullVer/workspace/jetty8/src/main/webapp/},file:/E:/eGovFrameDev-2.0.0-FullVer/workspace/jetty8/src/main/webapp/PocWebSocketServletContextListener
>>>> has received a servlet context event.
>>>>
>>>> 2011-12-23 15:39:45.531:INFO:oejsh.ContextHandler:started
>>>> o.m.j.p.JettyWebAppContext{/,file:/E:/eGovFrameDev-2.0.0-FullVer/workspace/jetty8/src/main/webapp/},file:/E:/eGovFrameDev-2.0.0-FullVer/workspace/jetty8/src/main/webapp/
>>>> 2011-12-23 15:39:45.531:INFO:oejsh.ContextHandler:started
>>>> o.m.j.p.JettyWebAppContext{/,file:/E:/eGovFrameDev-2.0.0-FullVer/workspace/jetty8/src/main/webapp/},file:/E:/eGovFrameDev-2.0.0-FullVer/workspace/jetty8/src/main/webapp/
>>>> PocWebSocketHandler is created.
>>>> 2011-12-23 15:39:45.558:INFO:oejs.Server:jetty-8.1.0.RC1
>>>> 2011-12-23 15:39:45.591:INFO:oejs.AbstractConnector:Started
>>>> [email protected]:8081 STARTING
>>>> 2011-12-23 15:39:45.616:INFO:oejsh.ContextHandler:started
>>>> o.m.j.p.JettyWebAppContext{/,file:/E:/eGovFrameDev-2.0.0-FullVer/workspace/jetty8/src/main/webapp/},file:/E:/eGovFrameDev-2.0.0-FullVer/workspace/jetty8/src/main/webapp/
>>>> 2011-12-23 15:39:45.653:INFO:oejs.AbstractConnector:Started
>>>> [email protected]:8080 STARTING
>>>> [INFO] Started Jetty Server
>>>> PocWebSocket is created.
>>>> 2011-12-23 15:40:49.537:WARN:oejs.HttpConnection:/
>>>> java.lang.NullPointerException
>>>> at
>>>> org.eclipse.jetty.websocket.WebSocketFactory.upgrade(WebSocketFactory.java:201)
>>>>  at
>>>> org.eclipse.jetty.websocket.WebSocketFactory.acceptWebSocket(WebSocketFactory.java:326)
>>>> at
>>>> org.eclipse.jetty.websocket.WebSocketHandler.handle(WebSocketHandler.java:38)
>>>>  at
>>>> org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:110)
>>>> at org.eclipse.jetty.server.Server.handle(Server.java:346)
>>>>  at
>>>> org.eclipse.jetty.server.HttpConnection.handleRequest(HttpConnection.java:442)
>>>> at
>>>> org.eclipse.jetty.server.HttpConnection$RequestHandler.headerComplete(HttpConnection.java:924)
>>>>  at org.eclipse.jetty.http.HttpParser.parseNext(HttpParser.java:582)
>>>> at org.eclipse.jetty.http.HttpParser.parseAvailable(HttpParser.java:218)
>>>>  at
>>>> org.eclipse.jetty.server.AsyncHttpConnection.handle(AsyncHttpConnection.java:51)
>>>> at
>>>> org.eclipse.jetty.io.nio.SelectChannelEndPoint.handle(SelectChannelEndPoint.java:586)
>>>>  at
>>>> org.eclipse.jetty.io.nio.SelectChannelEndPoint$1.run(SelectChannelEndPoint.java:44)
>>>> at
>>>> org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:598)
>>>>  at
>>>> org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:533)
>>>> at java.lang.Thread.run(Thread.java:662)
>>>>
>>>>
>>>>
>>>>
>>>> -------------------------------------------------------------------------------------------------------------------------------------------
>>>>
>>>> I made a WebSocketServletContextListener implementing
>>>> ServletContextListener.
>>>>
>>>> And in this class, I started a jetty server which had a
>>>> WebSocketHandler set DefaultHandler.
>>>>
>>>> I register this class as a listener in web.xml.
>>>>
>>>> Client ia a chrome 16.0.912.63 m.
>>>>
>>>>
>>>> On client,
>>>>
>>>> var location = "ws://localhost:8081";
>>>> this._ws = new WebSocket(location);
>>>>
>>>>
>>>>
>>>> Is this problem why client and server's websocket version is different ?
>>>>
>>>> I don't know what jetty's websocket version is.
>>>>
>>>> As I know chrome v.16 supports Hybi17..
>>>>
>>>> I don't know what I would do....-.-;;
>>>>
>>>>
>>>> I wish you have an answer or hint..
>>>>
>>>>
>>>> Thank you all for reading..
>>>>
>>>> and thank you so much for your answer in advance..
>>>>
>>>>
>>>> Happy Christmas ~ ^_____^
>>>>
>>>>
>>>>
>>>>
>>>> --
>>>>
>>>>
>>>> ----------------------------------------------------------------------------------
>>>> *Seonhong Ahn *
>>>> Director of Research and Development
>>>>
>>>>  *Collabra Co.*
>>>> 960-6 Deachi-dong, Gangnam-gu, Seoul, Korea 135-280
>>>> Tel. 82-70-8670-6929         Fax. 82-2-6280-4807
>>>> *Mobile 82-10-8292-3923*
>>>> E-mail [email protected] / [email protected]
>>>> www.collabra.co.kr
>>>>
>>>> ----------------------------------------------------------------------------------
>>>>
>>>>
>>>>
>>>
>>>
>>> --
>>>
>>>
>>> ----------------------------------------------------------------------------------
>>> *Seonhong Ahn*
>>> Director of Research and Development
>>>
>>> *Collabra Co.*
>>> 960-6 Deachi-dong, Gangnam-gu, Seoul, Korea 135-280
>>> Tel. 82-70-8670-6929         Fax. 82-2-6280-4807
>>> *Mobile 82-10-8292-3923*
>>> E-mail [email protected] / [email protected]
>>> www.collabra.co.kr
>>> ----------------------------------------------------------------------------------
>>>
>>>
>>> _______________________________________________
>>> 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
>>
>>
>
>
> --
>
>
> ----------------------------------------------------------------------------------
> *Seonhong Ahn*
> Director of Research and Development
>
> *Collabra Co.*
> 960-6 Deachi-dong, Gangnam-gu, Seoul, Korea 135-280
> Tel. 82-70-8670-6929         Fax. 82-2-6280-4807
> *Mobile 82-10-8292-3923*
> E-mail [email protected] / [email protected]
> www.collabra.co.kr
>
> ----------------------------------------------------------------------------------
>
>


-- 

----------------------------------------------------------------------------------
*Seonhong Ahn*
Director of Research and Development

*Collabra Co.*
960-6 Deachi-dong, Gangnam-gu, Seoul, Korea 135-280
Tel. 82-70-8670-6929         Fax. 82-2-6280-4807
*Mobile 82-10-8292-3923*
E-mail [email protected] / [email protected]
www.collabra.co.kr
----------------------------------------------------------------------------------
_______________________________________________
jetty-users mailing list
[email protected]
https://dev.eclipse.org/mailman/listinfo/jetty-users

Reply via email to