File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes EJB and other Java EE Technologies and the fly likes Java application using EJB Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "Java application using EJB" Watch "Java application using EJB" New topic

Java application using EJB

Sriram Sankar

Joined: Mar 01, 2001
Posts: 22
Hello All,
We have to create a Java backend application which will need to run as a deamon. This would be running in parallel with a front end web based system using the same database.
Now, the question is, Can i have a java application sharing the same entity beans created and used by the Application server(we have IBM WAS 4.0.2).
Is there any special considerations that i need to keep in mind while designing this application.
Also, is there any site which i can refer to get more information on the best practices for designing EJBs.
Thanks in advance
Sriram Sankar
shai koren
Ranch Hand

Joined: Nov 04, 2001
Posts: 48
hi sariram
Can i have a java application sharing the same entity beans created and used by the Application server

There is, basicly, nothing wrong with ejbs being called by different applications ( local or remote ones using jndi) if it applies to your needs. in the case of entities the way you should look at it is an object presentation of your infrastraction, thus if you want different application to use same DataBase it is possible to do that.ideally you wont access the entities directly but call session beans as facade. I think that while the senario of different applications calling the entity beans sounds abit un healthy( even though possible strictly speaking) the senario of several web applications communicating with the same EJBs ( and maybe others as well , like third party's ) is a very nice way of implemanting the j2ee architecture
have a look at this:
Deciding whether EJB is appropriate

Shai koren<br />SCJP2 <br />SCEA (well yea only part 1 so far)
Hemal Mehta
Ranch Hand

Joined: Nov 16, 2000
Posts: 101
Check out for design patterns.
Also if you have any other application sharing the entity beans, definetely use the facade pattern to reduce the network traffice.
Also depending on how many web concurrent users you may have and also how heavily your backend application uses entity beans you may want to consider clustering with your WAS. I think it would all depend on how much load your background applications adds, how often it calls the entity beasn etc..
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 17417

One of the things that EJBs were designed to do was make it easy for multiple applications to share resources efficiently and in a co-ordinated way.
Please note though that if you're not resolving all EJB references from a single server (that is, the webserver it its own EJB serverand the external app gets EJBs from some other server, that those benefits are mainly lost, since the management is mostly done internal to the EJB server(s) - omitting the concept of clustering, anyway. In other words, usually you have the daemon app do its bean lookups to the JNDI port exposed by the web app server - WebSphere, in your case.

An IDE is no substitute for an Intelligent Developer.
I agree. Here's the link:
subject: Java application using EJB
It's not a secret anymore!