You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Addy D <pa...@gmail.com> on 2017/03/29 09:17:15 UTC

Websocket & Logging

Hello all,

I am facing an issue in my application, I want to know following things.

1. The tomcat is returning 404 for upgrade header (request to upgrade to
websocket protocol). Do I need to configure anything here?

2. How to enable logging for particular package of tomcat ? (I tried
changing logging.properties, added new logger over there but didn't work).

3. How can I see, registered websocket endpoints, which are registered by
my application?


P.S I have configured my tomcat to support https, below is the line which
is used to configure https.

"    <Connector SSLEnabled="true" clientAuth="false"
keystoreFile="D:\Servers\tomcat-8.5.9\keystore.jks" keystorePass="password"
maxThreads="150" port="8443"
protocol="org.apache.coyote.http11.Http11NioProtocol" scheme="https"
secure="true" sslProtocol="TLS"/>   "


I am stuck at these places, I need a direction, it would be nice if anyone
can help me.

Thanks & Regards
Addy

Re: Websocket & Logging

Posted by Addy D <pa...@gmail.com>.
Thank you all for helping out, it really solved my issue :)

On Thu, Mar 30, 2017 at 9:40 PM, Mark Thomas <ma...@apache.org> wrote:

> On 30/03/17 16:56, Addy D wrote:
> > On Thu, Mar 30, 2017 at 8:49 PM, Konstantin Kolinko <
> knst.kolinko@gmail.com>
> > wrote:
> >
> >> 2017-03-30 12:15 GMT+03:00 Addy D <pa...@gmail.com>:
> >>> I can see following in log, while starting tomcat:
> >>>
> >>> Mar 30, 2017 2:33:22 PM
> >>> org.springframework.web.socket.server.support.WebSocketHandlerMapping
> >>> registerHandler
> >>> INFO: Mapped URL path [/call] onto handler of type [class
> >>> org.springframework.web.socket.server.support.
> >> WebSocketHttpRequestHandler]
> >>>
> >>> Same kind of logs are also available when I run my Spring boot
> >> application,
> >>> in this app I am able to connect to wss://localhost:8443/call.
>
> <snip/>
>
> > No my application is not "ROOT",
>
> The the URL you quote above won't work.
>
> > i have my application as "myapp" but I
> > have a similar (almost same, I am moving spring boot app to tomcat)
> > spring-boot application which works fine with embedded tomcat in it with
> > the same url, in fact in application startup time, I see "/call" getting
> > registered in the tomcat log. as shown below.
>
> You have two options.
>
> 1. Rename myapp.war to ROOT.war
>
> 2. Use wss://localhost:8443/myappp/call to access your service
>
> I'd also recommend a careful read of the Servlet specification,
> particularly section 3.5 along with this page from the Tomcat docs:
> http://tomcat.apache.org/tomcat-8.5-doc/config/context.html#Naming
>
> Mark
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>

Re: Websocket & Logging

Posted by Mark Thomas <ma...@apache.org>.
On 30/03/17 16:56, Addy D wrote:
> On Thu, Mar 30, 2017 at 8:49 PM, Konstantin Kolinko <kn...@gmail.com>
> wrote:
> 
>> 2017-03-30 12:15 GMT+03:00 Addy D <pa...@gmail.com>:
>>> I can see following in log, while starting tomcat:
>>>
>>> Mar 30, 2017 2:33:22 PM
>>> org.springframework.web.socket.server.support.WebSocketHandlerMapping
>>> registerHandler
>>> INFO: Mapped URL path [/call] onto handler of type [class
>>> org.springframework.web.socket.server.support.
>> WebSocketHttpRequestHandler]
>>>
>>> Same kind of logs are also available when I run my Spring boot
>> application,
>>> in this app I am able to connect to wss://localhost:8443/call.

<snip/>

> No my application is not "ROOT",

The the URL you quote above won't work.

> i have my application as "myapp" but I
> have a similar (almost same, I am moving spring boot app to tomcat)
> spring-boot application which works fine with embedded tomcat in it with
> the same url, in fact in application startup time, I see "/call" getting
> registered in the tomcat log. as shown below.

