• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

PortableRemoteObject & Mail in j2ee

 
Ranch Hand
Posts: 73
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Could any one explain to me what is the use of PortableRemoteObject.narrow method used for? As down cast could be done directly, why is there a need for PortableRemoteObject. Thanks
Could Initial Context (JNDI) be used to looked up a mail session (for email)? I believe so. Please correct me if I am wrong. And if so, where should it be located? I mean how should the mail server and username password authentication be set. Is it server specific? If so how could it be done in j2eesdk1.3.1 ri and Orion server? Thanks
regards
Rastin
 
Ranch Hand
Posts: 1561
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by rastin purr:
Could any one explain to me what is the use of PortableRemoteObject.narrow method used for? As down cast could be done directly, why is there a need for PortableRemoteObject. Thanks
Could Initial Context (JNDI) be used to looked up a mail session (for email)? I believe so. Please correct me if I am wrong. And if so, where should it be located? I mean how should the mail server and username password authentication be set. Is it server specific? If so how could it be done in j2eesdk1.3.1 ri and Orion server? Thanks
regards
Rastin


as for the first question, I would highly recommend that you read mastering EJB by Ed Roman. PDF available at www.middleware-company.com.
<extracted-from-book>

javax.rmi.PortableRemote Object.narrow(). This is a static method on an RMI-IIOP class called Portable
RemoteObject. This method casts the generic object that we looked up via JNDI
to our RMI-IIOP interface type. This narrow() operation is required whenever
you lookup an RMI-IIOP object via JNDI. Why do we need it, and why don’t
we just cast it using a regular Java cast? The short answer is CORBA interoperability.

<extracted-from-book>
check appendix B.
as per the second question (mail):
Yes, it could be used. In fact, this is what I'm doing:

it should be located whenever you need to send email, in this case you need the mail Session.
In my case, I'm using JBoss, so in my jboss.xml file I add these lines.

JBoss comes with an xml file called mail-service.xml. In this file you set up the SMTP server or POP server, username, password, JNDI name, etc... very easy.
sorry but I don't know how to do it with Orion. shouldn't be too much the difference..
hope it helps
good luck
 
rastin purr
Ranch Hand
Posts: 73
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Andres,
Just to make sure i understand it correctly, does this means that,
if say, part of the j2ee application (some ejb jar files) is running on a host, and the j2ee application (some different ejb jar files) is running on a different host, and to look up the ejb on diferrent host normal java casting cannot be done cause they are network appart. So we need PortableRemoteObject to do the down casting. Is that right?
If say, on a different situation, a server (orion or weblogic) is running on a host and the j2ee application is on another different host, to get the initial context, we need to set the provider and the uri say something like t3 for weblogic and ormi for orion... Am I right so far? please correct me if i am not. And to lookup the DataSource for connection pooling in order to get a connection, do we need to use portable remove object as well? I think so cause they are separated and they should communicate using rmi-iiop? Is that correct?
Please explain. Thanks. Anyone who has any ideas are welcome. Thanks again.
Ras
 
rastin purr
Ranch Hand
Posts: 73
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
anyone?? anyone at all???
 
rastin purr
Ranch Hand
Posts: 73
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Sorry if this this trouble anyone here.
Please, is there any one here who could give me a reply? I know there are lots of good j2ee developers out there in the javaranch site. Please help me out. Please................
Rastin
 
reply
    Bookmark Topic Watch Topic
  • New Topic