I didn't have a proper understanding of the XML configurations. Your
reply put it in perspective for me and I 'get it' now. Thank you very much.
Ryan
Sanjeeb Kumar Sahoo wrote:
> Ryan,
>
> It is not that difficult to write portable ear/jar/war/rar file. Don't
> be under the impression that a portable jar/war/war does not require
> any modification when you move from one platform to another. In fact,
> they may just have to be modified when you move from one installation to
> another while using the same software, but one must not have to change
> source code or standard deployment descriptors of a portable
> applications. Migration of portable applications should be possible by
> just configuring vendor specific deployment descriptors like
> sun-ejb-jar.xml, or sun-application-client.xml, etc.
>
> In your example below, a portable way to look up an EJB from an
> application client would be to:
>
> 1. In application-client.xml, declare a dependency on the EJB using
> <ejb-ref> entry. Give it a name. You have already done this:
>
> <ejb-ref>
> <ejb-ref-name>ejb/test1234/ConnectionTester</ejb-ref-name>
> <ejb-ref-type>Session</ejb-ref-type>
> <remote>domain.ejb.interfaces.ConnectionTesterRemote</remote>
> </ejb-ref>
>
>
> 2. In your code, look up in the java:comp/env/ namespace using the above
> name. So your code looks like:
>
> Object objref = new
> InitialContext().lookup("java:comp/env/ejb/test1234/ConnectionTester");
>
> HelloInterface hello = (HelloInterface)
> PortableRemoteObject.narrow(objref, HelloInterface.class);
>
> 3. In sun-application-client.xml, you need to bind the ejb-ref-name to
> the actual JNDI name of the EJB.
> <sun-application-client>
> <ejb-ref>
> <ejb-ref-name>ejb/test1234/ConnectionTester</ejb-ref-name>
> <jndi-name>Use Actual JNDI Name of the EJB</jndi-name>
> </ejb-ref>
> </sun-application-client>
>
> It is the last step that varies from vendor to vendor.
>
> With Java EE 5, the EJB look up code has been greatly simplified. Steps
> 1 & 2 can be replaced by the following single line of code:
>
> /_at_javax.ejb.EJB(name="ejb/test1234/ConnectionTester") private static
> HelloInterface hello;/
>
> Take a look at Java EE 5 tutorials from Sun where you can find a lot of
> portable applications.
>
> Thanks,
> Sahoo
>
> Ryan wrote:
>> Thanks for the reply weberjn. After a bit of discussion tonight we've
>> decided to target Glassfish and deal with porting to another application
>> server if it ever needs to be done.
>>
>> I felt like I was spending as much time ensuring our application was
>> portable as I was doing actual work. Almost all of the books, tutorials
>> and docs that I've seen tend to explain how to do things for a specific
>> application server. I found it almost impossible to find Java EE
>> examples that showed how to do things in a vendor independent manner.
>>
>> However, if anyone is aware of a sample EE application (.ear) that will
>> run on multiple application servers without modification I'd still be
>> interested in looking at it just for fun.
>>
>> Ryan
>>
>>
>> glassfish_at_javadesktop.org wrote:
>>
>>> Did you try the RMI over IIOP way?
>>>
>>> From
>>> http://java.sun.com/j2se/1.4.2/docs/guide/rmi-iiop/tutorial.html
>>>
>>> // STEP 1: Get the Object reference from the Name
>>> Service
>>> // using JNDI call.
>>> objref = ic.lookup("HelloService");
>>> System.out.println("Client: Obtained a ref. to Hello
>>> server.");
>>>
>>> // STEP 2: Narrow the object reference to the concrete type and
>>> // invoke the method.
>>> hi = (HelloInterface) PortableRemoteObject.narrow(
>>> objref, HelloInterface.class);
>>> hi.sayHello( " MARS " );
>>> [Message sent by forum member 'weberjn' (weberjn)]
>>>
>>> http://forums.java.net/jive/thread.jspa?messageID=204935
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe_at_glassfish.dev.java.net
>>> For additional commands, e-mail: users-help_at_glassfish.dev.java.net
>>>
>>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe_at_glassfish.dev.java.net
>> For additional commands, e-mail: users-help_at_glassfish.dev.java.net
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_glassfish.dev.java.net
> For additional commands, e-mail: users-help_at_glassfish.dev.java.net
>