Hello,
well, if you are programming an application client, that wants to access
your EJB, then the interface that you will be getting is always a remote
interface. Local interfaces are only inside the J2EE container.
So, if you do this:
InitialContext ic = new InitialContext();
Foo foo = (Foo) ic.lookup("FooEJB");
in your appclient, you'll get the remote interface of FooEJB. If you deploy
and run the same code inside a J2EE EJB 3.0 container (like Glassfish),
you'll get a local interface (not sure, if that also applies to clustered
environments, though)
Check this webpage, that gives some information on the topic:
https://glassfish.dev.java.net/javaee5/ejb/EJB_FAQ.html
Regarding the local and remote lookup:
If you want to exploicitly look up the remote interface, you can use this
code:
InitialContext initialContext = new InitialContext();
IBusinessService businessService = (IBusinessService)
initialContext.lookup("java:/BusinessService/remote");
Notice the "/remote" in the JNDI name.
Some more information is avilable here:
http://jcp.org/aboutJava/communityprocess/pfd/jsr220/index.html . Click on
the donwload link and check out the simplified API and the Contracts PDF
files. It deals with JNDI naming conventions and also the remote/local
interface stuff in detail.
Regards,
Joerg
----- Original Message -----
From: <glassfish_at_javadesktop.org>
To: <users_at_glassfish.dev.java.net>
Sent: Friday, May 09, 2008 6:50 PM
Subject: Re: How to address / lookup a local interface from a helper class
> Thanks. So an extra lookup is required.
>
> But what is the correct handling for the JNDI names when using both, local
> and remote interfaces? In the bean, we use
>
> @Stateless( mappedName=OrderManagerRemote.DEFAULT_JNDI_NAME )
>
> but what should be used for the local interface name
> and how we can distinguish between them?
> [Message sent by forum member 'reiner_nix2' (reiner_nix2)]
>
> http://forums.java.net/jive/thread.jspa?messageID=273543
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_glassfish.dev.java.net
> For additional commands, e-mail: users-help_at_glassfish.dev.java.net
>
>