Re: How to access Sessions outside of class
-BEGIN PGP SIGNED MESSAGE- Hash: SHA256 Jason, On 10/29/14 2:01 PM, Jason Ricles wrote: 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. I think your problem is not ignorance of Tomcat or even Websockets, but perhaps Java itself. You should find a good Java programmer to help you with this, preferably someone with familiarity with Websocket. If you want to go it alone, grab the source for Tomcat and look at some of the unit tests that involve Websocket. I haven't looked myself, but I'll bet there's at least one unit test with a Java-based client that connects to a Tomcat and exchanges a few messages. Good luck, - -chris On Wed, Oct 29, 2014 at 1:47 PM, Christopher Schultz ch...@christopherschultz.net wrote: 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 - 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 iQIcBAEBCAAGBQJUUknaAAoJEBzwKT+lPKRYhhQQAMA/zavChbnv7qO1q0KhZaHe VJABne/mhOEZM+Ot7N+Qyc1yaq6iO7dnoN6Zy8XzK1lqYrhPBAqFJWsEJqMtOKK8 bE/zzsIC25xOjXq0NcH6yLxo846mR6mPLyzDAK9KPNDAEeRRnBGZuiBQjA2VLppp kSArdp8s6Z+JU3zCv5tkLA6ybDSvu1Mz2u/NjWeLl8RfaHgFOm4+TrPR+o0Mor4p PKx37BfEdr0y8PkAKsweqMVFLDMvrHImEPAe0EkYcpajW4SOvI4ebvekBabfW77S D6cL1zommbyMICHoDulGN7JYx3nOlQJ2MMpRmyWW2KMHJjHEWYXpXivmHqwrbEvl ofAgByuzmIZao/xFznOSpFKODpETcGSHI/Y7HnSc0H58zpGT/1LiZ7CM/htx8F4c L7xklGMjHGeXiZv1aMvAYriwgx5zNgwV36Ky0UOOg9ZGoGtklziWNVB6VsgMjSf0 1N/oYSmBo+LOAs2i/+3ghhWVkV1LrznN8OWe3HH5gHLUkL9Vh4yoFUJKMft9y5Zn PFJ0SHr5zGyV8SI9cueS3auoa8hJ+Q8MmYTCxuD9+536327CXOGr6f/8XJVfpT7s BJbNbzqFB9tL136jcze8UDdRLc0Ilj1A5xDf4PiN+h6E+BcSLr6mxDX2Yn7rH8YT Ez5mppLdADCBYdwlZbJ0 =VrJi -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
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 - To
Re: How to access Sessions outside of class
Hi, On Wed, Oct 29, 2014 at 2:28 PM, Jason Ricles jgr...@alum.lehigh.edu wrote: 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 I think it is time to give us more details (and even show some code) about your trials. Which library do you use as a WebSocket client at foo ? What kind of error do you see when trying to connect ? Etc. 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
Re: How to access Sessions outside of class
On Wed, 2014-10-29 at 08:28 -0400, Jason Ricles wrote: 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. A java program can be a websocket client with out being a webapp. Perhaps this example will help: http://stackoverflow.com/questions/26452903/javax-websocket-client-simple-example You would need the JEE 7 websocket jar which presumably is included in Tomcat 8 -- or use the appropriate Maven dependencies. And as Chris pointed out, JSON is fairly ubiquitous and easy to deal with. RMI could work and is simple enough. There are a few downsides worth considering: 1) it's strictly java-to-java IPC, so no other technologies (e.g. .NET) can participate down the road; 2) it's not firewall friendly -- but that would only matter if there was a fw between foo and bar; 3) it's not hip and cool -- not sure how widely used it is anymore outside of EJB (do people still write EJBs?). Did you say earlier that foo would need to send unsolicited alerts at some point -- i.e. send alerts even when there's no client listening? That could possibly complicate the design in that I believe the ws server endpoint's life begins only in response to a client connection. (I'm thinking of the server endpoint for the browser here.) Thus such alerts would need to go somewhere until a client shows up wanting to see them (e.g. a database). And if that's the case why not send all of them there. Sounds like you may have some design issues to work out and we don't have enough details to be of much help. --tim. 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
Re: How to access Sessions outside of class
-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: 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: How to access Sessions outside of class
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
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
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
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
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 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
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
Can you simply serialize the data to disk in one process and read it in the other? On 10/28/2014 8:44 AM, Jason Ricles wrote: 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 - 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
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
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
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
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
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
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 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
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
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
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
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
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
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
Couldn't you have the daemon write to a database, and have the web app read from the database? Then you could pass whatever message you wanted as a string? 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
-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
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
Re: How to access Sessions outside of class
On 10/28/2014 9:36 AM, Jason Ricles wrote: 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. Hi, Jason- RMI seems reasonable if foo and bar might end up on different servers. However, if they will always reside on the same server, why not execute foo from within the web application? If you're polling, scheduling background threads is fairly straightforward. -Terence Bandoian 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 - 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
-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 - 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 iQIcBAEBCAAGBQJUUB7PAAoJEBzwKT+lPKRYRHMQALE7FFu/TAJ2RSJ9PFMBL0BZ tlfNH05K67/LeFRF+XXSkEXt6wtGiUyrWAqW0sMwzD53d+utzCeEAdBweIx+FqPN epMXNgPSmLWVYSRlCF1Cc5AjD2XIkxydifVHoGficH+EEvNN7Z+RboC3/H7VU1T+ bO0//oj7Tne+v8V/sgdH7vvW/3ERbncMQU60aLAIMxVkiFYhZH3tAoGZ1TGEBnd8 4fkxzCnJHF0hCvHhZqelVI1yvSBDQGGDPc8NFfoXyJ1UkM/MT1ALeqPogajm+yRy TEP5rSNCzfr4Vx2qr9BY577u9/4V2V2t0GxRjTcY5o4E/XSe37Cxzj0PdAxd/Rry s7hnBP0lQbSixNEoMURxxx1hq5KW2nAxhiBP/GsZGrT5u2QbMF1Ca5tW3pPCyBWn dWu/VT3i/fKbV9Sw64a2yr1rHUDUD3mg64nUp0DL49ZJV2aY6HOcdCH+y1I3PXLS