Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to write a deployable services in Spring like EJB jar?

 
Siva Prasad Reddy Katamreddy
Ranch Hand
Posts: 32
Eclipse IDE Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

We are planning to develop a web application following 3-tier architecture.
The web application will be deployed on Tomcat Server and I want to write my Services as POJO Services and wire them up using Spring and will be deployed on a JBoss server probably on some other machine. My DB server(MySQL) will be on some other machine.

Now my question is when we develop our service layer using EJB's we will make a jar file and put it in deploy(jboss) folder and when the JBoss server is started it will automatically scan through the jar and EJBs will be created by the JBoss itself. Now i can get an EJB by doing a JNDI lookup.

Now if i write my service layer using Spring POJO approach, i have my services ready (as a jar file) how can deploy/use these services from some other JVM/webapplication?

Thanks.
 
Nathan Pruett
Bartender
Posts: 4121
IntelliJ IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You'd have to expose them using some sort of remoting technology or web services.
 
Siva Prasad Reddy Katamreddy
Ranch Hand
Posts: 32
Eclipse IDE Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

But even though we use Spring Remoting we should deploy the Spring Service jar file either in a .war or in a .ear file and in servlet startup we should instantiate the ApplicationContext. Am I right?

Thanks,
Siva
 
Nathan Pruett
Bartender
Posts: 4121
IntelliJ IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well, no matter what you have to start up the ApplicationContext in some way. And you would generally want run it as a web app (.war) or JEE app (.ear) because having a web/application server handles a lot of stuff (like deployment, administration, clustering, etc.) that you'd have to find another way to handle if you were making a stand alone app - but (unless the remoting mechanism requires running in a server) you can just make a standalone app that you could run as a service or command-line program.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic