aspose file tools*
The moose likes Spring and the fly likes How to write a deployable services in Spring like EJB jar? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Spring
Bookmark "How to write a deployable services in Spring like EJB jar?" Watch "How to write a deployable services in Spring like EJB jar?" New topic
Author

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

Siva Prasad Reddy Katamreddy
Ranch Hand

Joined: Jun 06, 2007
Posts: 32

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

Joined: Oct 18, 2000
Posts: 4121

You'd have to expose them using some sort of remoting technology or web services.


-Nate
Write once, run anywhere, because there's nowhere to hide! - /. A.C.
Siva Prasad Reddy Katamreddy
Ranch Hand

Joined: Jun 06, 2007
Posts: 32

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

Joined: Oct 18, 2000
Posts: 4121

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.
 
jQuery in Action, 2nd edition
 
subject: How to write a deployable services in Spring like EJB jar?