why we need ejb (explain with com/dcom/corba)


EJB design: why we need ejb (explain with com/dcom/corba)

  1. hai from raja,
    i need the explanation of why we need ejb,
    compare with com/dcom/corba what are the
    additional features available in ejb.
    please explain.
  2. raj,

    all of the technologies u have mentioned are used to write componentised applications. now these applications can be distributed or running on the same box. DCOM and CORBA are more for distributed computing.

    EJB(part of J2EE) is basically a framework(specification) defined by sun for writing component based distributed applications. by framework what essentially sun has done is defined certian set of API's in form of abstract interfaces and you as a developer conform to those standards and develop your components. since EJB is only interfaces the runtime/implementation of these interfaces is left to the container/application server vendors (weblogic,websphere etc.)

    one of the biggest advantages EJB has is that its just interfaces built on top of java language, which makes it platform independent. unlike COM which is tied to MS operating systems. in fact microsoft to an extent has realised it and is kinda giving up on COM with the introductiion of .net. so when u write ur components in .net u r encouraged not to use COM specifics.

    the application vendors can write these containers/application servers for any platform and not just one specific platform. and since ur EJB components conform to the EJB standards/interfaces u can port these components on any application server without changing any code, unless and ofcourse if are using application server specific code.

    Now these application server which act as host for ur EJB components provide loads of features like Security, distributed transaction management, object-life cycle management etc. also when writing distributed application u as a application developer dont have to concerned with lower level network/distributed transaction/security programming n stuff. the application can use any protocol for network communication like RMI, CORBA, RMI/IIOP. tho sun will standardize on RMI/IIOP.

    COM as i mentioned earlier is a binary level protocol(which makes it more lower level and less compatible with other OS's) used for application/inter-process communication. in fact COM was originally created to provide for inter-process communication and less for componentised application. but with VB-5/6, COM became very popular for writing component based business applications. COM running over network is what essentially DCOM(Distributed COM) is. it is again a protocol for inter-process communication between two seperate boxes. DCOM is also used extensively along with MTS(host for COM objects). so if you think carefully COM/DCOM do not come in the same league as EJB.

    CORBA came in as a language-independent standard protocol for writing distributed componentised applications, where in u write ur components in any language and then abstract them out with specific IDL which is used by request brokers to locate these components and then call on them. in fact its again more of a protocol for network communication between these components. CORBA dint gain much industry attention as it shud have, i think partially coz of its complexity.

    in all EJB is better than all these technologies mainly because its backed by the JAVA language and also because of its ease of use. It’s the only comprehensive framework in the market which hits a lot of issues faced during componentised application development. I don’t want to get to the technical details , u might wanna check out java.sin.com/ejb. In case u have specific question do not hesitate to write to me(kapil_israni at yahoo dot com). Also EJB is backed by whole lot of technological companies(IBM, BEA, Oracle, Inprise – just to name a few) which I think really gives it, the edge. but then EJB is just part of the bigger initiative namely J2EE, which consists of host of other technologies which shud also help in influencing whatever technological decisions u wanna undertake.

  3. All is fine with your explanation but what about the client? The server side components are okay but does that mean we have to stay with Java at the client as well?

    The major advantage COM+ (though discontinued) is that it allows the developers to use the Window based languages to have a rich GUI and the supporting back-end. I agree it may not be as powerful as EJB but we always have to make trade offs, don't we?

    I was researching hte idea of using EJB components in the middle tier with the VB/Delphi art the client in a 3-tier development but I have not come across any suitable solutions. Openion?

  4. rajesh,

    weblogic comes with examples where in u can use VB as the client to ur ejb clients. basically weblogic provides a COM based wrapper for talking to ejb components. so any COM compliant language including delphi, vbscript can be used.

    about EJB being more powerful. i dont know what u mean. but if u are talkin bout speed, then i think a ASP/COM/MTS based solution with the introduction of MS cluster service is as powerful, if not more, as EJB.

    but yes when it comes to EJB/J2EE its definitely a more comprehensive and rich framework for enterprise development.

    good luck

    Set WebLogic = GetObject("java:weblogic.com.Tengah")
    Set ctx = WebLogic.getInitialContext(URL.Text)
    Set broker = ctx.lookup("beanManaged.AccountHome")
    Set pk = GetObject("java:examples.ejb.beanManaged.interfaces.AccountPK")
    pk.accountId = AccountNum.Text
    Set account = broker.findByPrimaryKey(pk)
  5. Thanks for saying that I was right...I have just a small problem here...weblogic is too big a server to be used for a product development. Do you know any other applciation servers that has a small footprint and give the COM proxies for the EJB components?

    I was also trying to find some resources on the web in this regard but couldn't find one. Can you suggest some sites?

  6. Another approach is to use SOAP, which for example MS has chosen for it's next generation .NET platform. For a lightweight free J2EE server, check out JBOSS, www.jboss.org. At the site you can find a component to expose the EJB:s as SOAP services.
    For Delphi, you can download a free SOAP client library at
  7. Thanks for the info..I'll sure have a look at it.