You have two options.

1. Rename myapp.war to ROOT.war

2. Use wss://localhost:8443/myappp/call to access your service

I'd also recommend a careful read of the Servlet specification,
particularly section 3.5 along with this page from the Tomcat docs:
http://tomcat.apache.org/tomcat-8.5-doc/config/context.html#Naming

Mark

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Websocket & Logging

Posted by Konstantin Kolinko <kn...@gmail.com>.
2017-03-30 18:56 GMT+03:00 Addy D <pa...@gmail.com>:
> On Thu, Mar 30, 2017 at 8:49 PM, Konstantin Kolinko <kn...@gmail.com>
> wrote:
>
>> 2017-03-30 12:15 GMT+03:00 Addy D <pa...@gmail.com>:
>> > I can see following in log, while starting tomcat:
>> >
>> > Mar 30, 2017 2:33:22 PM
>> > org.springframework.web.socket.server.support.WebSocketHandlerMapping
>> > registerHandler
>> > INFO: Mapped URL path [/call] onto handler of type [class
>> > org.springframework.web.socket.server.support.
>> WebSocketHttpRequestHandler]
>> >
>> > Same kind of logs are also available when I run my Spring boot
>> application,
>> > in this app I am able to connect to wss://localhost:8443/call.
>>
>> 1. Rules:
>> http://tomcat.apache.org/lists.html#tomcat-users
>> -> 6. Top-posting is bad.
>>
>> 2. What is the name of your web application? Is it "ROOT"?
>> FAQ:
>> https://wiki.apache.org/tomcat/HowTo#How_do_I_make_my_
>> web_application_be_the_Tomcat_default_application.3F
>>
>
> Sorry for top-posting.
> No my application is not "ROOT", i have my application as "myapp" but I
> have a similar (almost same, I am moving spring boot app to tomcat)
> spring-boot application which works fine with embedded tomcat in it with
> the same url, in fact in application startup time, I see "/call" getting
> registered in the tomcat log. as shown below.

You wrote earlier that you tried the following URL:

> The exact url I am trying to hit is : wss://localhost:8443/call

If you application is named "myapp" then you must use the following URL:

wss://localhost:8443/myapp/call

> Mar 30, 2017 2:33:22 PM
> org.springframework.web.socket.server.support.WebSocketHandlerMapping
> registerHandler
> INFO: Mapped URL path [/call] onto handler of type [class
> org.springframework.web.socket.server.support.WebSocketHttpRequestHandler]

