Re: Fail secure state
Yes, which has security modules and settings which may fail to be loaded or might be unloaded from tomcat if the computer fails to start up or shut down correctly. In that case, how does tomcat handle that failure? On Thu, Jun 23, 2016 at 6:19 PM, André Warnier (tomcat) <a...@ice-sa.com> wrote: > On 23.06.2016 21:43, Jason Ricles wrote: >> >> Fail-secure is a condition achieved by the application server in order >> to ensure that in the event of an operational failure, the system does >> not enter into an unsecure state where intended security properties no >> longer hold > > > Just to make sure : you do know that tomcat is a computer program, right ? > > >> >> On Thu, Jun 23, 2016 at 3:33 PM, Mark Thomas <ma...@apache.org> wrote: >>> >>> On 23/06/2016 20:21, Jason Ricles wrote: >>>> >>>> Does tomcat have a secure state if system initialization fails, >>>> shutdown fails, or aborts fail? >>> >>> >>> Define "secure state", "system initialization", "fails", "shutdown" and >>> "aborts" and we might be able to help you. >>> >>> Mark >>> >>> >>> - >>> To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org >>> For additional commands, e-mail: users-h...@tomcat.apache.org >>> >> >> - >> To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org >> For additional commands, e-mail: users-h...@tomcat.apache.org >> > > > - > To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org > For additional commands, e-mail: users-h...@tomcat.apache.org > - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: Fail secure state
Fail-secure is a condition achieved by the application server in order to ensure that in the event of an operational failure, the system does not enter into an unsecure state where intended security properties no longer hold On Thu, Jun 23, 2016 at 3:33 PM, Mark Thomas <ma...@apache.org> wrote: > On 23/06/2016 20:21, Jason Ricles wrote: >> Does tomcat have a secure state if system initialization fails, >> shutdown fails, or aborts fail? > > Define "secure state", "system initialization", "fails", "shutdown" and > "aborts" and we might be able to help you. > > Mark > > > - > To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org > For additional commands, e-mail: users-h...@tomcat.apache.org > - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Fail secure state
Does tomcat have a secure state if system initialization fails, shutdown fails, or aborts fail? - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Getting confusing websocket error message on Tomcat 7
I am trying to send a file over a websocket in binary and keep getting this error "code [1009], reason [No async message support and buffer too small. Buffer size: [800,000], Message size: [131,170]]" I am confused since it is saying the buffer size is too small but the size is 800,000 and the message size is 131,170. What could be causing this issue? - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: Tomcat feature request
On Wed, Feb 10, 2016 at 7:47 AM, Konstantin Kolinko <knst.koli...@gmail.com> wrote: > 2016-02-10 5:40 GMT+03:00 Jason Ricles <jgr...@alum.lehigh.edu>: >> Is there any formal forum to make a feature request for tomcat? > > http://tomcat.apache.org/bugreport.html#How_to_submit_patches_and_enhancement_requests > > but usually better either to provide a patch or to discuss it (on the > mailing list) to prove that there is an interest in the feature. > >> I noticed I was having a silent failure with a binary websocket with tomcat >> since I didn't flip the bytebuffer from write to read and the send kept >> failing down at the low level of the code without any error being thrown. >> With that in mind, I was thinking it would be useful to explicitly throw >> that an error happened since I spent 1.5 days to debug that when I changed >> the code I just forgot to flip the bytebuffer and had no excpetion being >> thrown, it would thus be very helpful for debugging purposes. > > 1. I think that a buffer that has not been flipped is not > distinguishable from an empty buffer. > > Sending empty data is an empty operation, not an error. > > 2. Tomcat implements Java API for WebSocket 1.1 (JSR356). > > Error handling is defined by specification. > > Best regards, > Konstantin Kolinko That is very true Konstantin, Maybe then adding as part of the java doc for the write binary to say "remember to flip the buffer if was written to" or something of that nature. I am just trying to think of a good way other users can avoid this pit fall in the future but still follow the websocket spec as stated. - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Tomcat feature request
Is there any formal forum to make a feature request for tomcat? I noticed I was having a silent failure with a binary websocket with tomcat since I didn't flip the bytebuffer from write to read and the send kept failing down at the low level of the code without any error being thrown. With that in mind, I was thinking it would be useful to explicitly throw that an error happened since I spent 1.5 days to debug that when I changed the code I just forgot to flip the bytebuffer and had no excpetion being thrown, it would thus be very helpful for debugging purposes.
Having Java websocket server in tomcat handle ISO8859_1
I have an application that sends binary websocket messages between a class and the web application using a websocket server written in java. The data being sent from the java class is encoded in a binary buffer with the bytes in ISO8859_1. However, when I receive the bytes on the websocket server and the web application end they are junk (such as -121, -116, etc.) and not encoded the correct way that they need to be. I was reading that this might be caused by something being set in my websocket server and web application to use UTF-8 for the default and not ISO8859_1. Is there any way I can change my websocket server and my web application which uses JavaScript to use ISO8859_1 instead of UTF-8? - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: Having Java websocket server in tomcat handle ISO8859_1
The message is built and sent in a javaclass connected to a websocket server for the web application also written in java then the message is passed to the webpage which uses javascript On Mon, Feb 8, 2016 at 2:25 PM, André Warnier (tomcat) <a...@ice-sa.com> wrote: > On 08.02.2016 19:41, Jason Ricles wrote: >> >> I have an application that sends binary websocket messages between a >> class and the web application using a websocket server written in >> java. >> >> The data being sent from the java class is encoded in a binary buffer >> with the bytes in ISO8859_1. However, when I receive the bytes on the >> websocket server and the web application end they are junk (such as >> -121, -116, etc.) and not encoded the correct way that they need to >> be. >> >> I was reading that this might be caused by something being set in my >> websocket server and web application to use UTF-8 for the default and >> not ISO8859_1. >> >> Is there any way I can change my websocket server and my web >> application which uses JavaScript to use ISO8859_1 instead of UTF-8? > > > Now is it Java, or JavaScript ? (earlier you say "sent from the java > class"..) > >> > > For a proper "correct" solution, the client sending text data to the server > should tell the server what character set/encoding is used for that data > (via some kind of "header" for example). This way, the server could always > read that text data and decode it in the proper way. > > If you are /sure/ that this server socket, now and in the future, will only > ever receive text data from this particular version of your client > java/javascript code, and that text will always be encoded as iso-8859-1, > then you should at least make sure that the server code which is reading and > decoding this data, does it as iso-8859-1, which is not the default > character set for java. > But by doing so, you are only moving the problem further in the future, > because as far as it looks right now, the usage of Unicode/UTF-8 will > increase, and the usage of iso-8859-x character sets will decrease over > time. > > > > > - > To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org > For additional commands, e-mail: users-h...@tomcat.apache.org > - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: Send a message from java application to a specific websocket session via Tomcat websocket server
So that a user can see their own error, but these should only happen if there was an error on the backend. But I do not want to disconnect the users, however if 5 people are connected I dont want all to see user 1 had an error since user 2,3,4, and 5 would think what is this. On Mon, Aug 10, 2015 at 11:16 AM, Guillermina Gonjon gma...@comcast.net wrote: Do you mean a single user like an administrator can see the error or every user that causes an error can see their own error? It depends on the error level. You may kill all sessions when an internal error occurs allow the users to be re-directed to an static page not connected to the database or back-end. And if user== administrator; then, do not redirect. Allow user to see error. On 08/10/2015 10:01 AM, Jason Ricles wrote: Introduction: I have an application that uses a webpage as the GUI and the backend is written in Java so thuswebsockets using Apache Tomcat 7 are the way I am communicating between the GUI and the backend code that does all the grunt work. A websocket server is the go between, between the backend code and the GUI part of the application. Here is the flow of the communication. From GUI to backend: GUI--WebSocketServer--Backend From backend to GUI: Backend--WebSocketServer--Backend Problem: The problem I am wanting to solve, is if a user request an action to be done on the GUI and then an error is encountered I want only that specific user to get an error message not everyone connected to the site that is the GUI. The only feasible way I can think of doing this right now, is sending the session ID of the user requesting the action as part of the websocket message and then storing that using ID corresponding to the action requested in something like a HashMap. Then if there is an error while performing the requested action put some logic in the websocket server code to extract the session ID from the message being sent back to the GUI and send the error message to this specific session. Question: My question is, is there any simplier way to do this of sending a message to a specific user between ajava back end and a web page front end that communicate using web sockets, or is this the only way possible to achieve what I am trying to do? - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Send a message from java application to a specific websocket session via Tomcat websocket server
Introduction: I have an application that uses a webpage as the GUI and the backend is written in Java so thuswebsockets using Apache Tomcat 7 are the way I am communicating between the GUI and the backend code that does all the grunt work. A websocket server is the go between, between the backend code and the GUI part of the application. Here is the flow of the communication. From GUI to backend: GUI--WebSocketServer--Backend From backend to GUI: Backend--WebSocketServer--Backend Problem: The problem I am wanting to solve, is if a user request an action to be done on the GUI and then an error is encountered I want only that specific user to get an error message not everyone connected to the site that is the GUI. The only feasible way I can think of doing this right now, is sending the session ID of the user requesting the action as part of the websocket message and then storing that using ID corresponding to the action requested in something like a HashMap. Then if there is an error while performing the requested action put some logic in the websocket server code to extract the session ID from the message being sent back to the GUI and send the error message to this specific session. Question: My question is, is there any simplier way to do this of sending a message to a specific user between ajava back end and a web page front end that communicate using web sockets, or is this the only way possible to achieve what I am trying to do? - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
issue with application finding tomcat jars
I have an application that uses the websocket jars from tomcat and sometimes get this error, java.util.ServiceConfigurationError: javax.websocket.ContainerProvider: Provider org.apache.tomcat.websocket.WsContainerProvider not found Then it gets the error for a while and magically finds the jars and runs which is weird. What may be causing this behavior to not find the jars then magically find the jars? - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
unit testing on tomcat with java
I am currently using tomcat 7.0.57 to host a website for the purpose of having a websocket serverdeployed with the page for the purpose of communicating between an external java program and the webpage. I would like to write some unit test to test that the integration between the external java program and the webpage. I have however had trouble finding what is the best way to do this (all i could find was on when you are using servlets in tomcat). Would j-unit be able to run test to verify that the integration between the webpage and the external java program is implemented correctly, or is j-unit unable to test using a tomcat webserver? If it is unable to run test with the tomcat webserver, what unit testing tool is able to that is able to run on a linux machine? - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: unit testing on tomcat with java
To the question, the external program is sending messages to the webpage through the websocket server on the page. Where as the webpage is the gui and the external java program is the guts of the gui which does what you want when a button is pressed on the gui. On Thu, Dec 11, 2014 at 9:35 AM, Christopher Schultz ch...@christopherschultz.net wrote: -BEGIN PGP SIGNED MESSAGE- Hash: SHA256 Jason, On 12/11/14 9:07 AM, Jason Ricles wrote: I am currently using tomcat 7.0.57 to host a website for the purpose of having a websocket serverdeployed with the page for the purpose of communicating between an external java program and the webpage. The web page (i.e. servlet) is running an external Java program, or the external Java program is trying to access a web page (i.e. servlet)? I would like to write some unit test to test that the integration between the external java program and the webpage. I have however had trouble finding what is the best way to do this (all i could find was on when you are using servlets in tomcat). In a Java web application server (like Tomcat), everything boils down to a servlet in the end (unless a Filter takes over, first, and provides a response). Would j-unit be able to run test to verify that the integration between the webpage and the external java program is implemented correctly, or is j-unit unable to test using a tomcat webserver? Tomcat's source package includes hundreds of test cases, written using junit. If it is unable to run test with the tomcat webserver, what unit testing tool is able to that is able to run on a linux machine? Junit works great. Get Tomcat's source package and look under the /test directory for .java files. There are lots of them. - -chris -BEGIN PGP SIGNATURE- Version: GnuPG v1 Comment: GPGTools - http://gpgtools.org iQIcBAEBCAAGBQJUiauiAAoJEBzwKT+lPKRY/fUP/1ByU6kaDpW/wERC7uEo431P cGtwV2JyLKwFqYl7u6XWBR9jy0V4B3XsjGKUQHcqCrUiFio4mkImYQMNE/SRB6Ny KYFUrB+UGx7ZHzgTNFJ65D6PkVdGYBtGbTuWO1aipAPxn4ZgOg+/oPD+E71nt1xw SruOl6N6TwBdQIakTcg3HGSMt/mWM00TUBukspdfBgyg8GVKwnZgAY4e1MD6JwAx 5G/J524dFT/PM7ZyMZ9kuoOpjGb14rjdVjfbas5FYLPc9LH7ZjpVnG/ymJSo+RDz HjccYK/xHGzsBt8dcgJxc/ez4h78YLjKlbV3uDqHn5/hGhEkTMa6dNT9C+FB5vcp qR78YJGjHFRbXXBGoLBgnCGozcVV/DFFIzyeRwon/oU2RiG4CiTrfLXSzZ4Jl6IU MjA5RGFQYQVhBLZ4VVIl/X4d1aHIavufnwWkKaseFAszgcWomwqO1976o30EBDxu AKWBU/7CwifM1krdBgebUVs3CsLAZKjOqUrlg3Na3vuVXh12pDhMKIoL2kii/9df cdcubH60TXh07gRHVI2Gkqtt98xL8D3CW9tVbVkuYy3PQuMh6O4MfxLrrQNia/k3 Nlm+cGIw29qkO2/YyT0wxxlXfkJKmg/6GWTQQO7kxVxx5xaADEEReZuEIfRynZrI q5U6ivDxxIPrqHZypgDb =WKUa -END PGP SIGNATURE- - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: unit testing on tomcat with java
No no, it goes Website (GUI) ws server -- external java program On Thu, Dec 11, 2014 at 11:25 AM, Christopher Schultz ch...@christopherschultz.net wrote: -BEGIN PGP SIGNED MESSAGE- Hash: SHA256 Jason, On 12/11/14 10:03 AM, Jason Ricles wrote: To the question, the external program is sending messages to the webpage through the websocket server on the page. Where as the webpage is the gui and the external java program is the guts of the gui which does what you want when a button is pressed on the gui. Uh... what? External program -- ws:// -- page -- executes Java program ? - -chris On Thu, Dec 11, 2014 at 9:35 AM, Christopher Schultz ch...@christopherschultz.net wrote: Jason, On 12/11/14 9:07 AM, Jason Ricles wrote: I am currently using tomcat 7.0.57 to host a website for the purpose of having a websocket serverdeployed with the page for the purpose of communicating between an external java program and the webpage. The web page (i.e. servlet) is running an external Java program, or the external Java program is trying to access a web page (i.e. servlet)? I would like to write some unit test to test that the integration between the external java program and the webpage. I have however had trouble finding what is the best way to do this (all i could find was on when you are using servlets in tomcat). In a Java web application server (like Tomcat), everything boils down to a servlet in the end (unless a Filter takes over, first, and provides a response). Would j-unit be able to run test to verify that the integration between the webpage and the external java program is implemented correctly, or is j-unit unable to test using a tomcat webserver? Tomcat's source package includes hundreds of test cases, written using junit. If it is unable to run test with the tomcat webserver, what unit testing tool is able to that is able to run on a linux machine? Junit works great. Get Tomcat's source package and look under the /test directory for .java files. There are lots of them. -chris - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org -BEGIN PGP SIGNATURE- Version: GnuPG v1 Comment: GPGTools - http://gpgtools.org iQIcBAEBCAAGBQJUicWLAAoJEBzwKT+lPKRYNJEP/1mrbBxelvjQlwBpzuSG+Fob 0FheORmBWgL0VyhkFG75VtL0sa18vRbcrd6/RZn5fu0KrynnUJq5PvQICUnKJSTx 9sb32bvqDS1afcvWhcFDqkdMsBgWd6xTolcoOlFb4DZfRhbPGSFPqFZQgvskLg2b y5OKMU8dfVBVwypwhk+WxM5PePoa0utzAnomajmigKMkl8NHFiGqLPo+GuK1u4aP 6nl9xh3V1cJGjZyo/KrMZQJICVV27mF6YwBDs7BJqY5Tz4/EBnd/iRmZvhZO2yae 8BcZncAtcjHdwrjYepUDTeY3T8NE9ViYKdPanuW0DoViPjImp6kRQmMcXxo1ax7k AVpFapFN8gAXf1+45Vz3G8m8g2sRjgyssXo6hKg/z24ufaMsYTrFN2eWHhgF82V3 x4lyJA+/0aQMQewchN9uNzgfOqaIvKggdI9OtnBY677ADXULmV7lzyyjSsTe9W37 epyYxz7D5wtgf0e4ueVjOnVQssVUdg78UJzN88AJc4tJ5Rhvz5mECQmA5jvEaHpY XcYKwP9VOhyPXbZL99vF62/51xpe//1s0eNOuorS83qP8g9obksFyrFSfWtjr2nU BVA9IKeOQHTuv47AeSuFckyMQaClE0d+ROkS6JUPeocsHkAEsus28kKNcu8D3rAE nHd1KZHCV+KMR51L6+sh =rWFr -END PGP SIGNATURE- - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: unit testing on tomcat with java
To test GUI to external progam so when I say hey send this request to the program the program sets the request flags to true. On Thu, Dec 11, 2014 at 12:39 PM, Christopher Schultz ch...@christopherschultz.net wrote: -BEGIN PGP SIGNED MESSAGE- Hash: SHA256 Jason, On 12/11/14 12:16 PM, Jason Ricles wrote: No no, it goes Website (GUI) ws server -- external java program Okay, and your unit test is going to test which interaction? From GUI to ws server, or from ws server (really a servlet) to the external Java program? If it were me, I'd be testing whether your servlet can talk to the external Java program properly and not worry about the fact that it's being used by a ws server. You can be reasonably sure that calling a method from Java is going to work... JVMs are pretty reliable these days. You can always run your unit test so that the external Java program produces some output that can be tested by the unit test. If it produces no output, then it's useless to run the external Java program... right? - -chris On Thu, Dec 11, 2014 at 11:25 AM, Christopher Schultz ch...@christopherschultz.net wrote: Jason, On 12/11/14 10:03 AM, Jason Ricles wrote: To the question, the external program is sending messages to the webpage through the websocket server on the page. Where as the webpage is the gui and the external java program is the guts of the gui which does what you want when a button is pressed on the gui. Uh... what? External program -- ws:// -- page -- executes Java program ? -chris On Thu, Dec 11, 2014 at 9:35 AM, Christopher Schultz ch...@christopherschultz.net wrote: Jason, On 12/11/14 9:07 AM, Jason Ricles wrote: I am currently using tomcat 7.0.57 to host a website for the purpose of having a websocket serverdeployed with the page for the purpose of communicating between an external java program and the webpage. The web page (i.e. servlet) is running an external Java program, or the external Java program is trying to access a web page (i.e. servlet)? I would like to write some unit test to test that the integration between the external java program and the webpage. I have however had trouble finding what is the best way to do this (all i could find was on when you are using servlets in tomcat). In a Java web application server (like Tomcat), everything boils down to a servlet in the end (unless a Filter takes over, first, and provides a response). Would j-unit be able to run test to verify that the integration between the webpage and the external java program is implemented correctly, or is j-unit unable to test using a tomcat webserver? Tomcat's source package includes hundreds of test cases, written using junit. If it is unable to run test with the tomcat webserver, what unit testing tool is able to that is able to run on a linux machine? Junit works great. Get Tomcat's source package and look under the /test directory for .java files. There are lots of them. -chris - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org -BEGIN PGP SIGNATURE- Version: GnuPG v1 Comment: GPGTools - http://gpgtools.org iQIcBAEBCAAGBQJUidbCAAoJEBzwKT+lPKRYxqEQAK3o428+SWrQtPC2toPJWwbb yjwNRE1pdpuAQMD+KCCosa7P1C8BiFAsU6n/x2Cw/buAYgeE294mp14gGzL+266c 7rwdZG4MIzaj06dqBtKQvIMzOlBFp1amvljcHdMD82iqP9geHrRTfi9Oh0FIsuur D1aIueAexlBRayynkESg8jss2jmDE7RwDzc10077xxHavZjNKFvq17SH8c2cmTPH 6bIDeW72OxmGUxHrcNTGIvN018PlDoZPe+pi1IlBLJkPdviXeDbZkvmP9VP2gS4a 7LvIrKSRaTA2uurIEiBBcYnVARyLnGhZD2rC960iwsY5SW+ZIivVRabXE8DxsBMs ZMk+mBjYxwTk/aIa1ljOrXwmDUaAjUWbo8C8rQinKW2CYuNUTaNkqSWWQ+QNA8pH ELyb039gtfhn7vKeZ9aCWFcTjkPPR01SyMtzT65eaxZshwi80ZNYNNxciACV9f4f Yfrsp4ZaLSn0zeau4UspLX5PR+bW/wuyn9Cex9XVncpE367fBIMM9jYsnSdMR3uD ON6Bco/WPFlcVbATQxaEz1N1GKUfpQJTCLw3XQeZZwtfYKaCbGtgHD2J606Tm0kU GCvBgavbHUF+H9acgjvfSVvlC6bGcvagpBrFdmMaUW/+8bRx7P/0xigiDoK2g/kF Jaeyl5Kj6jOyWPCQUXf1 =KKTg -END PGP SIGNATURE- - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org - To unsubscribe, e-mail: users
Re: Error with finding of reserve bits in websocket frame tomcat 7.0.53?
Yes it does without any error. I have tested 10 times with no errors which never happened before and the value of int b does not affected int rsv. So as far after these test I claim it is fixed in at least 7.0.53. I also filed a bug report for tomcat 7.0.53 and explained the bug and the solution to update tomcat since it was not in the bug database at all. On Thu, Dec 4, 2014 at 4:50 PM, David kerber dcker...@verizon.net wrote: On 12/4/2014 4:32 PM, Jason Ricles wrote: Yes it was a bug so we will try to get a waiver to use 7.0.57 for our environment instead of 7.0.53 So it works as expected in 7.0.57? On Thu, Dec 4, 2014 at 1:20 PM, Jason Ricles jgr...@alum.lehigh.edu wrote: Well the trace is fine so I will upgrade and try and see what happens. If it is not fixed I assume I should file a bug report. On Thu, Dec 4, 2014 at 1:19 PM, Mark Thomas ma...@apache.org wrote: On 04/12/2014 18:04, Jason Ricles wrote: Due to some regulations out of my control right now we can only use tomcat 7.0.53. I also did a wireshark bug trace and going over the line the reserved bits are 0 but when computed in tomcat that is when the reserved are set to invalid bits. Is there any possible solution or am I just out of luck with tomcat? If you are stuck on 7.0.53 then you might be out of luck. It depends what the problem is. The comments on the test case or trace stand but the response may be It has been fixed. You need to upgrade. Mark On Thu, Dec 4, 2014 at 12:16 PM, Mark Thomas ma...@apache.org wrote: On 04/12/2014 15:26, Jason Ricles wrote: I have tomcat 7.0.53 and have been having a problem with the following error when sending a binary message CloseReason: code [1002], reason [The client frame set the reserved bits to [x] which was not supported by this endpoint] where x is between 1-7 when printed out. So I remote debugged and stepped through the WsFrameBase.class source code. This source code is what sets the reserve bit so I stepped through the following piece of the code //further up in the code input buffer is set inputBuffer = new byte[Constants.DEFAULT_BUFFER_SIZE]; //calculation of reserve int b = inputBuffer[readPos++]; fin = (b 0x80) 0; rsv = (b 0x70) 4; if (rsv != 0) { // Note extensions may use rsv bits but currently no extensions are // supported throw new WsIOException(new CloseReason( CloseCodes.PROTOCOL_ERROR, sm.getString(wsFrame.wrongRsv, Integer.valueOf(rsv; } However I have noticed when the line int b = inputBuffer[readPos++]; it sometimes changes the value of the reserve bit from 0 to a number between 1-7. Why would this be changing the reserve bit? Is this possibly an error with what I am doing or an error due to the class from tomcat that is running? Most likely a Tomcat bug. First of all, upgrade to the latest 7.0.x release. There have been fixes since 7.0.53. Next, try and create the simplest possible test case to recreate the issue. Failing that, try capturing a Wireshark trace for the connection that is failing. Mark - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Error with finding of reserve bits in websocket frame tomcat 7.0.53?
I have tomcat 7.0.53 and have been having a problem with the following error when sending a binary message CloseReason: code [1002], reason [The client frame set the reserved bits to [x] which was not supported by this endpoint] where x is between 1-7 when printed out. So I remote debugged and stepped through the WsFrameBase.class source code. This source code is what sets the reserve bit so I stepped through the following piece of the code //further up in the code input buffer is set inputBuffer = new byte[Constants.DEFAULT_BUFFER_SIZE]; //calculation of reserve int b = inputBuffer[readPos++]; fin = (b 0x80) 0; rsv = (b 0x70) 4; if (rsv != 0) { // Note extensions may use rsv bits but currently no extensions are // supported throw new WsIOException(new CloseReason( CloseCodes.PROTOCOL_ERROR, sm.getString(wsFrame.wrongRsv, Integer.valueOf(rsv; } However I have noticed when the line int b = inputBuffer[readPos++]; it sometimes changes the value of the reserve bit from 0 to a number between 1-7. Why would this be changing the reserve bit? Is this possibly an error with what I am doing or an error due to the class from tomcat that is running? - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: Error with finding of reserve bits in websocket frame tomcat 7.0.53?
Due to some regulations out of my control right now we can only use tomcat 7.0.53. I also did a wireshark bug trace and going over the line the reserved bits are 0 but when computed in tomcat that is when the reserved are set to invalid bits. Is there any possible solution or am I just out of luck with tomcat? On Thu, Dec 4, 2014 at 12:16 PM, Mark Thomas ma...@apache.org wrote: On 04/12/2014 15:26, Jason Ricles wrote: I have tomcat 7.0.53 and have been having a problem with the following error when sending a binary message CloseReason: code [1002], reason [The client frame set the reserved bits to [x] which was not supported by this endpoint] where x is between 1-7 when printed out. So I remote debugged and stepped through the WsFrameBase.class source code. This source code is what sets the reserve bit so I stepped through the following piece of the code //further up in the code input buffer is set inputBuffer = new byte[Constants.DEFAULT_BUFFER_SIZE]; //calculation of reserve int b = inputBuffer[readPos++]; fin = (b 0x80) 0; rsv = (b 0x70) 4; if (rsv != 0) { // Note extensions may use rsv bits but currently no extensions are // supported throw new WsIOException(new CloseReason( CloseCodes.PROTOCOL_ERROR, sm.getString(wsFrame.wrongRsv, Integer.valueOf(rsv; } However I have noticed when the line int b = inputBuffer[readPos++]; it sometimes changes the value of the reserve bit from 0 to a number between 1-7. Why would this be changing the reserve bit? Is this possibly an error with what I am doing or an error due to the class from tomcat that is running? Most likely a Tomcat bug. First of all, upgrade to the latest 7.0.x release. There have been fixes since 7.0.53. Next, try and create the simplest possible test case to recreate the issue. Failing that, try capturing a Wireshark trace for the connection that is failing. Mark - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: Error with finding of reserve bits in websocket frame tomcat 7.0.53?
Well the trace is fine so I will upgrade and try and see what happens. If it is not fixed I assume I should file a bug report. On Thu, Dec 4, 2014 at 1:19 PM, Mark Thomas ma...@apache.org wrote: On 04/12/2014 18:04, Jason Ricles wrote: Due to some regulations out of my control right now we can only use tomcat 7.0.53. I also did a wireshark bug trace and going over the line the reserved bits are 0 but when computed in tomcat that is when the reserved are set to invalid bits. Is there any possible solution or am I just out of luck with tomcat? If you are stuck on 7.0.53 then you might be out of luck. It depends what the problem is. The comments on the test case or trace stand but the response may be It has been fixed. You need to upgrade. Mark On Thu, Dec 4, 2014 at 12:16 PM, Mark Thomas ma...@apache.org wrote: On 04/12/2014 15:26, Jason Ricles wrote: I have tomcat 7.0.53 and have been having a problem with the following error when sending a binary message CloseReason: code [1002], reason [The client frame set the reserved bits to [x] which was not supported by this endpoint] where x is between 1-7 when printed out. So I remote debugged and stepped through the WsFrameBase.class source code. This source code is what sets the reserve bit so I stepped through the following piece of the code //further up in the code input buffer is set inputBuffer = new byte[Constants.DEFAULT_BUFFER_SIZE]; //calculation of reserve int b = inputBuffer[readPos++]; fin = (b 0x80) 0; rsv = (b 0x70) 4; if (rsv != 0) { // Note extensions may use rsv bits but currently no extensions are // supported throw new WsIOException(new CloseReason( CloseCodes.PROTOCOL_ERROR, sm.getString(wsFrame.wrongRsv, Integer.valueOf(rsv; } However I have noticed when the line int b = inputBuffer[readPos++]; it sometimes changes the value of the reserve bit from 0 to a number between 1-7. Why would this be changing the reserve bit? Is this possibly an error with what I am doing or an error due to the class from tomcat that is running? Most likely a Tomcat bug. First of all, upgrade to the latest 7.0.x release. There have been fixes since 7.0.53. Next, try and create the simplest possible test case to recreate the issue. Failing that, try capturing a Wireshark trace for the connection that is failing. Mark - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: Error with finding of reserve bits in websocket frame tomcat 7.0.53?
Yes it was a bug so we will try to get a waiver to use 7.0.57 for our environment instead of 7.0.53 On Thu, Dec 4, 2014 at 1:20 PM, Jason Ricles jgr...@alum.lehigh.edu wrote: Well the trace is fine so I will upgrade and try and see what happens. If it is not fixed I assume I should file a bug report. On Thu, Dec 4, 2014 at 1:19 PM, Mark Thomas ma...@apache.org wrote: On 04/12/2014 18:04, Jason Ricles wrote: Due to some regulations out of my control right now we can only use tomcat 7.0.53. I also did a wireshark bug trace and going over the line the reserved bits are 0 but when computed in tomcat that is when the reserved are set to invalid bits. Is there any possible solution or am I just out of luck with tomcat? If you are stuck on 7.0.53 then you might be out of luck. It depends what the problem is. The comments on the test case or trace stand but the response may be It has been fixed. You need to upgrade. Mark On Thu, Dec 4, 2014 at 12:16 PM, Mark Thomas ma...@apache.org wrote: On 04/12/2014 15:26, Jason Ricles wrote: I have tomcat 7.0.53 and have been having a problem with the following error when sending a binary message CloseReason: code [1002], reason [The client frame set the reserved bits to [x] which was not supported by this endpoint] where x is between 1-7 when printed out. So I remote debugged and stepped through the WsFrameBase.class source code. This source code is what sets the reserve bit so I stepped through the following piece of the code //further up in the code input buffer is set inputBuffer = new byte[Constants.DEFAULT_BUFFER_SIZE]; //calculation of reserve int b = inputBuffer[readPos++]; fin = (b 0x80) 0; rsv = (b 0x70) 4; if (rsv != 0) { // Note extensions may use rsv bits but currently no extensions are // supported throw new WsIOException(new CloseReason( CloseCodes.PROTOCOL_ERROR, sm.getString(wsFrame.wrongRsv, Integer.valueOf(rsv; } However I have noticed when the line int b = inputBuffer[readPos++]; it sometimes changes the value of the reserve bit from 0 to a number between 1-7. Why would this be changing the reserve bit? Is this possibly an error with what I am doing or an error due to the class from tomcat that is running? Most likely a Tomcat bug. First of all, upgrade to the latest 7.0.x release. There have been fixes since 7.0.53. Next, try and create the simplest possible test case to recreate the issue. Failing that, try capturing a Wireshark trace for the connection that is failing. Mark - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: CloseReason 1002
Here is the wireshark of the binary data that is being transferred over. 00 00 00 00 00 00 00 00 00 00 00 00 86 dd 60 00 ..`. 0010 00 00 5c 15 06 40 00 00 00 00 00 00 00 00 00 00 ..\..@.. 0020 00 00 00 00 00 01 00 00 00 00 00 00 00 00 00 00 0030 00 00 00 00 00 01 1f 90 9e 33 f7 a4 a7 41 5f b2 .3...A_. 0040 50 d0 80 18 04 10 5c 1d 00 00 01 01 08 0a 04 2c P.\. ..., 0050 d2 7b 04 2c d2 7b 74 69 6d 73 74 61 74 75 73 00 .{.,.{ti mstatus. 0060 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0070 00 00 00 00 00 00 00 00 5b d1 ff d8 ff e0 00 10 [... 0080 4a 46 49 46 00 01 01 01 00 48 00 48 00 00 ff fe JFIF .H.H 0090 00 3b 43 52 45 41 54 4f 52 3a 20 67 64 2d 6a 70 .;CREATO R: gd-jp 00a0 65 67 20 76 31 2e 30 20 28 75 73 69 6e 67 20 49 eg v1.0 (using I 00b0 4a 47 20 4a 50 45 47 20 76 36 32 29 2c 20 71 75 JG JPEG v62), qu 00c0 61 6c 69 74 79 20 3d 20 37 35 0a ff db 00 43 00 ality = 75C. 00d0 08 06 06 07 06 05 08 07 07 07 09 09 08 0a 0c 14 00e0 0d 0c 0b 0b 0c 19 12 13 0f 14 1d 1a 1f 1e 1d 1a 00f0 1c 1c 20 24 2e 27 20 22 2c 23 1c 1c 28 37 29 2c .. $.' ,#..(7), 0100 30 31 34 34 34 1f 27 39 3d 38 32 3c 2e 33 34 32 01444.'9 =82.342 0110 ff db 00 43 01 09 09 09 0c 0b 0c 18 0d 0d 18 32 ...C ...2 0120 21 1c 21 32 32 32 32 32 32 32 32 32 32 32 32 32 !.!2 0130 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 0140 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 0150 32 32 32 32 32 ff c0 00 11 08 01 52 01 c2 03 01 2... ...R 0160 22 00 02 11 01 03 11 01 ff c4 00 1c 00 00 01 05 ... 0170 01 01 01 00 00 00 00 00 00 00 00 00 00 03 00 01 0180 02 04 05 06 07 08 ff c4 00 41 10 00 01 03 02 04 .A.. 0190 03 04 08 05 03 03 03 05 01 01 00 01 00 02 11 03 01a0 21 04 12 31 41 05 51 61 13 22 71 81 06 14 32 91 !..1A.Qa .q...2. 01b0 a1 b1 c1 f0 07 23 42 52 d1 15 e1 f1 33 62 72 16 .#BR 3br. 01c0 24 43 34 53 63 73 93 82 92 ff c4 00 19 01 00 03 $C4Scs.. 01d0 01 01 01 00 00 00 00 00 00 00 00 00 00 00 00 01 01e0 02 03 04 05 ff c4 00 23 11 00 02 02 02 03 01 01 ...# 01f0 00 03 01 01 00 00 00 00 00 00 01 02 11 21 31 03 .!1. 0200 12 41 51 13 04 61 71 22 32 ff da 00 0c 03 01 00 .AQ..aq 2... 0210 02 11 03 11 00 3f 00 f1 ec 2b ae f6 c6 a2 51 c1 .?.. .+Q. 0220 b3 85 cc 15 52 83 b2 d7 61 b5 ec 7c d5 c6 d9 f1 R... a..| 0230 68 53 2d 95 10 7a 12 2d a5 a3 65 ad c1 aa 46 26 hS-..z.- ..e...F 0240 a3 09 f6 db 3e 61 65 40 91 f5 57 38 75 51 4f 1b ae@ ..W8uQO. 0250 44 9b 5f 29 52 cb 3a 40 0f 3d 50 f4 ad e2 22 51 D._)R.:@ .=P...Q 0260 37 3a ca 1d 41 0f 6b ba ca cc 61 00 37 50 36 7f 7:..A.k. ..a.7P6. 0270 42 25 4e fa ee 54 6a bb 28 6b a3 78 29 8c 91 d0 B%N..Tj. (k.x)... 0280 15 32 db 5a 7f 85 01 76 8f 85 91 01 30 90 bd 2b .2.Z...v 0..+ 0290 62 c4 53 0e 83 dd 20 a3 82 60 11 ef 43 c4 0c d4 b.S... . .`..C... 02a0 5c 23 64 f4 0e 6a 0c 3d 12 5a 19 27 36 64 72 dd \#d..j.= .Z.'6dr. 02b0 48 03 10 42 67 5a 2d e4 a4 d3 ca d3 a2 3f c1 82 H..BgZ-. .?.. 02c0 b4 ca 70 64 01 bc 24 e6 f2 02 54 5a 48 31 d5 35 ..pd..$. ..TZH1.5 02d0 9d 88 7d 46 b6 51 21 44 bd c5 c7 2b 24 2d 2e 11 ..}F.Q!D ...+$-.. 02e0 c1 31 9c 61 d5 bb 27 b2 9b 29 30 39 cf 22 75 30 .1.a..'. .)09.u0 02f0 00 f1 fe e8 4a dd 01 94 f0 3d eb 99 e3 8d c9 8b J... .=.. 0300 63 a6 ce 6c ae ee 87 0a c0 56 c6 8c 1e 27 8c 7a c..l .V...'.z 0310 ae 23 f6 55 a0 5a 0f 83 a6 0a d7 a9 f8 65 c3 71 .#.U.Z.. .e.q 0320 8e 63 b1 1c 43 15 99 a3 f4 35 a0 15 ac 22 44 a9 .c..C... .5...D. 0330 a3 c6 da 0e 4b 41 45 67 b6 df 29 0b db 30 9f 84 KAEg ..)..0.. 0340 bc 00 53 cd 5a a6 35 e2 34 ed 40 f9 04 73 f8 77 ..S.Z.5. 4.@..s.w 0350 e8 be 14 02 30 55 6a 38 69 9f 10 e5 ad 60 cc f3 0Uj8 i`.. 0360 ce dd 90 22 6c 8e c7 07 b6 74 20 ee 57 a8 60 bd ...l... .t .W.`. 0370 0f e1 4c 22 b5 4c 15 31 fb 58 49 8f 13 75 aa de ..L.L.1 .XI..u.. 0380 15 c3 a8 ff 00 a3 81 c3 b7 94 52 1f c2 c7 f1 bd ..R. 0390 b3 75 cb 47 8f d3 63 ea 01 95 8e 77 28 6c ab 4c .u.G..c. ...w(l.L 03a0 e1 98 fa c7 f2 f0 78 87 ce e2 99 5e b8 18 da 60 ..x. ...^...` 03b0 65 0d 60 e4 d0 02 20 b8 3b c2 3f 14 4f eb fd 1e e.`... . ;.?.O... 03c0 57 4f d1 9e 33 54 8c b8 1a 80 73 7c 0f 99 56 bf WO..3T.. ..s|..V. 03d0 e8 de 2a e0 45 41 41 92 08 ef 55 1f 45 e9 39 23 ..*.EAA. ..U.E.9# 03e0 51 7f 05 02 d0 4f 34 ff 00 28 87 ec ce 03 0f e8 QO4. .(.. 03f0 46 29 ac 0d a9 8d c3 88 10 48 93 f4 46 a5 e8 4f F).. .H..F..O 0400 6b 54 35 d8 f8 11 24 8a 46 c3 de bb 67 61 da e3 kT5...$. F...ga.. 0410 71 ee 4e dc 33 98 c7 86 80 49 b5 ca 7f 94 6f 44
Re: CloseReason 1002
Mark, Is there any way to do two back to back writes to a websocket with a sort of blocking technique, and without using a sleep? On Mon, Dec 1, 2014 at 3:13 PM, Mark Thomas ma...@apache.org wrote: On 01/12/2014 18:30, Jason Ricles wrote: What might be causing this error on concurrent writes in a websocket, The fact you are doing concurrent writes? The Java WebSocket API doesn't allow that. And it should stop you with a suitable exception. Mark CloseReason: code [1002], reason [The client frame set the reserved bits to [2] which was not supported by this endpoint]? - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: CloseReason 1002
No luck try to find a blocking call or having the websocket server reader go off into another thread. so basically no way around this problem it seems? On Tue, Dec 2, 2014 at 9:19 AM, Mark Thomas ma...@apache.org wrote: On 02/12/2014 13:05, Jason Ricles wrote: Mark, Is there any way to do two back to back writes to a websocket with a sort of blocking technique, and without using a sleep? Use one of the blocking methods (i.e. one without a Future or SendHandler). A variation way is to call setBatchingAllowed(true), call the writes (probably with the blocking methods) and then setBatchingAllowed(false). If the messages are smaller than the buffer, they'll set in the buffer and then you'll get a blocking write to empty the buffer when you call setBatchingAllowed(false). I should add that the Javadoc isn't as clear about the expected behaviour for non-blocking writes as it is for blocking writes but the model as I understand it is that the previous write has to complete before the next write can start. Mark On Mon, Dec 1, 2014 at 3:13 PM, Mark Thomas ma...@apache.org wrote: On 01/12/2014 18:30, Jason Ricles wrote: What might be causing this error on concurrent writes in a websocket, The fact you are doing concurrent writes? The Java WebSocket API doesn't allow that. And it should stop you with a suitable exception. Mark CloseReason: code [1002], reason [The client frame set the reserved bits to [2] which was not supported by this endpoint]? - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: CloseReason 1002
Ok more information it was not the back to back writes that are done on the client side, I have a bytebuffer message that is 23,000 bytes and thats where the error with code 1002 happens sometimes not 100% of the time about 2 out of 5 times. However an 800 byte message in a bytebuffer has no problem 100% of the time. On Tue, Dec 2, 2014 at 4:08 PM, Jason Ricles jgr...@alum.lehigh.edu wrote: No luck try to find a blocking call or having the websocket server reader go off into another thread. so basically no way around this problem it seems? On Tue, Dec 2, 2014 at 9:19 AM, Mark Thomas ma...@apache.org wrote: On 02/12/2014 13:05, Jason Ricles wrote: Mark, Is there any way to do two back to back writes to a websocket with a sort of blocking technique, and without using a sleep? Use one of the blocking methods (i.e. one without a Future or SendHandler). A variation way is to call setBatchingAllowed(true), call the writes (probably with the blocking methods) and then setBatchingAllowed(false). If the messages are smaller than the buffer, they'll set in the buffer and then you'll get a blocking write to empty the buffer when you call setBatchingAllowed(false). I should add that the Javadoc isn't as clear about the expected behaviour for non-blocking writes as it is for blocking writes but the model as I understand it is that the previous write has to complete before the next write can start. Mark On Mon, Dec 1, 2014 at 3:13 PM, Mark Thomas ma...@apache.org wrote: On 01/12/2014 18:30, Jason Ricles wrote: What might be causing this error on concurrent writes in a websocket, The fact you are doing concurrent writes? The Java WebSocket API doesn't allow that. And it should stop you with a suitable exception. Mark CloseReason: code [1002], reason [The client frame set the reserved bits to [2] which was not supported by this endpoint]? - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Back to back writes to websocket server weird behavior
I have a binary queue that I am writing to a websocket server written in java from a client end point with the following code, while((bbuf = messageQueue.take()).get(0) != 0) { bbuf.position(bbuf.limit()); bbuf.flip(); for(Session session : sessionList) { session.getBasicRemote().sendBinary(bbuf); } } However sometimes the 2nd message is dropped or the first message is sent with no data. Why might this be happening, instead of the messages getting sent correctly with no data lost 100% of the time? - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
CloseReason 1002
What might be causing this error on concurrent writes in a websocket, CloseReason: code [1002], reason [The client frame set the reserved bits to [2] which was not supported by this endpoint]? - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Websocket @OnMessage is never firing for binary messages only text
I am writing a websocket communication with the client and server endpoints both in java code (using tomcat 7.0.53 as the web server) When I send a text message using the session.getbasicremote.sendText(String) method the @Onmessage function is fired and everything. However I want to send binary data between the websockets so thus have to use session.getbasicremote.sendBinary(ByteBuffer). The code should then be read within the following method, @OnMessage public void recieved(ByteBuffer byteBuffer) { System.out.println(byteBuffer); } However the method is never fired when the message is sent (I debugged through both remote debugging and print statements to verify that the binary data is being sent also yes regular text does get sent through this method when binary is switched to text). Does anyone have a clue why this method is never being called when the data is sent from the other end of the websocket? Here is also the code for the part where the binary data is sent over the websocket. Also the @onError methods are in the classes and never called either. public void SendMessage() throws IOException { for(int i = 0;iMESSAGE_SIZE;i++) message+='\0'; for(int i = 0;iID_SIZE;i++) id+='\0'; ByteBuffer bbuf = ByteBuffer.allocate(1000); bbuf.put(id.getBytes()); bbuf.position(33); bbuf.putInt(33,length); bbuf.position(37); bbuf.put(message.getBytes()); for(Session session : sessionList) session.getBasicRemote().sendBinary(bbuf); System.out.println(sent); } Jason Ricles - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: Websocket @OnMessage is never firing for binary messages only text
Yup that flip did it and it works. Yes haha that was one of the many reasons I didn't major in something with more writing. Luckily its just a test method thats why I didn't double check the spelling. Thanks for the help. On Tue, Nov 18, 2014 at 3:00 PM, Konstantin Kolinko knst.koli...@gmail.com wrote: 2014-11-18 22:14 GMT+03:00 Jason Ricles jgr...@alum.lehigh.edu: I am writing a websocket communication with the client and server endpoints both in java code (using tomcat 7.0.53 as the web server) When I send a text message using the session.getbasicremote.sendText(String) method the @Onmessage function is fired and everything. However I want to send binary data between the websockets so thus have to use session.getbasicremote.sendBinary(ByteBuffer). The code should then be read within the following method, @OnMessage public void recieved(ByteBuffer byteBuffer) { System.out.println(byteBuffer); } However the method is never fired when the message is sent (I debugged through both remote debugging and print statements to verify that the binary data is being sent also yes regular text does get sent through this method when binary is switched to text). Does anyone have a clue why this method is never being called when the data is sent from the other end of the websocket? Here is also the code for the part where the binary data is sent over the websocket. Also the @onError methods are in the classes and never called either. public void SendMessage() throws IOException { for(int i = 0;iMESSAGE_SIZE;i++) message+='\0'; for(int i = 0;iID_SIZE;i++) id+='\0'; ByteBuffer bbuf = ByteBuffer.allocate(1000); bbuf.put(id.getBytes()); bbuf.position(33); bbuf.putInt(33,length); bbuf.position(37); bbuf.put(message.getBytes()); 1. I think that you are missing bbuf.flip() here. for(Session session : sessionList) session.getBasicRemote().sendBinary(bbuf); System.out.println(sent); } 2. There are tests for receiving binary messages in Tomcat, e.g. test/org.apache.tomcat.websocket.TesterEchoServer class. 3. BTW, there is a typo in method name. s/recieved/received/ Best regards, Konstantin Kolinko - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: Websocket @OnMessage is never firing for binary messages only text
Why is the bytebuffer now filled with 0 and no data after doing a flip? On Tue, Nov 18, 2014 at 3:12 PM, Jason Ricles jgr...@alum.lehigh.edu wrote: Yup that flip did it and it works. Yes haha that was one of the many reasons I didn't major in something with more writing. Luckily its just a test method thats why I didn't double check the spelling. Thanks for the help. On Tue, Nov 18, 2014 at 3:00 PM, Konstantin Kolinko knst.koli...@gmail.com wrote: 2014-11-18 22:14 GMT+03:00 Jason Ricles jgr...@alum.lehigh.edu: I am writing a websocket communication with the client and server endpoints both in java code (using tomcat 7.0.53 as the web server) When I send a text message using the session.getbasicremote.sendText(String) method the @Onmessage function is fired and everything. However I want to send binary data between the websockets so thus have to use session.getbasicremote.sendBinary(ByteBuffer). The code should then be read within the following method, @OnMessage public void recieved(ByteBuffer byteBuffer) { System.out.println(byteBuffer); } However the method is never fired when the message is sent (I debugged through both remote debugging and print statements to verify that the binary data is being sent also yes regular text does get sent through this method when binary is switched to text). Does anyone have a clue why this method is never being called when the data is sent from the other end of the websocket? Here is also the code for the part where the binary data is sent over the websocket. Also the @onError methods are in the classes and never called either. public void SendMessage() throws IOException { for(int i = 0;iMESSAGE_SIZE;i++) message+='\0'; for(int i = 0;iID_SIZE;i++) id+='\0'; ByteBuffer bbuf = ByteBuffer.allocate(1000); bbuf.put(id.getBytes()); bbuf.position(33); bbuf.putInt(33,length); bbuf.position(37); bbuf.put(message.getBytes()); 1. I think that you are missing bbuf.flip() here. for(Session session : sessionList) session.getBasicRemote().sendBinary(bbuf); System.out.println(sent); } 2. There are tests for receiving binary messages in Tomcat, e.g. test/org.apache.tomcat.websocket.TesterEchoServer class. 3. BTW, there is a typo in method name. s/recieved/received/ Best regards, Konstantin Kolinko - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: How to access Sessions outside of class
foo is not a webapp, it is a separate program running on the computer as a daemon. It has to do this stuff for it needed to be ran like this. bar is basically the gui to the daemon, providing what is happening on the machine to someone at another computer, since the machine is headless these programs are being ran on. So I am curious as to how having my foo program running outside of bar how it can interact using websockets? So far I have seen that they are disconnected and have no clue about each other outside of using RMI. On Tue, Oct 28, 2014 at 6:55 PM, Christopher Schultz ch...@christopherschultz.net wrote: -BEGIN PGP SIGNED MESSAGE- Hash: SHA256 Jason, On 10/28/14 3:06 PM, Jason Ricles wrote: Chris, foo has to run as a daemon outside of tomcat. It will be interacting with low level drivers through jni. While interesting, it's not terribly relevant. I was looking at trying to do that with making a client endpoint in my daemon but i was having trouble getting it to connect to the websocket server. Maybe you should start there: get your foo daemon talking to your web application via Websocket and I think you'll learn a lot about Websocket in general and probably end up with a better webapp to boot. Thanks, - -chris On Tue, Oct 28, 2014 at 12:21 PM, Christopher Schultz ch...@christopherschultz.net wrote: Jason, On 10/28/14 9:06 AM, Jason Ricles wrote: Ok so here is the problem I have been spinning my wheels on for day let me just lay it out. I have a daemon written in java running lets call it foo for simpleness on a linux machine that has the tomcat server running. On the tomcat server is a WAR file for a webapp called bar. In that webapp is a webpage with JavaScript websocket communication that connects to a websocket server that is also a part of the WAR file. So I have a webpage and a websocket server communicating with each other. I want the foo daemon and the websocket server on bar (web application) to be able to communicate with each other. Is there any way outside of sockets to have foo and the websocket server on bar do this? Dumb question: why can't foo just be a Websocket client? Make a ws:// connection to your web application in Tomcat and then two-way communication is possible. Take whatever values from either side and push them over the wire. Use JSON or something dirt-simple as your data encapsulation language: it's standard, well-understood, and has parsers and serializers readily available for many different languages. It's also pretty much backward- and forward-compatible since everything is pretty much a named value map, so you can add/subtract fields at will without having to rewrite the communication protocol or do a lot of extra work in either the client or the server. -chris On Tue, Oct 28, 2014 at 8:59 AM, Martin Grigorov martin.grigo...@gmail.com wrote: On Tue, Oct 28, 2014 at 2:51 PM, Jose María Zaragoza demablo...@gmail.com wrote: 2014-10-28 13:44 GMT+01:00 Jason Ricles jgr...@alum.lehigh.edu: Martin, I can not use hazelcast due to regulations I have to abide by, is where any other built in way besides sockets that will allow me to share data between the two processes? You could use an embedded ( or not ) messaging broker ( like ActiveMQ ) . Or any kind of in-memory database But this will be again socket based communication. Let's start from the beginning: What is your use case ? What value will have a deserialized session in the second process ? On Tue, Oct 28, 2014 at 8:24 AM, Martin Grigorov martin.grigo...@gmail.com wrote: Hi, In this case you will have to share the data between the processes. A simple and easy solution would be to use http://hazelcast.com/, for example. On Tue, Oct 28, 2014 at 2:06 PM, Jason Ricles jgr...@alum.lehigh.edu wrote: No, it is external as in it is running in a daemon on a linux machine where the tomcat server is also running. On Tue, Oct 28, 2014 at 4:35 AM, Johan Compagner jcompag...@servoy.com wrote: I would like to be able to access my sessions from an external java class, however each time I do sessionList.getsize() it keeps coming back as 0, but there is an active sessions. Is there any way I can access the active sessions in tomcat from an external java class? Jason What is an external java class? Is it in the same class loader? so it is just part of the webapplication? then the above approach should work fine -- Johan Compagner Servoy - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: How to access Sessions outside of class
Yes Chris RMI is a pain in the ass and I have been trying to make a websocket client endpoint now. It however keeps closing and I am not to sure as of why right after the connection is open. http://stackoverflow.com/questions/26636452/tomcat-clientendpoint-websocket-keeps-closing has the code, asked the questions on there and have not gotten any answers. If you could you may look at the code and reply in this email chain why it keeps closing right after it opens. It is straight forward (as of what i know understand) my ignorance was due to being new to tomcat and websockets so sorry for any of that. On Wed, Oct 29, 2014 at 1:47 PM, Christopher Schultz ch...@christopherschultz.net wrote: -BEGIN PGP SIGNED MESSAGE- Hash: SHA256 Jason, On 10/29/14 8:28 AM, Jason Ricles wrote: foo is not a webapp, it is a separate program running on the computer as a daemon. I understand that. I'm only suggesting that, since you have to communicate with Websocket-speaking web application, maybe foo ought to be a Websocket client of that webapp. It has to do this stuff for it needed to be ran like this. bar is basically the gui to the daemon, providing what is happening on the machine to someone at another computer, since the machine is headless these programs are being ran on. So you have a data-collection program (the foo daemon) and an aggregating / reporting program (the webapp). It seems like it would be pretty simple to have the daemon push data to the webapp over Websocket. Then your data consumers (themselves Websocket clients) can get that same data pushed-out to them. Maybe I'm being naive, but this seems fairly straightforward to me. So I am curious as to how having my foo program running outside of bar how it can interact using websockets? Grab the Tomcat Websocket client library and write your code to use it for communication. Or use any other Java-based Websocket client library. Or write your daemon in something other than Java and use whatever Websocket library is available (Perl? PHP? C++?). So far I have seen that they are disconnected and have no clue about each other outside of using RMI. RMI is a complete pain in the ass except under some very special circumstances. It sounds like you might fit into those special circumstances, so feel free to give it a try. If it were me, I'd do it all with Websockets: 1. Foo Daemon - web aggregator 2. web aggregator - data consumers - -chris -BEGIN PGP SIGNATURE- Version: GnuPG v1 Comment: GPGTools - http://gpgtools.org iQIcBAEBCAAGBQJUUSg8AAoJEBzwKT+lPKRYY9gP+wTNvdwerStWi8y5LMOS69UY /GkYP+W9mW9Uxxq6eXs8zTGfJzMrVdp56Y0ywmzyj5PUdMPJBN9HSpn496/tQttF qEjwaqXa6ZJe2Y5s0bAHPVnz2cP3aiNLWP+RlP8vF0tlccBWJFaG+9EC/4TEzJzZ VdJm00EHre6LY9Muk+39PlonMqKCUb9hnkq/97CBjmur1UWtqlfeVBz305FudWXG uZcpjgLpJ/ETK/Ui69Pyg9c1F4GFpK+rDpY2CQZdg9fUpGgg22iURlXWt14ueqSL R6AH9Mvt1GrT88ZMBiTsYKWDCRBtxbTQ8Pgl16U0qRAFF8hSu2nJzKhtjdrwgQp2 Yw4+SGmwEky8jmCUZhkCPg2Y8ds/l4NoK5s5V5ub7OOGPXaT8jHGanrEFM0wNqWX bqZj10QvAN5Pvm2jJWjX+N1sSARWzDBuWfsQHvIcRihxvXr8UJNwCsYkZySCluXU S1n9aoPi+Hx/yMPV5pMvtOsrRaDodyJFouDP6euKA4MV7dCs9ndcLCVL7Y8vDQ5f Y/oExkPqMgWmjtd0Sg5DEDQvJgdzlwvKF1YNU1+bAZgpu05MlL+ybfpYfLUhmJsR wJuzyFFmoP3Jr/GL9Cw1QNX/enPcJt2phPccXcTWW0uwg2KXCaYcNXzyCOAfzmsZ ffRqiIneLm2io6yG1qhV =xzLA -END PGP SIGNATURE- - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: Tomcat Start script not starting from init.d or rc.local
You can use upstart if you have that, with a .conf file. However unless you source the profile.d or wherever your environment variables are held do not use them in an init task! On Wed, Oct 29, 2014 at 1:55 PM, Christopher Schultz ch...@christopherschultz.net wrote: -BEGIN PGP SIGNED MESSAGE- Hash: SHA256 Anthony, On 10/29/14 1:33 PM, Anthony Bungeroth wrote: I basically need a script to run automatically when I reboot the server. I have tried the various ways to get it to work in init.d and it's not working. When I go into init.d and run it manually it works though. That's good. I think it has something to do with the fact that to run the script manually I am logged in as root, whereas for it to run automatically it has to run in the background. /etc/init.d are not usually run in the background. Most /etc/init.d scripts are processed as root on boot, so that shouldn't matter. I will include the script info in this email and see if you had an idea as to where the issue is. So in /etc/init.d, there is a script called Tomcat, here is the start portion of the script. Once again, when I run this manually while logged in as root it launches. #!/bin/sh # Apache Tomcat Startup Script # chkconfig 234 20 80 JAVA_HOME=/opt/jdk1.6.0_45 CATALINA_HOME=/opt/tomcat TOMCAT_USER=tomcat start() { echo -n Starting Tomcat: su $TOMCAT_USER $CATALINA_HOME/bin/startup.sh I'm not sure that's going to work. man su. On my system, the command comes first (with a -c switch), the username last. You might want to consider using sudo instead of su. sleep 2 Sleep? Why? } I tried creating a new script and putting that one in rc.local. Here is the rc.local command: #!/bin/sh # # This script will be executed *after* all the other init scripts. # You can put your own initialization stuff in here if you don't # want to do the full Sys V style init stuff. su tomcat /opt/tomcat/bin/startup.sh This is a total rookie issue I am surebut just in case you might be able to help with an easy enough fix, I would greatly appreciate it. I don't even know where to look for error logs to troubleshoot this. Don't use rc.local. Use /etc/init.d/[whatever] Remember that /etc/init.d scripts aren't directly executed at boot: you have to ln -s each script into /etc/rcX.d where X is the runlevel number into which the machine is booting. Hope that helps, - -chris -BEGIN PGP SIGNATURE- Version: GnuPG v1 Comment: GPGTools - http://gpgtools.org iQIcBAEBCAAGBQJUUSooAAoJEBzwKT+lPKRYjLoQAMmtQ2fm12YbKDC6893mjO0T Hf9oBBDxoBLxkIGu1LC/DUs3GQTGrer3IikNTdIfYzF66ULClD0qxziNbtLcEjtw OLAIiA1cp0zMw2J5NTg5xacyVO8EH9yvKYlgjroLQBfwqK7woo58f4hnh91TkVTZ uWwY1d/wt0iJ2nVeScQh9xGYonZkMeLpDFryG+ANAgXOomqzz7uRz52Tsfp46Q7f 9laPkMRu8paNJ86TSZtr+fQ/NQhhWh+6F8rgqxf/FYwxwbWzN7hgleX4oAev0tTv uM8lOz4tdWreKHMAXGGgrLY/55sCTdPtGlwf11hsMnh6OuUsjEbigzwA5y544kf+ L/bPN1Bc2LwfoMffjjZceORTRK7/j1JrkkMNRYe1g+RjT6Vxio0kal83m6P61X7N 4SwGzZCwHNwbK0I3O03Y7SsBd8uvtX905IyTKr1Vqh71LKVg3y3Xm0wrAeCWq6q5 WmiUSOAyHPDuiC7YuYRCEqva0zTi5vBrZ4sDQT0uQ/p4JRLG6orIZWeDYqD+n4jE OsFGnAGU7MGKoePElrxWecalxxrQg3Bd1rhp3+BbjKuSb+c43RjN6NflaExTER8S kV8iXAheHhm/IE8JXjwuNHnWHx6PDe4tVyURVaaW8GSgkCXbqyCAwFV1CKxlTlWn Vw6zW2S1K67Ffd7nsO4Z =K5zX -END PGP SIGNATURE- - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: How to access Sessions outside of class
No, it is external as in it is running in a daemon on a linux machine where the tomcat server is also running. On Tue, Oct 28, 2014 at 4:35 AM, Johan Compagner jcompag...@servoy.com wrote: I would like to be able to access my sessions from an external java class, however each time I do sessionList.getsize() it keeps coming back as 0, but there is an active sessions. Is there any way I can access the active sessions in tomcat from an external java class? Jason What is an external java class? Is it in the same class loader? so it is just part of the webapplication? then the above approach should work fine -- Johan Compagner Servoy
Re: How to access Sessions outside of class
Martin, I can not use hazelcast due to regulations I have to abide by, is where any other built in way besides sockets that will allow me to share data between the two processes? On Tue, Oct 28, 2014 at 8:24 AM, Martin Grigorov martin.grigo...@gmail.com wrote: Hi, In this case you will have to share the data between the processes. A simple and easy solution would be to use http://hazelcast.com/, for example. On Tue, Oct 28, 2014 at 2:06 PM, Jason Ricles jgr...@alum.lehigh.edu wrote: No, it is external as in it is running in a daemon on a linux machine where the tomcat server is also running. On Tue, Oct 28, 2014 at 4:35 AM, Johan Compagner jcompag...@servoy.com wrote: I would like to be able to access my sessions from an external java class, however each time I do sessionList.getsize() it keeps coming back as 0, but there is an active sessions. Is there any way I can access the active sessions in tomcat from an external java class? Jason What is an external java class? Is it in the same class loader? so it is just part of the webapplication? then the above approach should work fine -- Johan Compagner Servoy
Re: How to access Sessions outside of class
Ok so here is the problem I have been spinning my wheels on for day let me just lay it out. I have a daemon written in java running lets call it foo for simpleness on a linux machine that has the tomcat server running. On the tomcat server is a WAR file for a webapp called bar. In that webapp is a webpage with JavaScript websocket communication that connects to a websocket server that is also a part of the WAR file. So I have a webpage and a websocket server communicating with each other. I want the foo daemon and the websocket server on bar (web application) to be able to communicate with each other. Is there any way outside of sockets to have foo and the websocket server on bar do this? On Tue, Oct 28, 2014 at 8:59 AM, Martin Grigorov martin.grigo...@gmail.com wrote: On Tue, Oct 28, 2014 at 2:51 PM, Jose María Zaragoza demablo...@gmail.com wrote: 2014-10-28 13:44 GMT+01:00 Jason Ricles jgr...@alum.lehigh.edu: Martin, I can not use hazelcast due to regulations I have to abide by, is where any other built in way besides sockets that will allow me to share data between the two processes? You could use an embedded ( or not ) messaging broker ( like ActiveMQ ) . Or any kind of in-memory database But this will be again socket based communication. Let's start from the beginning: What is your use case ? What value will have a deserialized session in the second process ? On Tue, Oct 28, 2014 at 8:24 AM, Martin Grigorov martin.grigo...@gmail.com wrote: Hi, In this case you will have to share the data between the processes. A simple and easy solution would be to use http://hazelcast.com/, for example. On Tue, Oct 28, 2014 at 2:06 PM, Jason Ricles jgr...@alum.lehigh.edu wrote: No, it is external as in it is running in a daemon on a linux machine where the tomcat server is also running. On Tue, Oct 28, 2014 at 4:35 AM, Johan Compagner jcompag...@servoy.com wrote: I would like to be able to access my sessions from an external java class, however each time I do sessionList.getsize() it keeps coming back as 0, but there is an active sessions. Is there any way I can access the active sessions in tomcat from an external java class? Jason What is an external java class? Is it in the same class loader? so it is just part of the webapplication? then the above approach should work fine -- Johan Compagner Servoy - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: How to access Sessions outside of class
Does it matter that foo will not be running on a server? It will be running as a standalone on the machine, unaware of tomcat basically. On Tue, Oct 28, 2014 at 9:36 AM, Martin Grigorov mgrigo...@apache.org wrote: On Tue, Oct 28, 2014 at 3:06 PM, Jason Ricles jgr...@alum.lehigh.edu wrote: Ok so here is the problem I have been spinning my wheels on for day let me just lay it out. I have a daemon written in java running lets call it foo for simpleness on a linux machine that has the tomcat server running. On the tomcat server is a WAR file for a webapp called bar. In that webapp is a webpage with JavaScript websocket communication that connects to a websocket server that is also a part of the WAR file. So I have a webpage and a websocket server communicating with each other. I want the foo daemon and the websocket server on bar (web application) to be able to communicate with each other. Is there any way outside of sockets to have foo and the websocket server on bar do this? You can use any Java WebSocket client in foo to send its own requests to bar's web socket server. This way it is yet another Session. And foo can communicate with the page's client. On Tue, Oct 28, 2014 at 8:59 AM, Martin Grigorov martin.grigo...@gmail.com wrote: On Tue, Oct 28, 2014 at 2:51 PM, Jose María Zaragoza demablo...@gmail.com wrote: 2014-10-28 13:44 GMT+01:00 Jason Ricles jgr...@alum.lehigh.edu: Martin, I can not use hazelcast due to regulations I have to abide by, is where any other built in way besides sockets that will allow me to share data between the two processes? You could use an embedded ( or not ) messaging broker ( like ActiveMQ ) . Or any kind of in-memory database But this will be again socket based communication. Let's start from the beginning: What is your use case ? What value will have a deserialized session in the second process ? On Tue, Oct 28, 2014 at 8:24 AM, Martin Grigorov martin.grigo...@gmail.com wrote: Hi, In this case you will have to share the data between the processes. A simple and easy solution would be to use http://hazelcast.com/ , for example. On Tue, Oct 28, 2014 at 2:06 PM, Jason Ricles jgr...@alum.lehigh.edu wrote: No, it is external as in it is running in a daemon on a linux machine where the tomcat server is also running. On Tue, Oct 28, 2014 at 4:35 AM, Johan Compagner jcompag...@servoy.com wrote: I would like to be able to access my sessions from an external java class, however each time I do sessionList.getsize() it keeps coming back as 0, but there is an active sessions. Is there any way I can access the active sessions in tomcat from an external java class? Jason What is an external java class? Is it in the same class loader? so it is just part of the webapplication? then the above approach should work fine -- Johan Compagner Servoy - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: How to access Sessions outside of class
Communicate means something happens that the daemon is monitoring, so thus the daemon sends a message to the websocket server running on the webapp, so that message can get relayed to the webpage from the server and the daemon will also need to get messages from the webapp. It will then be two way and just regular messages. On Tue, Oct 28, 2014 at 9:42 AM, chris derham ch...@derham.me.uk wrote: On 28 October 2014 11:06, Jason Ricles jgr...@alum.lehigh.edu wrote: Ok so here is the problem I have been spinning my wheels on for day let me just lay it out. I have a daemon written in java running lets call it foo for simpleness on a linux machine that has the tomcat server running. On the tomcat server is a WAR file for a webapp called bar. In that webapp is a webpage with JavaScript websocket communication that connects to a websocket server that is also a part of the WAR file. So I have a webpage and a websocket server communicating with each other. I want the foo daemon and the websocket server on bar (web application) to be able to communicate with each other. Is there any way outside of sockets to have foo and the websocket server on bar do this? Define communicate - what kind? One way, two way, what kind of data, frequency, size, type? Chris - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: How to access Sessions outside of class
I can not using anything outside of tomcat to accomplish this, due anything outside of tomcat being on an approved list. On Tue, Oct 28, 2014 at 9:51 AM, Martin Grigorov mgrigo...@apache.org wrote: On Tue, Oct 28, 2014 at 3:38 PM, Jason Ricles jgr...@alum.lehigh.edu wrote: Does it matter that foo will not be running on a server? It will be running as a standalone on the machine, unaware of tomcat basically. http://enable-cors.org/ should be enough to allow external clients. On Tue, Oct 28, 2014 at 9:36 AM, Martin Grigorov mgrigo...@apache.org wrote: On Tue, Oct 28, 2014 at 3:06 PM, Jason Ricles jgr...@alum.lehigh.edu wrote: Ok so here is the problem I have been spinning my wheels on for day let me just lay it out. I have a daemon written in java running lets call it foo for simpleness on a linux machine that has the tomcat server running. On the tomcat server is a WAR file for a webapp called bar. In that webapp is a webpage with JavaScript websocket communication that connects to a websocket server that is also a part of the WAR file. So I have a webpage and a websocket server communicating with each other. I want the foo daemon and the websocket server on bar (web application) to be able to communicate with each other. Is there any way outside of sockets to have foo and the websocket server on bar do this? You can use any Java WebSocket client in foo to send its own requests to bar's web socket server. This way it is yet another Session. And foo can communicate with the page's client. On Tue, Oct 28, 2014 at 8:59 AM, Martin Grigorov martin.grigo...@gmail.com wrote: On Tue, Oct 28, 2014 at 2:51 PM, Jose María Zaragoza demablo...@gmail.com wrote: 2014-10-28 13:44 GMT+01:00 Jason Ricles jgr...@alum.lehigh.edu : Martin, I can not use hazelcast due to regulations I have to abide by, is where any other built in way besides sockets that will allow me to share data between the two processes? You could use an embedded ( or not ) messaging broker ( like ActiveMQ ) . Or any kind of in-memory database But this will be again socket based communication. Let's start from the beginning: What is your use case ? What value will have a deserialized session in the second process ? On Tue, Oct 28, 2014 at 8:24 AM, Martin Grigorov martin.grigo...@gmail.com wrote: Hi, In this case you will have to share the data between the processes. A simple and easy solution would be to use http://hazelcast.com/ , for example. On Tue, Oct 28, 2014 at 2:06 PM, Jason Ricles jgr...@alum.lehigh.edu wrote: No, it is external as in it is running in a daemon on a linux machine where the tomcat server is also running. On Tue, Oct 28, 2014 at 4:35 AM, Johan Compagner jcompag...@servoy.com wrote: I would like to be able to access my sessions from an external java class, however each time I do sessionList.getsize() it keeps coming back as 0, but there is an active sessions. Is there any way I can access the active sessions in tomcat from an external java class? Jason What is an external java class? Is it in the same class loader? so it is just part of the webapplication? then the above approach should work fine -- Johan Compagner Servoy - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: How to access Sessions outside of class
I am looking at it but am having trouble seeing the connection, do you care to expand on how it can be used other then for the http request? On Tue, Oct 28, 2014 at 10:00 AM, Martin Grigorov mgrigo...@apache.org wrote: On Tue, Oct 28, 2014 at 3:54 PM, Jason Ricles jgr...@alum.lehigh.edu wrote: I can not using anything outside of tomcat to accomplish this, due anything outside of tomcat being on an approved list. CORS is not yet another software. Read in the web about it. On Tue, Oct 28, 2014 at 9:51 AM, Martin Grigorov mgrigo...@apache.org wrote: On Tue, Oct 28, 2014 at 3:38 PM, Jason Ricles jgr...@alum.lehigh.edu wrote: Does it matter that foo will not be running on a server? It will be running as a standalone on the machine, unaware of tomcat basically. http://enable-cors.org/ should be enough to allow external clients. On Tue, Oct 28, 2014 at 9:36 AM, Martin Grigorov mgrigo...@apache.org wrote: On Tue, Oct 28, 2014 at 3:06 PM, Jason Ricles jgr...@alum.lehigh.edu wrote: Ok so here is the problem I have been spinning my wheels on for day let me just lay it out. I have a daemon written in java running lets call it foo for simpleness on a linux machine that has the tomcat server running. On the tomcat server is a WAR file for a webapp called bar. In that webapp is a webpage with JavaScript websocket communication that connects to a websocket server that is also a part of the WAR file. So I have a webpage and a websocket server communicating with each other. I want the foo daemon and the websocket server on bar (web application) to be able to communicate with each other. Is there any way outside of sockets to have foo and the websocket server on bar do this? You can use any Java WebSocket client in foo to send its own requests to bar's web socket server. This way it is yet another Session. And foo can communicate with the page's client. On Tue, Oct 28, 2014 at 8:59 AM, Martin Grigorov martin.grigo...@gmail.com wrote: On Tue, Oct 28, 2014 at 2:51 PM, Jose María Zaragoza demablo...@gmail.com wrote: 2014-10-28 13:44 GMT+01:00 Jason Ricles jgr...@alum.lehigh.edu : Martin, I can not use hazelcast due to regulations I have to abide by, is where any other built in way besides sockets that will allow me to share data between the two processes? You could use an embedded ( or not ) messaging broker ( like ActiveMQ ) . Or any kind of in-memory database But this will be again socket based communication. Let's start from the beginning: What is your use case ? What value will have a deserialized session in the second process ? On Tue, Oct 28, 2014 at 8:24 AM, Martin Grigorov martin.grigo...@gmail.com wrote: Hi, In this case you will have to share the data between the processes. A simple and easy solution would be to use http://hazelcast.com/ , for example. On Tue, Oct 28, 2014 at 2:06 PM, Jason Ricles jgr...@alum.lehigh.edu wrote: No, it is external as in it is running in a daemon on a linux machine where the tomcat server is also running. On Tue, Oct 28, 2014 at 4:35 AM, Johan Compagner jcompag...@servoy.com wrote: I would like to be able to access my sessions from an external java class, however each time I do sessionList.getsize() it keeps coming back as 0, but there is an active sessions. Is there any way I can access the active sessions in tomcat from an external java class? Jason What is an external java class? Is it in the same class loader? so it is just part of the webapplication? then the above approach should work fine -- Johan Compagner Servoy - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: How to access Sessions outside of class
Yes we are trying to portable, well the socket is the last resort. We are trying to avoid it until now but will go that way if we have to if there is no other way. Mostly due to the data coming in and out writing our own socket will be complex but doable. As far as messaging broker, they are not approved for use on our system so thus can not be used. On Tue, Oct 28, 2014 at 10:13 AM, Tim Watts t...@cliftonfarm.org wrote: On Linux/Unix you could use a FIFO (aka named pipe) and have each side connect to it with a stream. But that's non-portable and probably not too elegant/robust. What's the problem with using a socket? Or better yet, a message broker like ActiveMQ like someone else has already suggested? On Tue, 2014-10-28 at 09:46 -0400, Jason Ricles wrote: Communicate means something happens that the daemon is monitoring, so thus the daemon sends a message to the websocket server running on the webapp, so that message can get relayed to the webpage from the server and the daemon will also need to get messages from the webapp. It will then be two way and just regular messages. On Tue, Oct 28, 2014 at 9:42 AM, chris derham ch...@derham.me.uk wrote: On 28 October 2014 11:06, Jason Ricles jgr...@alum.lehigh.edu wrote: Ok so here is the problem I have been spinning my wheels on for day let me just lay it out. I have a daemon written in java running lets call it foo for simpleness on a linux machine that has the tomcat server running. On the tomcat server is a WAR file for a webapp called bar. In that webapp is a webpage with JavaScript websocket communication that connects to a websocket server that is also a part of the WAR file. So I have a webpage and a websocket server communicating with each other. I want the foo daemon and the websocket server on bar (web application) to be able to communicate with each other. Is there any way outside of sockets to have foo and the websocket server on bar do this? Define communicate - what kind? One way, two way, what kind of data, frequency, size, type? Chris - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: How to access Sessions outside of class
Thanks Tim, That seems like the way to go. IT avoids us having to write our own protocols and everything and instead just code the logic for what action to take when a certain message is received. On Tue, Oct 28, 2014 at 10:27 AM, Tim Watts t...@cliftonfarm.org wrote: Any IPC that you have to write from scratch is going have a not insignificant level of complexity whether it's raw sockets, pipes, http, whatever. Since it sounds like you can't introduce any additional software packages, you might want to consider using RMI (see the java.rmi package). At least then, you're coding to an API instead of having to invent message formats and protocols. On Tue, 2014-10-28 at 10:16 -0400, Jason Ricles wrote: Yes we are trying to portable, well the socket is the last resort. We are trying to avoid it until now but will go that way if we have to if there is no other way. Mostly due to the data coming in and out writing our own socket will be complex but doable. As far as messaging broker, they are not approved for use on our system so thus can not be used. On Tue, Oct 28, 2014 at 10:13 AM, Tim Watts t...@cliftonfarm.org wrote: On Linux/Unix you could use a FIFO (aka named pipe) and have each side connect to it with a stream. But that's non-portable and probably not too elegant/robust. What's the problem with using a socket? Or better yet, a message broker like ActiveMQ like someone else has already suggested? On Tue, 2014-10-28 at 09:46 -0400, Jason Ricles wrote: Communicate means something happens that the daemon is monitoring, so thus the daemon sends a message to the websocket server running on the webapp, so that message can get relayed to the webpage from the server and the daemon will also need to get messages from the webapp. It will then be two way and just regular messages. On Tue, Oct 28, 2014 at 9:42 AM, chris derham ch...@derham.me.uk wrote: On 28 October 2014 11:06, Jason Ricles jgr...@alum.lehigh.edu wrote: Ok so here is the problem I have been spinning my wheels on for day let me just lay it out. I have a daemon written in java running lets call it foo for simpleness on a linux machine that has the tomcat server running. On the tomcat server is a WAR file for a webapp called bar. In that webapp is a webpage with JavaScript websocket communication that connects to a websocket server that is also a part of the WAR file. So I have a webpage and a websocket server communicating with each other. I want the foo daemon and the websocket server on bar (web application) to be able to communicate with each other. Is there any way outside of sockets to have foo and the websocket server on bar do this? Define communicate - what kind? One way, two way, what kind of data, frequency, size, type? Chris - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: How to access Sessions outside of class
Chris, foo has to run as a daemon outside of tomcat. It will be interacting with low level drivers through jni. I was looking at trying to do that with making a client endpoint in my daemon but i was having trouble getting it to connect to the websocket server. On Tue, Oct 28, 2014 at 12:21 PM, Christopher Schultz ch...@christopherschultz.net wrote: -BEGIN PGP SIGNED MESSAGE- Hash: SHA256 Jason, On 10/28/14 9:06 AM, Jason Ricles wrote: Ok so here is the problem I have been spinning my wheels on for day let me just lay it out. I have a daemon written in java running lets call it foo for simpleness on a linux machine that has the tomcat server running. On the tomcat server is a WAR file for a webapp called bar. In that webapp is a webpage with JavaScript websocket communication that connects to a websocket server that is also a part of the WAR file. So I have a webpage and a websocket server communicating with each other. I want the foo daemon and the websocket server on bar (web application) to be able to communicate with each other. Is there any way outside of sockets to have foo and the websocket server on bar do this? Dumb question: why can't foo just be a Websocket client? Make a ws:// connection to your web application in Tomcat and then two-way communication is possible. Take whatever values from either side and push them over the wire. Use JSON or something dirt-simple as your data encapsulation language: it's standard, well-understood, and has parsers and serializers readily available for many different languages. It's also pretty much backward- and forward-compatible since everything is pretty much a named value map, so you can add/subtract fields at will without having to rewrite the communication protocol or do a lot of extra work in either the client or the server. - -chris On Tue, Oct 28, 2014 at 8:59 AM, Martin Grigorov martin.grigo...@gmail.com wrote: On Tue, Oct 28, 2014 at 2:51 PM, Jose María Zaragoza demablo...@gmail.com wrote: 2014-10-28 13:44 GMT+01:00 Jason Ricles jgr...@alum.lehigh.edu: Martin, I can not use hazelcast due to regulations I have to abide by, is where any other built in way besides sockets that will allow me to share data between the two processes? You could use an embedded ( or not ) messaging broker ( like ActiveMQ ) . Or any kind of in-memory database But this will be again socket based communication. Let's start from the beginning: What is your use case ? What value will have a deserialized session in the second process ? On Tue, Oct 28, 2014 at 8:24 AM, Martin Grigorov martin.grigo...@gmail.com wrote: Hi, In this case you will have to share the data between the processes. A simple and easy solution would be to use http://hazelcast.com/, for example. On Tue, Oct 28, 2014 at 2:06 PM, Jason Ricles jgr...@alum.lehigh.edu wrote: No, it is external as in it is running in a daemon on a linux machine where the tomcat server is also running. On Tue, Oct 28, 2014 at 4:35 AM, Johan Compagner jcompag...@servoy.com wrote: I would like to be able to access my sessions from an external java class, however each time I do sessionList.getsize() it keeps coming back as 0, but there is an active sessions. Is there any way I can access the active sessions in tomcat from an external java class? Jason What is an external java class? Is it in the same class loader? so it is just part of the webapplication? then the above approach should work fine -- Johan Compagner Servoy - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org -BEGIN PGP SIGNATURE- Version: GnuPG v1 Comment: GPGTools - http://gpgtools.org iQIcBAEBCAAGBQJUT8KOAAoJEBzwKT+lPKRYb44P/iPtg+Y0SKMzyzOwrcM+dOuZ jy2AqLPKRlUNQFVja+HxKfQcgKCrsOxvFHo2RrnUVTsgbjCNPJXR7eIWpBluTsgv wyQKjC0m1q7hYoEE4us86wjQiAG4c+KAD/RwX9hljOoFqW4BSBVi0SHaaqgJV486 ACabJmaXdmfgkzkerEfHEbQmNR39C8jTVT0yrZg2kGLW8Y8BcbFjLQXFK0pTbgYT zyiTWzF848Fw+KAg9w8H5s6EhvIcJtNkGmhq3wU9msdvF4mp9+mWnsPfdhGVIvQ8 T3FP+zsBH+mhz+/Y0Id6jr1nmH2a+qvaNe82V23dyAYB+xqPsOmjQ41exRrwo+ZU PO4wnLSeAM1j96fav0DU5OEcBI4JM+r9uaZZX4dOaPAX3+NHEuB0ZYjqdbcrZtGC 535YMNLtDgylnRIY/pGzd8F7EcxUNGrZB82xbibPY45wvVj76x5CPwQ3lZNVUzTm mZdTkcmrD51Ujpdsq+g8TtLuYzrMUklo/We6cuhVc7gLS3nEw/hiJqGuyWEhDf9c 4YXAeEaLAZQjznSAn2yJUF1DI8BRHaD5mpFCvb/N7W6/1G7GtjUY5zJgQ0XEHenn MAwKbkssQr3BouACcQzDqlH1FYqBve8D0fyMZsq62xFrBg61nbZQVzzZoF0vWNH2 VWQ85hKZbLt+ew90h1mz =seU1 -END PGP SIGNATURE- - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
How to access Sessions outside of class
I have the following code for a web-socket package comm2.hello; import java.io.IOException; import java.util.ArrayList; import javax.websocket.OnClose; import javax.websocket.OnMessage; import javax.websocket.OnOpen; import javax.websocket.Session; import javax.websocket.server.ServerEndpoint; import org.apache.catalina.session.*; @ServerEndpoint(value = /echo) public class wschat { public static ArrayListSession sessionList = new ArrayListSession(); public Session session; @OnOpen public void onOpen(Session session) throws IOException { sessionList.add(session); int size = sessionList.size(); session.getBasicRemote().sendText(String.valueOf(size)); } @OnMessage public void onMessage(String message, Session session) throws IOException { session.getBasicRemote().sendText(message); } } I would like to be able to access my sessions from an external java class, however each time I do sessionList.getsize() it keeps coming back as 0, but there is an active sessions. Is there any way I can access the active sessions in tomcat from an external java class? Jason
tomcat websocket communication with external java program
I have a tomcat webpage with a websocket server written in java to communicate with the webpage. I want this websocket server to be able to communicate with an external java program without an sockets, so something like this webpagewebsocket serverexternal java program However I am having trouble getting that to work, since to use the websocket server I need to make an instance of it and thus it thinks there are no session. So currently I have done it the following way webpage-websocket server--socket---external java program This is kinda messy however, so is there some way to get my external java program and my webpage to communicate through websockets without a socket go between?
embedded tomcat Defense Information Systems Agency
Does anyone happen to know if embedded tomcat is in Defense Information Systems Agency list? I know regular tomcat is but I have a need to use embedded tomcat for what I need to accomplish. Jason Ricles
DISA compliance tomcat 7.0.53
Where can I find a checklist so that I may make my tomcat server DISA compliant? -- Jason Ricles Jr Software Engineer Mikros Systems Corp