you mean you can mention these in ejb-jar.xml?
How?

Shashank S. Dixit
Software Analyst.
Datamatics Ltd.
Contact: 28291253 ext 146
Mobile: 9820930075

Be brave against all odds. Never give up.


-----Original Message-----
From: Viral_Thakkar [mailto:[EMAIL PROTECTED]
Sent: Thursday, August 21, 2003 3:35 PM
To: [EMAIL PROTECTED]; Struts Users Mailing List
Subject: RE : Remote and local EJB


This seems to be good idea.

I think EJB configuration files may also help us to achieve the same.



-----Original Message-----
From: Shashank Dixit [mailto:[EMAIL PROTECTED]
Sent: Thursday, August 21, 2003 2:29 PM
To: Viral_Thakkar; Struts Users Mailing List
Subject: RE: RE : Remote and local EJB

You can have properties file where you can define which interface should you
consider for calling EJBs. SO that you dont have to change your code to
serve your purpose.
Let me know what do you think

Shashank S. Dixit
Software Analyst.
Datamatics Ltd.
Contact: 28291253 ext 146
Mobile: 9820930075

Be brave against all odds. Never give up.


-----Original Message-----
From: Viral_Thakkar [mailto:[EMAIL PROTECTED]
Sent: Thursday, August 21, 2003 11:30 AM
To: Struts Users Mailing List; [EMAIL PROTECTED]
Subject: RE: RE : Remote and local EJB


If we know that EJBs and struts classes will reside in same JVM then why we
should also invoke the stateless session bean remotely? We can invoke that
session bean using the local interface... rite .?

Although I agree that in furure, we may deploy web and app classes on
different machines, so that's why I am looking for a solution where we can
take advantage of both local and remote interface of EJB.

I would say we should prefer the local EJB call instead of remote EJB call
as far as possible.

Viral







-----Original Message-----
From: Shashank Dixit [mailto:[EMAIL PROTECTED]
Sent: Thursday, August 21, 2003 10:29 AM
To: Struts Users Mailing List; Viral_Thakkar;
[EMAIL PROTECTED]
Subject: RE: RE : Remote and local EJB

Hi Viral

Ideally there should be one stateless session bean within action class and
business component EJBs so that you have only one remote call and all other
EJB calls are local. You should always program considering different tiers
on different machines, although you are using the web and app tier on same
machine now. Let me know what do you think on this.

Shashank S. Dixit
Software Analyst.
Datamatics Ltd.
Contact: 28291253 ext 146
Mobile: 9820930075

Be brave against all odds. Never give up.


-----Original Message-----
From: Viral_Thakkar [mailto:[EMAIL PROTECTED]
Sent: Thursday, August 21, 2003 9:40 AM
To: Struts Users Mailing List; Piper, James D CECOM SEC EPS
Subject: RE : Remote and local EJB


Thanks Jim.

I am using the oracle 9iAS. I also developed the EJB which supports both
remote and local access. I am also able to invoke this EJB from my action
class. I accessed this EJB using the remote and also using local interface
separately.

The reason why I want this EJB to be deployed both as local and remote is
that at present EJB will be accessed by the struts action class, both are in
same JVM so I can access the EJB using the local interface.

In future when we do clustering then at that time, EJB bean may be at
different server, in different JVM, at that time struts action class should
dynamically find the remote EJB.

One way I think, we can handle such situation in the catch block of the
NamingException() while accessing the local bean, we need to lookup the
remote EJB. But it seems that this is not the good programming practice.

So I am looking for some design pattern or framework, which supports the
solution to this problem.

Thanks,
Viral


-----Original Message-----
From: Piper, James D CECOM SEC EPS
[mailto:[EMAIL PROTECTED]
Sent: Wednesday, August 20, 2003 7:49 PM
To: Viral_Thakkar
Subject: RE: RE : Remote and local EJB

So let me see if I understand what it is you are wanting to accomplish.  It
sounds like you have a bunch of EJBs, a Struts application and several
servers.  You would like http requests coming in to be 'evaluated' by your
application and then based on some information within that request (i.e.
users name, users ip address, users browsers type, users preference
selection, or possibly even the current servers load) invoke either a local
or a remote EJB.  For example maybe you have an EJB that does some realy
heavy calculatations like a ray-tracer and for some important users you want
the results to come back faster than for other less important users.  So you
make your ray tracing EJB and deploy it on both the local server (i.e. the
same one running your Struts app) and on some other EJB server far far away.
Then register them both in your ejb-jar.xml with different names ie.
RayTraceLocal and RayTraceRemote.  So now to access either the remote or the
local EJB depending on the request you write your Struts action class to
first evaluate the HTTP request to figure out if this request is coming from
the important user or not and then as appropriate either do your jndi lookup
for the RayTraceLocal or the RayTraceRemote.

As far as I know there is not any built in mechanics within Struts for doing
this kind of thing, its up to you to write an Action class that invokes the
backend EJB you want.  I think some EJB servers give you some flexability
and increase performance when using EJBs that are within the same container
- WebLogic I know lets you specify both a remote and a local name for each
EJB then provides better performance when using the local one - Possible
even the high end WebLogic stuff will do automatic load balancing between
EJB server so that your calls to jndi lookup return references to EJBs on
whatever server is being currently used less.  But these kind of load
balancing issues you would need to talk with your EJB server provider and
then build your Struts actions to invkoke those EJBs in the way the EJB
server provider specified to get the benefits of load balancing.

Good Luck,
Jim Piper






-----Original Message-----
From: Viral_Thakkar [mailto:[EMAIL PROTECTED]
Sent: Wednesday, August 20, 2003 8:27 AM
To: Struts Users Mailing List; [EMAIL PROTECTED]
Subject: RE : Remote and local EJB


Thanks for the reply.

I agree with this solution, but this does not solve the problem of accessing
the remote and local EJBs depending on the request.

-----Original Message-----
From: Laurent MARQUEZ [mailto:[EMAIL PROTECTED]
Sent: Monday, August 18, 2003 10:11 PM
To: 'Struts Users Mailing List'
Subject: RE : RE : Remote and local EJB

1-See on
http://www-106.ibm.com/developerworks/java/library/j-ejb1022.html
for pattern business delegate.

2-You must declare your EJB Local or remote or both interface in your
web.xml,
Like this foo example:

#ejb-ref>
#   <ejb-ref-name>
#     ejb/fr.artal.FooHome
#    </ejb-ref-name>
#    <ejb-ref-type>
#      Session
#    </ejb-ref-type>
#    <home>
#      fr.artal.FooHome
#    </home>
#    <remote>
#      fr.artal.Foo
#    </remote>
#    <ejb-link>
#      FooEJB
#    </ejb-link>
#  </ejb-ref>

3-Call your delegate interface, in your action class:
import org.apache.struts.action.Action;

#Public class FooAction extends Action
#{
#       //~ Static fields/initializers
---------------------------------------------
#
#       public static final String ID = "ID";
#       public static final String NAME = "NAME";
#
#       //~ Methods
----------------------------------------------------------------
#       protected ActionForward execute(
#               ActionMapping mapping,
#               ActionForm form,
#               HttpServletRequest request,
#               HttpServletResponse response)
#               throws Exception {
#
#               Integer id = null;
#               FooData fooData = null;
#
#               if (form != null)
#               {
#                       // using the form displayed in the view to get
the foo id
#                       String id =
(String)PropertyUtils.getSimpleProperty(form, "id");
#
#
#                       // using business delegate pattern to interface
with EJB session
#                       FooDelegate FooDelegate = new FooDelegate();
#
#
#                       fooData = FooDelegate.getFoo(id);
#               }
#               if (fooData != null)
#               {
#                       // set the request attribute
#                       String name = fooData .getName();
#
#                       request.setAttribute(ID, id);
#                       request.setAttribute(NAME, name);
#               }
#       }
#}

4- you can now, use the request object to display  all the foo fields in
your view(JSP)
Example foo data:
#<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
#<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
#
#<html:html>
#<head></head>
#<body>
#
#<table width=500
#       border="0" cellspacing="0" cellpadding="0">
#       <tr>
#               <td>Foo:</td>
#       </tr>
#       <tr>
#               <td> Id: <%= request.getAttribute("ID") %></td>
#       </tr>
#       <tr>
#               <td>&nbsp;</td>
#       </tr>
#       <tr>
#               <td> Name: <%= request.getAttribute("NAME") %></td>
#       </tr>
#       <tr>
#               <td>&nbsp;</td>
#       </tr>
#</table>
#</body>
#</html:html>


-----Message d'origine-----
De : Viral_Thakkar [mailto:[EMAIL PROTECTED]
Envoyé : lundi 18 août 2003 11:39
À : Struts Users Mailing List
Objet : RE: RE : Remote and local EJB


Business delegate pattern explains on how to use the business delegate
class. This pattern explains its usage and benefits.

Here I am interested in a solution which supports remote and local EJB
access depending on request. Any idea on this...???






-----Original Message-----
From: Laurent MARQUEZ [mailto:[EMAIL PROTECTED]
Sent: Monday, August 18, 2003 1:07 PM
To: 'Struts Users Mailing List'
Subject: RE : Remote and local EJB

Yes, you can interface EJB with Jakarta Struts
I use the pattern business delegate
See chapter 13
Of Programming Jakarta struts

-----Message d'origine-----
De : Viral_Thakkar [mailto:[EMAIL PROTECTED]
Envoyé : lundi 18 août 2003 07:35
À : Struts Users Mailing List
Objet : Remote and local EJB


Is there any struts support or any one has idea on following problem?

I am developing an application in which I require to develop an EJB with
local and remote interface. Local or remote EJB should be invoked
depending on the request. How one can identify this?
Any framework which support this local and remote EJB development and
access?




-----Original Message-----
From: Robert Leland [mailto:[EMAIL PROTECTED]
Sent: Monday, August 18, 2003 9:39 AM
To: [EMAIL PROTECTED]
Subject: [Validator] The Validator Wiki needs you !

There is now a Commons Validator Wiki !

Beware this is only a shell to start collecting tips, FAQs, and examples
for using validator. You can make a much needed contribution !

http://nagoya.apache.org/wiki/apachewiki.cgi?ValidatorProjectPages


This is also great opportunity to delete all those old emails you have
been saving !
Come on, there must be hundreds,  and put them on the web !

Then they are instantly available from any web browser:
* At work,
      Your Desk
      Your Co-worker's Desk
* At home
* At a remote site
* Even from that better paying job you have been waiting for !
   No emailing yourself hundreds of emails, just give your Notice ! ;-)

We really do need you !

--
Robert Leland                   [EMAIL PROTECTED]
------------------------------------------
Java, J2EE, Struts, Web Application Development

804 N. Kenmore Street           +01-703-525-3580
Arlington VA 22201



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to