That is not an absolute path.
That is a path relative to your web application (relative to "context
root" as the Servlet specification says).

http://docs.oracle.com/javaee/7/api/javax/servlet/ServletContext.html#getContextPath--

> D:\Servers\tomcat-8.5.9\

Current is 8.5.12, with 8.5.13 expected in a few days (tomorrow?).

Best regards,
Konstantin Kolinko

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Websocket & Logging

Posted by Addy D <pa...@gmail.com>.
On Thu, Mar 30, 2017 at 8:49 PM, Konstantin Kolinko <kn...@gmail.com>
wrote:

> 2017-03-30 12:15 GMT+03:00 Addy D <pa...@gmail.com>:
> > I can see following in log, while starting tomcat:
> >
> > Mar 30, 2017 2:33:22 PM
> > org.springframework.web.socket.server.support.WebSocketHandlerMapping
> > registerHandler
> > INFO: Mapped URL path [/call] onto handler of type [class
> > org.springframework.web.socket.server.support.
> WebSocketHttpRequestHandler]
> >
> > Same kind of logs are also available when I run my Spring boot
> application,
> > in this app I am able to connect to wss://localhost:8443/call.
>
> 1. Rules:
> http://tomcat.apache.org/lists.html#tomcat-users
> -> 6. Top-posting is bad.
>
> 2. What is the name of your web application? Is it "ROOT"?
> FAQ:
> https://wiki.apache.org/tomcat/HowTo#How_do_I_make_my_
> web_application_be_the_Tomcat_default_application.3F
>
> Best regards,
> Konstantin Kolinko
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>

Sorry for top-posting.
No my application is not "ROOT", i have my application as "myapp" but I
have a similar (almost same, I am moving spring boot app to tomcat)
spring-boot application which works fine with embedded tomcat in it with
the same url, in fact in application startup time, I see "/call" getting
registered in the tomcat log. as shown below.

Mar 30, 2017 2:33:22 PM
org.springframework.web.socket.server.support.WebSocketHandlerMapping
registerHandler
INFO: Mapped URL path [/call] onto handler of type [class
org.springframework.web.socket.server.support.WebSocketHttpRequestHandler]

Same logs are there when I run my spring boot application, further more I
also tried about enabling logging in tomcat, so I can investigate the issue
further but I am not able to start full logging in tomcat as well, (I tried
modifying logging.properties, but the log levels are already set to FINE, I
am not sure what to do with it).

Re: Websocket & Logging

Posted by Konstantin Kolinko <kn...@gmail.com>.
2017-03-30 12:15 GMT+03:00 Addy D <pa...@gmail.com>:
> I can see following in log, while starting tomcat:
>
> Mar 30, 2017 2:33:22 PM
> org.springframework.web.socket.server.support.WebSocketHandlerMapping
> registerHandler
> INFO: Mapped URL path [/call] onto handler of type [class
> org.springframework.web.socket.server.support.WebSocketHttpRequestHandler]
>
> Same kind of logs are also available when I run my Spring boot application,
> in this app I am able to connect to wss://localhost:8443/call.

1. Rules:
http://tomcat.apache.org/lists.html#tomcat-users
-> 6. Top-posting is bad.

2. What is the name of your web application? Is it "ROOT"?
FAQ:
https://wiki.apache.org/tomcat/HowTo#How_do_I_make_my_web_application_be_the_Tomcat_default_application.3F

Best regards,
Konstantin Kolinko

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Websocket & Logging

Posted by Addy D <pa...@gmail.com>.
I can see following in log, while starting tomcat:

Mar 30, 2017 2:33:22 PM
org.springframework.web.socket.server.support.WebSocketHandlerMapping
registerHandler
INFO: Mapped URL path [/call] onto handler of type [class
org.springframework.web.socket.server.support.WebSocketHttpRequestHandler]

Same kind of logs are also available when I run my Spring boot application,
in this app I am able to connect to wss://localhost:8443/call.



On Thu, Mar 30, 2017 at 11:16 AM, Addy D <pa...@gmail.com>
wrote:

> Well, I haven't change the code, the thing was working with Spring boot
> (embedded tomcat) I just moved the code/app to an actual tomcat server.
>
> By trying the link from websocket.org I just wanted to confirm that
> nothing is wrong with my Java Script code or browser. I now come to a
> conclusion that something either on tomcat  or application side is missing.
>
> On Thu, Mar 30, 2017 at 12:43 AM, Igal @ Lucee.org <ig...@lucee.org> wrote:
>
>> That means that the Endpoint at websocket.org is configured correctly.
>>
>> How doe that help troubleshooting your Endpoint?
>>
>> Igal Sapir
>> Lucee Core Developer
>> Lucee.org <http://lucee.org/>
>>
>> On 3/29/2017 12:10 PM, Addy D wrote:
>>
>>> No, I tried something different, I tried this url wss://
>>> echo.websocket.org,
>>> this one is working.
>>>
>>> On Wed, Mar 29, 2017 at 11:49 PM, Igal @ Lucee.org <ig...@lucee.org>
>>> wrote:
>>>
>>> Can you access it in a non-secure protocol?  i.e. ws:// instaed of
>>>> wss://?
>>>>
>>>> Testing that can help eliminate possible issues.
>>>>
>>>> Igal Sapir
>>>> Lucee Core Developer
>>>> Lucee.org <http://lucee.org/>
>>>>
>>>>
>>>> On 3/29/2017 11:17 AM, Addy D wrote:
>>>>
>>>> The exact url I am trying to hit is : wss://localhost:8443/call
>>>>>
>>>>>
>>>>> On Wed, Mar 29, 2017 at 10:58 PM, Igal @ Lucee.org <ig...@lucee.org>
>>>>> wrote:
>>>>>
>>>>> On 3/29/2017 2:17 AM, Addy D wrote:
>>>>>
>>>>>> Hello all,
>>>>>>
>>>>>>> I am facing an issue in my application, I want to know following
>>>>>>> things.
>>>>>>>
>>>>>>> 1. The tomcat is returning 404 for upgrade header (request to
>>>>>>> upgrade to
>>>>>>> websocket protocol). Do I need to configure anything here?
>>>>>>>
>>>>>>> What's the Endpoint that you've set up (and how did you set it up)?
>>>>>>>
>>>>>> What is the exact URL that you're trying to hit with the ws://
>>>>>> request?
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>> ---------------------------------------------------------------------
>>>>>> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>>>>>> For additional commands, e-mail: users-help@tomcat.apache.org
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>
>

Re: Websocket & Logging

Posted by Addy D <pa...@gmail.com>.
Well, I haven't change the code, the thing was working with Spring boot
(embedded tomcat) I just moved the code/app to an actual tomcat server.

By trying the link from websocket.org I just wanted to confirm that nothing
is wrong with my Java Script code or browser. I now come to a conclusion
that something either on tomcat  or application side is missing.

On Thu, Mar 30, 2017 at 12:43 AM, Igal @ Lucee.org <ig...@lucee.org> wrote:

> That means that the Endpoint at websocket.org is configured correctly.
>
> How doe that help troubleshooting your Endpoint?
>
> Igal Sapir
> Lucee Core Developer
> Lucee.org <http://lucee.org/>
>
> On 3/29/2017 12:10 PM, Addy D wrote:
>
>> No, I tried something different, I tried this url wss://
>> echo.websocket.org,
>> this one is working.
>>
>> On Wed, Mar 29, 2017 at 11:49 PM, Igal @ Lucee.org <ig...@lucee.org>
>> wrote:
>>
>> Can you access it in a non-secure protocol?  i.e. ws:// instaed of wss://?
>>>
>>> Testing that can help eliminate possible issues.
>>>
>>> Igal Sapir
>>> Lucee Core Developer
>>> Lucee.org <http://lucee.org/>
>>>
>>>
>>> On 3/29/2017 11:17 AM, Addy D wrote:
>>>
>>> The exact url I am trying to hit is : wss://localhost:8443/call
>>>>
>>>>
>>>> On Wed, Mar 29, 2017 at 10:58 PM, Igal @ Lucee.org <ig...@lucee.org>
>>>> wrote:
>>>>
>>>> On 3/29/2017 2:17 AM, Addy D wrote:
>>>>
>>>>> Hello all,
>>>>>
>>>>>> I am facing an issue in my application, I want to know following
>>>>>> things.
>>>>>>
>>>>>> 1. The tomcat is returning 404 for upgrade header (request to upgrade
>>>>>> to
>>>>>> websocket protocol). Do I need to configure anything here?
>>>>>>
>>>>>> What's the Endpoint that you've set up (and how did you set it up)?
>>>>>>
>>>>> What is the exact URL that you're trying to hit with the ws:// request?
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> ---------------------------------------------------------------------
>>>>> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>>>>> For additional commands, e-mail: users-help@tomcat.apache.org
>>>>>
>>>>>
>>>>>
>>>>>
>

Re: Websocket & Logging

Posted by "Igal @ Lucee.org" <ig...@lucee.org>.
That means that the Endpoint at websocket.org is configured correctly.

How doe that help troubleshooting your Endpoint?

Igal Sapir
Lucee Core Developer
Lucee.org <http://lucee.org/>

On 3/29/2017 12:10 PM, Addy D wrote:
> No, I tried something different, I tried this url wss://echo.websocket.org,
> this one is working.
>
> On Wed, Mar 29, 2017 at 11:49 PM, Igal @ Lucee.org <ig...@lucee.org> wrote:
>
>> Can you access it in a non-secure protocol?  i.e. ws:// instaed of wss://?
>>
>> Testing that can help eliminate possible issues.
>>
>> Igal Sapir
>> Lucee Core Developer
>> Lucee.org <http://lucee.org/>
>>
>>
>> On 3/29/2017 11:17 AM, Addy D wrote:
>>
>>> The exact url I am trying to hit is : wss://localhost:8443/call
>>>
>>>
>>> On Wed, Mar 29, 2017 at 10:58 PM, Igal @ Lucee.org <ig...@lucee.org>
>>> wrote:
>>>
>>> On 3/29/2017 2:17 AM, Addy D wrote:
>>>> Hello all,
>>>>> I am facing an issue in my application, I want to know following things.
>>>>>
>>>>> 1. The tomcat is returning 404 for upgrade header (request to upgrade to
>>>>> websocket protocol). Do I need to configure anything here?
>>>>>
>>>>> What's the Endpoint that you've set up (and how did you set it up)?
>>>> What is the exact URL that you're trying to hit with the ws:// request?
>>>>
>>>>
>>>>
>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>>>> For additional commands, e-mail: users-help@tomcat.apache.org
>>>>
>>>>
>>>>


Re: Websocket & Logging

Posted by Addy D <pa...@gmail.com>.
No, I tried something different, I tried this url wss://echo.websocket.org,
this one is working.

On Wed, Mar 29, 2017 at 11:49 PM, Igal @ Lucee.org <ig...@lucee.org> wrote:

> Can you access it in a non-secure protocol?  i.e. ws:// instaed of wss://?
>
> Testing that can help eliminate possible issues.
>
> Igal Sapir
> Lucee Core Developer
> Lucee.org <http://lucee.org/>
>
>
> On 3/29/2017 11:17 AM, Addy D wrote:
>
>> The exact url I am trying to hit is : wss://localhost:8443/call
>>
>>
>> On Wed, Mar 29, 2017 at 10:58 PM, Igal @ Lucee.org <ig...@lucee.org>
>> wrote:
>>
>> On 3/29/2017 2:17 AM, Addy D wrote:
>>>
>>> Hello all,
>>>>
>>>> I am facing an issue in my application, I want to know following things.
>>>>
>>>> 1. The tomcat is returning 404 for upgrade header (request to upgrade to
>>>> websocket protocol). Do I need to configure anything here?
>>>>
>>>> What's the Endpoint that you've set up (and how did you set it up)?
>>>
>>> What is the exact URL that you're trying to hit with the ws:// request?
>>>
>>>
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>>> For additional commands, e-mail: users-help@tomcat.apache.org
>>>
>>>
>>>
>

Re: Websocket & Logging

Posted by "Igal @ Lucee.org" <ig...@lucee.org>.
Can you access it in a non-secure protocol?  i.e. ws:// instaed of wss://?

Testing that can help eliminate possible issues.

Igal Sapir
Lucee Core Developer
Lucee.org <http://lucee.org/>

On 3/29/2017 11:17 AM, Addy D wrote:
> The exact url I am trying to hit is : wss://localhost:8443/call
>
>
> On Wed, Mar 29, 2017 at 10:58 PM, Igal @ Lucee.org <ig...@lucee.org> wrote:
>
>> On 3/29/2017 2:17 AM, Addy D wrote:
>>
>>> Hello all,
>>>
>>> I am facing an issue in my application, I want to know following things.
>>>
>>> 1. The tomcat is returning 404 for upgrade header (request to upgrade to
>>> websocket protocol). Do I need to configure anything here?
>>>
>> What's the Endpoint that you've set up (and how did you set it up)?
>>
>> What is the exact URL that you're trying to hit with the ws:// request?
>>
>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>> For additional commands, e-mail: users-help@tomcat.apache.org
>>
>>


Re: Websocket & Logging

Posted by Addy D <pa...@gmail.com>.
The exact url I am trying to hit is : wss://localhost:8443/call


On Wed, Mar 29, 2017 at 10:58 PM, Igal @ Lucee.org <ig...@lucee.org> wrote:

> On 3/29/2017 2:17 AM, Addy D wrote:
>
>> Hello all,
>>
>> I am facing an issue in my application, I want to know following things.
>>
>> 1. The tomcat is returning 404 for upgrade header (request to upgrade to
>> websocket protocol). Do I need to configure anything here?
>>
> What's the Endpoint that you've set up (and how did you set it up)?
>
> What is the exact URL that you're trying to hit with the ws:// request?
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>

Re: Websocket & Logging

Posted by "Igal @ Lucee.org" <ig...@lucee.org>.
On 3/29/2017 2:17 AM, Addy D wrote:
> Hello all,
>
> I am facing an issue in my application, I want to know following things.
>
> 1. The tomcat is returning 404 for upgrade header (request to upgrade to
> websocket protocol). Do I need to configure anything here?
What's the Endpoint that you've set up (and how did you set it up)?

What is the exact URL that you're trying to hit with the ws:// request?



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Websocket & Logging

Posted by Addy D <pa...@gmail.com>.
Details from firefox "Network" tab:


Request URL: https://localhost:8443/call
Request Method: GET
Status Code: 404



Request Headers:
    Host: localhost:8443
    User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:51.0)
Gecko/20100101 Firefox/51.0
    Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
    Accept-Language: en-US,en;q=0.5
    Accept-Encoding: gzip, deflate, br
    Sec-WebSocket-Version: 13
    Origin: https://localhost:8443
    Sec-WebSocket-Extensions: permessage-deflate
    Sec-WebSocket-Key: nmwooZUzvtitW09NoWgk6g==
    Connection: keep-alive, Upgrade
    Pragma: no-cache
    Cache-Control: no-cache
    Upgrade: websocket

Response Headers:
    Content-Language: en
    Content-Length: 994
    Content-Type: text/html;charset=utf-8
    Date: Wed, 29 Mar 2017 12:02:34 GMT

Console Output:
GET https://localhost:8443/call [HTTP/1.1 404  17ms]
Strict-Transport-Security: The connection to the site is untrustworthy, so
the specified header was ignored.[Learn More]  small_logo.png
Firefox can’t establish a connection to the server at
wss://localhost:8443/call.



On Wed, Mar 29, 2017 at 5:04 PM, Addy D <pa...@gmail.com>
wrote:

> Hey Mark,
>
> Thanks for replying,  details are:
>
> 1. I am finding following things in the "Network" tab in chrome.
>     a. General:
>
>     Request URL:wss://localhost:8443/call
>     Request Method:GET
>     Status Code:404
>
>
>     b. Response Header:
>
>     HTTP/1.1 404
>     Content-Type: text/html;charset=utf-8
>     Content-Language: en
>     Content-Length: 994
>     Date: Wed, 29 Mar 2017 10:54:46 GMT
>
>     c. Request Header:
>
>     GET wss://localhost:8443/call HTTP/1.1
>     Host: localhost:8443
>     Connection: Upgrade
>     Pragma: no-cache
>     Cache-Control: no-cache
>     Upgrade: websocket
>     Origin: https://localhost:8443
>     Sec-WebSocket-Version: 13
>     User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64)
> AppleWebKit/537.36 (KHTML, like Gecko) Chrome/56.0.2924.87   Safari/537.36
>     Accept-Encoding: gzip, deflate, sdch, br
>     Accept-Language: en-US,en;q=0.8
>     Sec-WebSocket-Key: 7QJCsfHPo++Q6d1L/MydLg==
>     Sec-WebSocket-Extensions: permessage-deflate; client_max_window_bits
>
> 2. Tomcat Logging:
>     In conf/logging.properties I added following things.
>
>     handlers = 1catalina.org.apache.juli.AsyncFileHandler,
> 2localhost.org.apache.juli.AsyncFileHandler, 3manager.org.apache.juli.AsyncFileHandler,
> 4host-manager.org.apache.juli.AsyncFileHandler,
> 5websocket.org.apache.juli.AsyncFileHandler, java.util.logging.
> ConsoleHandler
>
>
>     5websocket.org.apache.juli.AsyncFileHandler.level = TRACE
>     5websocket.org.apache.juli.AsyncFileHandler.directory =
> ${catalina.base}/logs
>     5websocket.org.apache.juli.AsyncFileHandler.prefix = WEBSOCKET.
>
>     org.apache.tomcat.websocket.server.level = FINE
>
> 3. About endpoints:
>
>     I have an application where I have integrated Spring + Spring MVC +
> Spring Security + Spring websocket.
>     Spring websocket class TextWebSocketHandler is extended and using it
> for communication between server and client.
>
>     client side using simple JavaScript based WebSocket instance which
> takes a single url as an argument.
>
>     The url is wss://localhost:8443/call. I have register this "/call" by
> overriding a method from WebSocketConfigurer.java as
>      shown below
>
>          @Override
>         public void registerWebSocketHandlers(WebSocketHandlerRegistry
> registry) {
>             registry.addHandler(callHandler(),
> "/call").setAllowedOrigins("*");
>         }
>
> Regards
> Addy
>
> On Wed, Mar 29, 2017 at 3:32 PM, Mark Thomas <ma...@apache.org> wrote:
>
>> On 29/03/17 10:17, Addy D wrote:
>> > Hello all,
>> >
>> > I am facing an issue in my application, I want to know following things.
>> >
>> > 1. The tomcat is returning 404 for upgrade header (request to upgrade to
>> > websocket protocol). Do I need to configure anything here?
>>
>> It certainly looks like it. What URL are you sending the upgrade request
>> to?
>>
>> > 2. How to enable logging for particular package of tomcat ? (I tried
>> > changing logging.properties, added new logger over there but didn't
>> work).
>>
>> What did you try adding?
>>
>> > 3. How can I see, registered websocket endpoints, which are registered
>> by
>> > my application?
>>
>> Not easily. We need to think about adding some debug logging and/or JMX
>> information for this.
>>
>> How have you deployed your WebSocket endpoints?
>>
>> Mark
>>
>>
>> >
>> > P.S I have configured my tomcat to support https, below is the line
>> which
>> > is used to configure https.
>> >
>> > "    <Connector SSLEnabled="true" clientAuth="false"
>> > keystoreFile="D:\Servers\tomcat-8.5.9\keystore.jks"
>> keystorePass="password"
>> > maxThreads="150" port="8443"
>> > protocol="org.apache.coyote.http11.Http11NioProtocol" scheme="https"
>> > secure="true" sslProtocol="TLS"/>   "
>> >
>> >
>> > I am stuck at these places, I need a direction, it would be nice if
>> anyone
>> > can help me.
>> >
>> > Thanks & Regards
>> > Addy
>> >
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>> For additional commands, e-mail: users-help@tomcat.apache.org
>>
>>
>

Re: Websocket & Logging

Posted by Addy D <pa...@gmail.com>.
Hey Mark,

Thanks for replying,  details are:

1. I am finding following things in the "Network" tab in chrome.
    a. General:

    Request URL:wss://localhost:8443/call
    Request Method:GET
    Status Code:404


    b. Response Header:

    HTTP/1.1 404
    Content-Type: text/html;charset=utf-8
    Content-Language: en
    Content-Length: 994
    Date: Wed, 29 Mar 2017 10:54:46 GMT

    c. Request Header:

    GET wss://localhost:8443/call HTTP/1.1
    Host: localhost:8443
    Connection: Upgrade
    Pragma: no-cache
    Cache-Control: no-cache
    Upgrade: websocket
    Origin: https://localhost:8443
    Sec-WebSocket-Version: 13
    User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64)
AppleWebKit/537.36 (KHTML, like Gecko) Chrome/56.0.2924.87   Safari/537.36
    Accept-Encoding: gzip, deflate, sdch, br
    Accept-Language: en-US,en;q=0.8
    Sec-WebSocket-Key: 7QJCsfHPo++Q6d1L/MydLg==
    Sec-WebSocket-Extensions: permessage-deflate; client_max_window_bits

2. Tomcat Logging:
    In conf/logging.properties I added following things.

    handlers = 1catalina.org.apache.juli.AsyncFileHandler,
2localhost.org.apache.juli.AsyncFileHandler,
3manager.org.apache.juli.AsyncFileHandler,
4host-manager.org.apache.juli.AsyncFileHandler,
5websocket.org.apache.juli.AsyncFileHandler,
java.util.logging.ConsoleHandler


    5websocket.org.apache.juli.AsyncFileHandler.level = TRACE
    5websocket.org.apache.juli.AsyncFileHandler.directory =
${catalina.base}/logs
    5websocket.org.apache.juli.AsyncFileHandler.prefix = WEBSOCKET.

    org.apache.tomcat.websocket.server.level = FINE

3. About endpoints:

    I have an application where I have integrated Spring + Spring MVC +
Spring Security + Spring websocket.
    Spring websocket class TextWebSocketHandler is extended and using it
for communication between server and client.

    client side using simple JavaScript based WebSocket instance which
takes a single url as an argument.

    The url is wss://localhost:8443/call. I have register this "/call" by
overriding a method from WebSocketConfigurer.java as
     shown below

         @Override
        public void registerWebSocketHandlers(WebSocketHandlerRegistry
registry) {
            registry.addHandler(callHandler(),
"/call").setAllowedOrigins("*");
        }

Regards
Addy

On Wed, Mar 29, 2017 at 3:32 PM, Mark Thomas <ma...@apache.org> wrote:

