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