users@glassfish.java.net

Re: Global JNDI naming bug?

From: Marina Vatkina <marina.vatkina_at_oracle.com>
Date: Fri, 18 Jun 2010 18:04:15 -0700

Major Péter wrote:
> Okay, but this also means for me, that I need to add plus logic for
> testing, because in my testcases the java:global/korok/UserManagerBean
> is good, while in production it is
> java:global/korok/korok/UserManagerBean. This is a little non-sense...
>

Send email to the JSR-318 expert group :(.

> Why can't I use in my testcases the good old-fashioned java:comp/env
> style JNDI names?
>

It will be another RFE that we'd hope to get to at some point.

Regards,
-marina
> Regards,
> Peter
>
> 2010-06-19 01:37 keltezéssel, Marina Vatkina írta:
>
>> It's per spec. This is what EJB 3.1 spec lead told me on the same issue
>> (and I changed v3.1 to follow the rule): "isn't something we considered
>> but it's worth evaluating for the next version of the spec. One of the
>> tradeoffs in keeping the portable JNDI name syntax simple in the common
>> case was to expose the difference between a stand-alone module and .ear
>> packaging to the application. For now, the assumption in the Embeddable
>> EJB API is that if there is only a single module it's treated as a
>> stand-alone module".
>>
>> HTH,
>> -marina
>>
>> Major Péter wrote:
>>
>>> Hi all,
>>>
>>> I'm trying to use the embedded glassfish server for my maven tests with
>>> the following code:
>>> Map<String, Object> properties = new HashMap<String, Object>();
>>> properties.put(EJBContainer.MODULES, new
>>> File("../sch-kp-ejb-impl/target/classes"));
>>> properties.put(EJBContainer.APP_NAME, "korok");
>>> properties.put("org.glassfish.ejb.embedded.glassfish.installation.root",
>>> "/home/user/glassfishv3-emb");
>>> EJBContainer ejb = EJBContainer.createEJBContainer(properties);
>>>
>>> When the tests are running I can see in the log files:
>>> INFO: Portable JNDI names for EJB UserManagerBean :
>>> [java:global/korok/UserManagerBean,
>>> java:global/korok/UserManagerBean!hu.sch.services.UserManagerLocal]
>>>
>>> Quote from the EJB 3.1. specs, 4.4.1.1.1:
>>> javax.ejb.embeddable.appName
>>> This property specifies an application name for the EJB modules
>>> executing within the embeddable container. If specified, the property
>>> value applies to the <app-name> portion of the portable global JNDI name
>>> syntax. It is recommended that this property be set whenever an
>>> embeddable container is executed with more than one ejb module.
>>>
>>> But when you check 4.4.1:
>>> Each portable session bean global JNDI name has the following syntax :
>>> java:global[/<app-name>]/<module-name>/<bean-name>[!<fully-quali-
>>> fied-interface-name>]
>>> <app-name> only applies if the session bean is packaged within an .ear
>>> file. It defaults to the base name of the .ear file with no filename
>>> extension, unless specified by the application.xml deployment descriptor.
>>> <module-name> is the name of the module in which the session bean is
>>> packaged. In a stand-alone ejb-jar file or .war file, the <module-name>
>>> defaults to the base name of the module with any filename extension
>>> removed. In an ear file, the <module-name> defaults to the pathname of
>>> the module with any filename extension removed, but with any directory
>>> names included. The default <module-name> can be overriden using the
>>> module-name element of ejb-jar.xml (for ejb-jar files) or web.xml (for
>>> .war files).
>>>
>>> Okay, so the app-name is optional, but if I supplied explicitly the
>>> application name, then why doesn't that appear in the Global JNDI
>>> name??? The name of the EJB module is also 'korok', so I would like to
>>> see 'java:global/korok/korok/UserManagerBean', but I'm not. What am I
>>> missing?
>>>
>>> Also when I deploy my application to a standalone GF, then the
>>> application name is what I supplied in the asadmin --name parameter, but
>>> based on 4.4.1 it should had been taken from application.xml or it
>>> should be the name of the ear...
>>>
>>> Regards,
>>> Peter
>>>
>>> ---------------------------------------------------------------------
>>> 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
>
>