> On 29/03/17 10:17, Addy D wrote:
> > Hello all,
> >
> > I am facing an issue in my application, I want to know following things.
> >
> > 1. The tomcat is returning 404 for upgrade header (request to upgrade to
> > websocket protocol). Do I need to configure anything here?
>
> It certainly looks like it. What URL are you sending the upgrade request
> to?
>
> > 2. How to enable logging for particular package of tomcat ? (I tried
> > changing logging.properties, added new logger over there but didn't
> work).
>
> What did you try adding?
>
> > 3. How can I see, registered websocket endpoints, which are registered by
> > my application?
>
> Not easily. We need to think about adding some debug logging and/or JMX
> information for this.
>
> How have you deployed your WebSocket endpoints?
>
> Mark
>
>
> >
> > P.S I have configured my tomcat to support https, below is the line which
> > is used to configure https.
> >
> > "    <Connector SSLEnabled="true" clientAuth="false"
> > keystoreFile="D:\Servers\tomcat-8.5.9\keystore.jks"
> keystorePass="password"
> > maxThreads="150" port="8443"
> > protocol="org.apache.coyote.http11.Http11NioProtocol" scheme="https"
> > secure="true" sslProtocol="TLS"/>   "
> >
> >
> > I am stuck at these places, I need a direction, it would be nice if
> anyone
> > can help me.
> >
> > Thanks & Regards
> > Addy
> >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>

