Hi,

First I would like to apologize for the inconvenience.
On 4/24/15 7:40 AM, Thusitha Thilina Dayaratne wrote:
> Furthermore I've tried following things out and both options works
> without issue.
>
> 1. Running tomcat distributed examples in my server 2. Running the
> war file that I built inside Tomcat
>
> I've mistaken here. My war file doesn't run on Tomcat either.
>
>
> When I used the following dependency to build the example webapp,
> instead of 302 I'm getting 404 error.
>
> <dependency> <groupId>javax.websocket</groupId>
> <artifactId>javax.websocket-api</artifactId>
> <version>1.0</version> <scope>provided</scope> </dependency>
>
> Am I having wrong dependency here? If so what are the dependencies
> that I should include when do the build?

>>You aren't getting very many responses, here.

>>The problem is that you are asking for solutions to problems that
>>nobody understands. You are asking us "why doesn't this work", but you
>>haven't told us what it is.

>>Imagine that I am writing a web application that needs to process
>>financial transactions (e.g. DEBIT, CREDIT), and it's not working for
>>some reason. If I asked you "why does my web application return 404",
>>but didn't provide any code, or any explanation of the architecture,
>>or any of that, you would have no idea what could possibly be wrong
>>with my code. It could be simple a configuration problem. It could be
>>a complete misunderstanding of how a web application works. It could
>>be a very rarely-seen bug that only occurs when users with an account
>>number that happens to be a prime number plus one try to do a DEBIT
>>operation.

>>So, take a step back.

>>The Tomcat distributed examples work. That's great: it means that
>>Tomcat itself is capable of running Websocket applications.

>>Your application does not work: it seemed to be returning a 302 error
>>which may suggest that the Websocket library hasn't properly initialized
.

>>Are you using Tomcat in an embedded way, or are you launching it from
>>the traditional bin/startup.sh, etc. way? Are you trying to side-load
>>the Websocket library, or are you expecting that Tomcat will
>>auto-detect and initialize it? Does your own code include anything
>>other than servlets that request an upgrade to a Websocket connection
>>and then do their thing?


>>Remember that none of us has even a passing understanding of what you
>>are trying to build, how you are building it, what the Maven
>>dependencies are (or even mean, in some cases), etc. You need to tell
>>us all of that to give us some context.

>>Then we might be able to help you.

I will rephrase my question
I'm using embedded tomcat version 8.0.20. We have created an application
server on top of that and we are packing tomcat provided example webapp
with that.
I get the source of the example webapp in Tomcat (I don't change any code
in that and use that as it is provided) and use Maven in order to build the
sample webapp. In that for websocket I'm using following dependency

<dependency>
  <groupId>javax.websocket</groupId>
  <artifactId>javax.websocket-api</artifactId>
  <version>1.0</version>
  <scope>provided</scope></dependency>

I've bundle following tomcat websocket dependencies as OSGi bundle and
using that in the server.
<dependency>
    <groupId>org.apache.tomcat.embed</groupId>
    <artifactId>tomcat-embed-jasper</artifactId>
    <version>8.0.20</version>
    <optional>true</optional>
</dependency>
<dependency>
    <groupId>org.apache.tomcat</groupId>
    <artifactId>tomcat-websocket-api</artifactId>
    <version>8.0.20</version>
    <optional>true</optional>
</dependency>
This OSGi bundle is available with the server.

After building the example webapp, when I try to run the wesocket examples
in that webapp on my server, I'm getting

Info: WebSocket connection closed, Code: 1006


In the browser console it prints (for echo programmatic option in the echo
sample)

WebSocket connection to 'ws://
> 10.100.7.26:9763/examples/websocket/echoProgrammatic' failed: Error
> during WebSocket handshake: Unexpected response code: 302


I tried to deploy the same example which is distributed with Tomcat
distribution on my server.
It run on my server without any issue.

Thanks
Best Regards

2015-04-24 19:25 GMT+05:30 Christopher Schultz <ch...@christopherschultz.net
>

> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA256
>
> Thusitha,
>
> On 4/24/15 7:40 AM, Thusitha Thilina Dayaratne wrote:
> > Furthermore I've tried following things out and both options works
> > without issue.
> >
> > 1. Running tomcat distributed examples in my server 2. Running the
> > war file that I built inside Tomcat
> >
> > I've mistaken here. My war file doesn't run on Tomcat either.
> >
> >
> > When I used the following dependency to build the example webapp,
> > instead of 302 I'm getting 404 error.
> >
> > <dependency> <groupId>javax.websocket</groupId>
> > <artifactId>javax.websocket-api</artifactId>
> > <version>1.0</version> <scope>provided</scope> </dependency>
> >
> > Am I having wrong dependency here? If so what are the dependencies
> > that I should include when do the build?
>
> You aren't getting very many responses, here.
>
> The problem is that you are asking for solutions to problems that
> nobody understands. You are asking us "why doesn't this work", but you
> haven't told us what it is.
>
> Imagine that I am writing a web application that needs to process
> financial transactions (e.g. DEBIT, CREDIT), and it's not working for
> some reason. If I asked you "why does my web application return 404",
> but didn't provide any code, or any explanation of the architecture,
> or any of that, you would have no idea what could possibly be wrong
> with my code. It could be simple a configuration problem. It could be
> a complete misunderstanding of how a web application works. It could
> be a very rarely-seen bug that only occurs when users with an account
> number that happens to be a prime number plus one try to do a DEBIT
> operation.
>
> So, take a step back.
>
> The Tomcat distributed examples work. That's great: it means that
> Tomcat itself is capable of running Websocket applications.
>
> Your application does not work: it seemed to be returning a 302 error
> which may suggest that the Websocket library hasn't properly initialized
> .
>
> Are you using Tomcat in an embedded way, or are you launching it from
> the traditional bin/startup.sh, etc. way? Are you trying to side-load
> the Websocket library, or are you expecting that Tomcat will
> auto-detect and initialize it? Does your own code include anything
> other than servlets that request an upgrade to a Websocket connection
> and then do their thing?
>
> Without this information, nobody will be able to help you.
>
> It's frustrating to have to beg for information in order to help
> people. You have posted a lot of questions recently on this list where
> the responses are all of the form "I can't help because you haven't
> provided enough information". Your responses tend to ask new questions
> and not really provide that vital information to help you.
>
> None of us are paid for the time we spend answering questions on this
> mailing list -- at least, nobody that I know of. At some point, people
> stop bothering to ask, because they just expect that you are going to
> ignore the requests for more information and they will still be unable
> to help.
>
> So, again: take a step back.
>
> Remember that none of us has even a passing understanding of what you
> are trying to build, how you are building it, what the Maven
> dependencies are (or even mean, in some cases), etc. You need to tell
> us all of that to give us some context.
>
> Then we might be able to help you.
>
> - -chris
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v2
> Comment: GPGTools - http://gpgtools.org
>
> iQIcBAEBCAAGBQJVOktUAAoJEBzwKT+lPKRYwS0P/RswUwhyBqD+B8R4TPQz+Mua
> vsMi6vuCmX+9NrVM2iUrArLxbhsg3fCkHOqGRPmYHGomhXrNdBV5O69Uw6wFItB6
> l+ZneFKvK5W4b30BKwLtvaSycqy8LonSFo0dxE9fAVIsACpF7BqxEO6RJHyZKbiA
> aVHZY32xadX5DfN1I7h+eNwsET68dg1208tzleB3n1lepcdRWgZA73eeI/91quIr
> f2qd0Ui/a9q+CoXopo3kuGLmGU1t2rwkPV6IU+ViDe9A4s32749mrKTYbMDmevWD
> ItyUpKE0o69sGKq7FR8tt0q8oR3UD0XldbO+hLc73iNPKUFdVLx0vreDdn+kgvyd
> thbQKuJlFa13Y/3BTWlHUFl2xekxwP8Qsy3E1Q/WH8wer45Oizzu3/kpGW6o29FO
> HYxI+ZwrKi6yUp7kB1Xde1In6/vd/3/ja7GKKQxetleyC8JGS0p391VvggUKdybO
> T/g5xt/b5rZm+nVfjSB4Cv7PSXLe9/LKOmD6Lq9on2SredXIpR8j1WzCN3vufC3H
> uyayIEonW2fB0Fkwim/9Ku410vUrHGLFK4g9QkR/wN6Z04/Qr+RhnFlKEfPmuwYH
> COAE8ap1D4q/lVdTFNvbk3HpozLfw+4Sfrz6R11fha6XwxFGxyNIbWsUuUt/Zy3a
> jYzRJ3hwlnMkjZWe5Wdc
> =brQN
> -----END PGP SIGNATURE-----
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
> For additional commands, e-mail: users-h...@tomcat.apache.org
>
>


--

Reply via email to