• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Separate Web Tier and Business Logic tier.

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi all,

I'm trying to understand how I might put together an application where I have a number of web applications which all need to reuse common business logic. Rather than place the logic in each web application, I would like to create a separate tier (which could run on a separate machine).

Using spring in my web tier (inside Tomcat) is quite well documented and straightforward. My concern is how to run Spring in the middle tier, where ideally there won't be any Tomcat? How can one instantiate a Spring container in a standalone mode (and I'm not talking rich client here, I'm talking about on the server side). How could I, for example, construct a Spring container, which handled all my business objects and their persistence and ran as an NT (windows) service?

Has anyone constructed an architecture such as this? Which remoting protocol would be the most efficient for communications between the web tier (tomcat + spring) and the middle tier (spring standalone)? RMI?

Thanks for any assistance,
Dominic.
 
Ranch Hand
Posts: 264
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Dominic,

Since I do not have an exact idea of your environment, I'll try to give my general advise of what you're trying to do. DON'T.

Seperating the web and business tiers was one of the primary goals of the initial EJB servers (remember remote interfaces?) but this was quickly withdrawn because of the serialization, and networking costs. It is better to deploy them in vertical slices so that each application does have its own web, business logic, database tiers embedded. (This is an over generalization though!!!)

Anyways, if you HAVE TO separate your business logic tier into a seperate JVM, i strongly advise you NOT to do it all by your own. Run your business logic layer in a J2EE server and expose it by a Remote session EJB. Trying to run the business logic layer outside of a J2EE container in this case will suck you into creating and maintaining your resources like JDBC connection pools, threading issues, scalability issues, two phase commit ?? issues etc.

And, one of the beauties of spring is the ability to instantiate the container in ANY tier. There are a lot of books/references about how to start a spring container outside the scope of a web container.
[ May 16, 2005: Message edited by: Dushy Inguva ]
 
Ranch Hand
Posts: 2166
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Also its good idea to separate concepts of layers and tiers.
Tiers means different JVM (mostly different maschine).
This might lead to bad performance due to network latency, aditional cost through (de)-serialization, etc..
Layers is slightly different from tiers. It means logical units.
I second that business logic layer should be separated from web layer.
If you can call all your business logic use cases from command line both layers are separated. There are calls from web layer to business layer, but no calls from business layer to web layer.
If you really want to deploy your layers on different tiers it should be easy task, if the layers are separated. But only do that if there are real reason to do so and don't forget the costs which results from the separation of tiers.
[ May 20, 2005: Message edited by: Axel Janssen ]
 
reply
    Bookmark Topic Watch Topic
  • New Topic