ejb@glassfish.java.net

Re: Regarding JNDI on GlassFish

From: Kenneth Saks <Kenneth.Saks_at_Sun.COM>
Date: Fri, 05 Dec 2008 10:13:40 -0500

On Dec 5, 2008, at 7:52 AM, Jaechang Nam wrote:

> Hello,
>
> I'm Jaechang.
> Now I'm trying to access EJB3.0 via C# clients.
>
> But I'm wondering the default JNDI name which is described on your
> FAQ page as a table.
> https://glassfish.dev.java.net/javaee5/ejb/
> EJB_FAQ.html#SessionBeanGlobalJNDINameAssignment
>
> Actually, I have successfully accessed EJB on GlassFish through
> specified JNDI name by C# clients.
> I used EJB2.x style with Home/Remote interface for accessing EJB on
> GlassFish via plain CORBA cilents.
>
> My wondering is that according to the table regarding default JNDI
> name,
> if I don't use 3.0 Remote Business interfaces but use 2.x Home/
> Remote interfaces,
> the default JNDI name is fully-qualified name of Remote Home
> interface like "com.acme.FooHome"
> But, in my trial, it doesn't work so that I should specify JNDI name.
>
> This is a part of my test session bean:
>
> package calculator;
>
> import javax.ejb.RemoteHome;
> import javax.ejb.Stateless;
>
> @Stateless
> @RemoteHome(CalculatorHome.class)
> public class CalculatorBean{
>
> public int add(int a, int b) {
> return a+b;
> }
> }
>
> In this code, CaculatorBean doesn't implement CalculatorRemote
> because CalculatorHome instantiates CalculatorRemote.
> So, due to only using 2.x Home/Remote interfaces,
> I thought the default JNDI name is fully-qualified name of Remote
> Home interface.(In my case, "calculator.CalculatorHome")
> however, It doesn't work.

Hi Jaechang,

Yes, that's the correct default global JNDI name.

>
>
> 1) Is there something that I missed to access EJB on GlassFish
> through fully-qualified name of Remote Home interface.

Based on what you've listed the name looks correct.
>
> 2) I want to know if there is another way to directly access EJB3.0
> on GlassFish by using business interfaces via plain CORBA clients
> written in other languages.

The Remote 3.0 Business Interface does not directly implement
java.rmi.Remote so it can only be accessed from a Java client. For
2.x Remote Home interfaces,
access from non-Java clients is not something we test. It was touted
as a benefit in the very early days of EJB (~10 years ago) but has
never gotten much attention. You're much better off sticking to Java
clients for Remote EJB access or switching to webservices for non-Java
client access.

>
> 3) Can I find if the JNDI names for all deployed EJBs on GlassFish
> is registered correctly on the admin console of GlassFish?
Yes, there's a JNDI name browser on the admin console. http://www.myeclipseide.com/PNphpBB2-viewtopic-t-18850.html

You might also want to look at the server.log to make sure there
weren't any deployment problems.

  --ken

>
> I hope to hear from you soon.
>
> Thanks a lot.
>
> BR/
> Jaechang Nam