Re: Websocket & Logging

Posted by Mark Thomas <ma...@apache.org>.
On 29/03/17 10:17, Addy D wrote:
> Hello all,
> 
> I am facing an issue in my application, I want to know following things.
> 
> 1. The tomcat is returning 404 for upgrade header (request to upgrade to
> websocket protocol). Do I need to configure anything here?

It certainly looks like it. What URL are you sending the upgrade request to?

> 2. How to enable logging for particular package of tomcat ? (I tried
> changing logging.properties, added new logger over there but didn't work).

What did you try adding?

> 3. How can I see, registered websocket endpoints, which are registered by
> my application?

Not easily. We need to think about adding some debug logging and/or JMX
information for this.

How have you deployed your WebSocket endpoints?

Mark


> 
> P.S I have configured my tomcat to support https, below is the line which
> is used to configure https.
> 
> "    <Connector SSLEnabled="true" clientAuth="false"
> keystoreFile="D:\Servers\tomcat-8.5.9\keystore.jks" keystorePass="password"
> maxThreads="150" port="8443"
> protocol="org.apache.coyote.http11.Http11NioProtocol" scheme="https"
> secure="true" sslProtocol="TLS"/>   "
> 
> 
> I am stuck at these places, I need a direction, it would be nice if anyone
> can help me.
> 
> Thanks & Regards
> Addy
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org