my way is to define and start a thrift server inside a spring bean. So the thrift server is initialized during tomcat startup.but as the thrift server is on another port, it is kind unnecessary to put it onto tomcat. (Plus the embedded thrift server won't be restarted when you are deploying a new war file, which is annoying. ) It is better to keep it away from tomcat. On Apr 10, 2013 12:57 AM, "Denuwanthi Hasanthika" < [email protected]> wrote:
> Thanks for the information. > > As I understood, your ServerConfiguration.java class is where the > ThriftServer gets invoked. > Can you please tell me how/where is the > > https://github.com/sqlboy/plow/blob/master/server/src/main/java/com/breakersoft/plow/thrift/ServerConfiguration.java > > class is invoked? > > -Denuwanthi > > > On Wed, Apr 10, 2013 at 2:53 AM, Matthew Chambers <[email protected] > >wrote: > > > Doesn't really matter what servlet container you are using, you do it > > pretty much the same way. Since starting the server blocks you have to > > start it in a thread. > > > > Here is an example using Spring I did a long time ago, I'd probably do an > > anonymous runnable if I did it again. > > https://github.com/sqlboy/**plow/blob/master/server/src/** > > main/java/com/breakersoft/**plow/thrift/ThriftServer.java< > https://github.com/sqlboy/plow/blob/master/server/src/main/java/com/breakersoft/plow/thrift/ThriftServer.java > > > > https://github.com/sqlboy/**plow/blob/master/server/src/** > > main/java/com/breakersoft/**plow/thrift/**ServerConfiguration.java< > https://github.com/sqlboy/plow/blob/master/server/src/main/java/com/breakersoft/plow/thrift/ServerConfiguration.java > > > > > > A non spring example would just initialize and wrap the serve() function > > in a thread. > > > > -Matt > > > > > > > > On 09/04/13 21:51, Denuwanthi Hasanthika wrote: > > > >> Hi, > >> > >> I want to run a Thrift server inside Apache Tomcat server. > >> As for now, I implemented a Thrift Server and tested it with clients > >> .*But, I want to know wether there is a way to deploy a Thrift Server > >> inside > >> Tomcat? .* > >> *If not, is there a way to run a Thrift server inside a servlet deployed > >> in > >> Tomcat?.* > >> > >> I tried doing that by calling the Thrift Server inside the init() > method > >> of the servlet. But, didn't work. I use Eclipse IDE in my development > work > >> and configured Tomcat to run from Eclipse. > >> > >> > >> Thanks, > >> Denuwanthi > >> > >> > > >
