Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

access one EAR from another EAR

 
Raj Ohadi
Ranch Hand
Posts: 316
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Currently I have an "app1.ear" deployer to server. If I deploy another "app2.ear" to the same server. I want the code in app1.ear to access code in app2.ear, for example, from app1.ear code I want to call an action in app2.ear and display a jsp bundled in app2.ear. Is this doable ?

Do I have to bundle app2.ear together with app1.ear into a consolidated EAR ?

Thanks.
 
Leonardo Carreira
Ranch Hand
Posts: 494
Eclipse IDE Java Postgres Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes, it is possible.. you could use either Html form and [a href] tag in the case you would access WebApplication..
If you want to bundle it in one EAR, it depends on your decision,..
For easiness, i would choose bundle it in one EAR..

Please correct me if i'm wrong..
Thanks..
 
Mark E Hansen
Ranch Hand
Posts: 650
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How would using two separate EAR application affect security? For example, if you log-in to one EAR, will those credentials be passed to the other EAR? I think it won't, but I'm not sure and willing to be enlightened
 
Jimmy Clark
Ranch Hand
Posts: 2187
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I want to call an action in app2.ear and display a jsp bundled in app2.ear. Is this doable ?

Sounds like an awful design. It depends on what you mean by "call an action." It also sounds like the JSP page is in the wrong place. Either way, Session EJB are access via JNDI lookup. So you can certainly code communication between EJBs from multiple deployments, i.e. EAR.

What does "call an action mean"?
 
Raj Ohadi
Ranch Hand
Posts: 316
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Let me see if I can elaborate it bit more --- Currently I have an app1.ear web application. In one page I want to add a tab at the top, when user clicks this link, it should brings a new page search page underneath the existing tabs (including the new tab), then user can pick search criteria and hit submit, the result jsp page still appears under all the tabs. That's it. Talking about the tabs, currently there are a few there already, when user clicks a different tab it invokes some struts action and brings that page individually.

Now the question is -- for the module for the new tab, can I bundle it into a separate new EAR file ? i.e. in the current EAR I only add the tab link pointing /app2/search/. Is this feasible theoretically ? So, when user clicks the new tab link, it invokes the action class bundled in the new app2.ear. The new app2.ear also includes its ejb, jsf, etc.

The reason why I am asking this is the current app1.ear is developed by a remote team and they don't want us to add code to their part except adding tab and link.
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 34973
379
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Raj Ohadi wrote:The reason why I am asking this is the current app1.ear is developed by a remote team and they don't want us to add code to their part except adding tab and link.

This is a red flag. This is why we have jars - so we can share code with each other.

On your problem, you can make remote calls at the EJB layer. Or direct below the tab via a frame. I recommend you not compromise the design over a fear of sharing code. Which is what this sounds like.
 
Jimmy Clark
Ranch Hand
Posts: 2187
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Struts-based actions can be invoked by a simple link, i.e. HTTP-based URL.

So, if Web application #1 wants to have a link to call an action in Web application #2, then it can certainly do so via hyper-link.

This is not difficult. However, attempting to have two separate web applications share the same screens sounds like a big nightmare and a horrible design. It also indicates a poor software development process and will be hard to maintain.

Designs like this are most likely contributing to Java's negative reputation and helping .NET become more popular.


i.e. in the current EAR I only add the tab link pointing /app2/search/. Is this feasible theoretically ?


No, you cannot have the link point to a relative path of a different web application. Your link would have to point to a complete URL to invoke the action, e.g. http://43.12.32.12:897/app2/search
 
Raj Ohadi
Ranch Hand
Posts: 316
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Jeanne Boyarsky wrote:
Raj Ohadi wrote:The reason why I am asking this is the current app1.ear is developed by a remote team and they don't want us to add code to their part except adding tab and link.

This is a red flag. This is why we have jars - so we can share code with each other.

On your problem, you can make remote calls at the EJB layer. Or direct below the tab via a frame. I recommend you not compromise the design over a fear of sharing code. Which is what this sounds like.


So, are you suggesting I add ejb jar to the existing .ear and put the new jsp pages in the same existing .ear ?
 
Raj Ohadi
Ranch Hand
Posts: 316
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
James Clarks wrote:Struts-based actions can be invoked by a simple link, i.e. HTTP-based URL.

So, if Web application #1 wants to have a link to call an action in Web application #2, then it can certainly do so via hyper-link.

This is not difficult. However, attempting to have two separate web applications share the same screens sounds like a big nightmare and a horrible design. It also indicates a poor software development process and will be hard to maintain.

Designs like this are most likely contributing to Java's negative reputation and helping .NET become more popular.


i.e. in the current EAR I only add the tab link pointing /app2/search/. Is this feasible theoretically ?


No, you cannot have the link point to a relative path of a different web application. Your link would have to point to a complete URL to invoke the action, e.g. http://43.12.32.12:897/app2/search



Thanks James. I want to check the feasibility first for knowledge purpose. so from application one if I use complete URL to make a call to invoke application 2 (a struts), can I let application 2 return a JSP page with submit buttom, then I add this JSP to application 1's JSP ? Is that possible ? Now, remember in the JSP it returns it also has a submit button. By clicking the submit button I can invoke application 2 again, and then add the returned JSP to application 1.. Is this doable ?
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 34973
379
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Raj Ohadi wrote:So, are you suggesting I add ejb jar to the existing .ear and put the new jsp pages in the same existing .ear ?

Yes.
 
Raj Ohadi
Ranch Hand
Posts: 316
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
James Clarks wrote:Struts-based actions can be invoked by a simple link, i.e. HTTP-based URL.

So, if Web application #1 wants to have a link to call an action in Web application #2, then it can certainly do so via hyper-link.

This is not difficult. However, attempting to have two separate web applications share the same screens sounds like a big nightmare and a horrible design. It also indicates a poor software development process and will be hard to maintain.

Designs like this are most likely contributing to Java's negative reputation and helping .NET become more popular.


i.e. in the current EAR I only add the tab link pointing /app2/search/. Is this feasible theoretically ?


No, you cannot have the link point to a relative path of a different web application. Your link would have to point to a complete URL to invoke the action, e.g. http://43.12.32.12:897/app2/search


Thanks James. I want to check the feasibility first for knowledge purpose. so from application one if I use complete URL to make a call to invoke application 2 (a struts), can I let application 2 return a JSP page with submit buttom, then I add this JSP to application 1's JSP ? Is that possible ? Now, remember in the JSP it returns it also has a submit button. By clicking the submit button I can invoke application 2 again, and then add the returned JSP to application 1.. Is this doable ?

 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic