Discussions

EJB design: Any Pattern for this Problem

  1. Any Pattern for this Problem (14 messages)

    The application I am working now is based on Service Oriented Architecture. All the services (Session bean and Entity Bean) will be deployed separate EARs. Another Facade layer(Session bean) going to talk to different services to process the request from GUI layer.This Facade layer is packaged in a separate EAR. The basic reason for Using separate EAR is that any time we can deploy and undeploy any of archive.Now the problem is that the facade layer need to make remote calles to each service component. I want avoid that.
    I am usign Weblogic 8.1. Any Good patern to fit this problem ?

    Threaded Messages (14)

  2. Pattern or statergy?[ Go to top ]

    We have a similar architecture and the strategy is that the first EJB call from the business delegate is remote and then on all EJBs (SSB/Entities) communicate/get invoked using local interfaces.
  3. Pattern or statergy?[ Go to top ]

    Since you have multiple ear I do not think you can get away from network. At least one session bean would use the RemoteHome, once you are in the ear you can use Local Home.

    Thx

    Dheeraj
  4. Pattern or statergy?[ Go to top ]

    Could you please give some more explanation on your solution?
    Does the deployment order of the components play a role?

    I have a similar situation, where two jar's are accessing each other.
    One of them (deployed first) have to use remote calls to make it
    work. All that because of the deployment order.

    Thanks,
    Michael
  5. Cmp2.0[ Go to top ]

    I am doing an application which I need to take the Registration of the user.I am useing CMP2.0. The CMP2.0 creating the row of user details in the database properly,but the problem create when the user want to update is details,CMP2.0 is notable to update the row.
             So how can i update a row by using CMP2.0? Any solution for this problem.wating for it
  6. Cmp2.0[ Go to top ]

    I hope you want to update the underline data through CMP entity bean.
    just use the set methods of the entity bean to update the data.
  7. from the ejb-jar dtd:


    lternatively, the name in the ejb-link element may be composed of a
    path name specifying the ejb-jar containing the referenced enterprise
    bean with the ejb-name of the target bean appended and separated from
    the path name by "#". The path name is relative to the ejb-jar file
    containing the enterprise bean that is referencing the enterprise bean.
    This allows multiple enterprise beans with the same ejb-name to be
    uniquely identified.

    Used in: ejb-local-ref, ejb-ref

    Examples:

    <ejb-link>EmployeeRecord</ejb-link>

    <ejb-link>../products/product.jar#ProductEJB</ejb-link>

    -->


    I have not tested this but ,it seems,a session bean in ear_1 can LINK to session bean ear_2.
    repeating again..have not tested.
  8. just to add.
    EJB-LINK can be used within EJB-LOCAL-REF so it should solve trouble of non-remotability-requirement
  9. can ejb-link solve the trouble[ Go to top ]

    Thanks, but it's not what I'm looking for. (I use the link-tags like in your answer)
    The problem is that there are two jar's which references each other.

    A.jar references B.jar
    B.jar references A.jar

    The one which is deployed first works only using remote access.
    Please don't tell me it's a design mistake.

    Everything works fine when I pack them in an ear but to deploy
    changed jar's I must redeploy the ear with all jar's in it.
    This can become very time consuming when a project grows.
    It's OK for production deployment but not at development time.

    We have this problem since few months and still no solution (we still use remote calls in such situations). The server is JBoss 3.x.
    A friend of mine asked this question on JBoss forum and did
    not get any answer.

    http://www.jboss.org/index.html?module=bb&op=viewtopic&t=19787

    Does anybody have any idea how to solve the problem?

    * Perhaps, this thread should be moved to the discussions forum. :)
  10. can ejb-link solve the trouble[ Go to top ]

    The problem is that there are two jar's which references each other.

    >
    > A.jar references B.jar
    > B.jar references A.jar
    >
    And as i understand A.jar is part of EAR_1 and B.jar is part of EAR_2.
    One idea: instead of using Manifest Reference declaration..copy the localHome/LocalEJBObject interfaces in each other's jar....
    then see whether that works or not..
  11. can ejb-link solve the trouble[ Go to top ]

    This is one of the simple solution. Just copy the Home and Remote in all the jar's. We have used this in the past and worked well. Although I do not thing that this is a recomended or good solution, the simple reason being you jar's are actually loosing its sanity. No offence, but you might just want to change your design for a better solution. :)
  12. can ejb-link solve the trouble[ Go to top ]

    agreed.
    a better structure can be :
    EAR_1\
          A.jar
          lib\BInterfaces.jar


    EAR_2\
          B.jar
          lib\AInterfaces.jar

    We PHYSICALLY need not to place classes in each other jar.but they needs to be in each other's classpath.!ok.
  13. RE: Design mistake[ Go to top ]

    Thanks, but it's not what I'm looking for. (I use the link-tags like in your answer)
    The problem is that there are two jar's which references each other.

    A.jar references B.jar
    B.jar references A.jar

    The one which is deployed first works only using remote access.
    Please don't tell me it's a design mistake.
    Well ... actually I think this is at least a design problem, if not a mistake. If there are circular references in two classes in general, this implies that there is a very tight coupling between those two classes. Additionally, it possibly creates race conditions similar to the problem of what was first, hen or egg. Thus, designing hierarchical applications and services are generally better because they do only depend on each other similar to a one-way street. HOWEVER, there may be a need for component A referencing B and vice versa if you do not want to build an application that is not monolithic and easily extensible. Therefore, you must decouple both components by possibly using a Subject-Observer pattern, like this:

    Component A is the main component in your system.

    Component B offers orthogonal services that are however needed by A (for example, B needs to be informed to act on certain states A can reach, and afterwards needs additional data from A).

    Instead of having A informing B directly, you introduce a central notfication center. Subjects can post notifications on actions taken, and observers can register to be informed on such notifications. Thus, if A reaches a certain state, it posts a notification, and B, formerly having registering itself for being informed for the particular notfication, gets informed by the notification center.

    greets,

       Dennis
  14. can ejb-link solve the trouble[ Go to top ]

    <snip>Everything works fine when I pack them in an ear but to deploy
    changed jar's I must redeploy the ear with all jar's in it.
    This can become very time consuming when a project grows.
    It's OK for production deployment but not at development time.</snip>

    Maybe I'm missing something here, but it looks like you could solve this problem with Ant. You could define a development build, a test build, an integration build and a production build. This allows you to build your components for the environment into which they will be deployed instead of trying to follow a one build fits all environments path.
  15. I think that this occurs because each JAR or EAR deployed is a separeted ClassLoader. So, they can't communicate like they were in the same VM using Local Interfaces... I had this problem and also no answer... any specialist in this subject, please?