开发者

Passing request object to different servlet/action of same application running at different servers

开发者 https://www.devze.com 2022-12-11 09:25 出处:网络
Hi I have one application running on different servers build in struts2开发者_JS百科 and deployed in Tomcat5. Now I have a functionality of \"Save on All\" in this application. When it is called, then

Hi I have one application running on different servers build in struts2开发者_JS百科 and deployed in Tomcat5. Now I have a functionality of "Save on All" in this application. When it is called, then the same request parameters need to be passed to all the servlet/action of all the applications running in all the servers. How can this be done?


E.g. I have 5 servers in LAN, each having independent tomcat & mysql. The application is deployed in each tomcat. Now if I upload an image from application running on any server, it should be uploaded to all the servers.


I'd use something like the Apache HttpClient library. However, beware: depending on your application, a failure on just one of several servers may leave things in a weird state. I'd test this thoroughly if I were you, including by unplugging network cables.


The solution lies entirely elsewhere. You certainly do not want to solve it at the webinterface level. You need to solve it at the server software level. The application servers needs to run in a clustered environment, all sharing the same data. Here's the Tomcat 5.5 document which describes how to do it: http://tomcat.apache.org/tomcat-5.5-doc/cluster-howto.html

Similar exist for database servers, but as you didn't mention if and if so which one you're using I can't give a link to detailed documentation how to do it. You now at least know the search keyword "cluster".

Good luck.


From your further comments, I think you're going about this entirely the wrong way. If you need an image, don't duplicate it; make a simple service that stores images and call it from your other apps. This is known as a service-oriented architecture. (Under that name, you'll hear a lot of enterprise blah-blah; ignore that, and the SOA products out there. Just make a simple app that lets you POST pictures and GET them again later.)

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号