users@glassfish.java.net

Re: Naming environment in a startup module

From: Marina Vatkina <marina.vatkina_at_oracle.com>
Date: Fri, 02 Mar 2012 10:54:47 -0800

BRASSELY David wrote:
> Thanks for your advice.
>
> Is this the only way to get it ? No way to get it from the naming environment and how ?
>

It depends on the availability of the naming service at the time of your
module is being started.
> According to your answer, I had to enabled transaction recovery on startup and so access it after the all_application_loaded event, that's it ?
>

You do not need to enable automatic tx recovery, but it is enabled by
default on clustered instances and stand-alone instances (i.e. any
instances that are not DAS). So you need to be aware of it.

-marina
> David
>
> -----Message d'origine-----
> De : Marina Vatkina [mailto:marina.vatkina_at_oracle.com]
> Envoyé : jeudi 1 mars 2012 00:26
> À : users_at_glassfish.java.net
> Cc : users_at_glassfish.dev.java.net
> Objet : Re: Naming environment in a startup module
>
> You can inject
> com.sun.enterprise.transaction.api.JavaEETransactionManager using HK2 API. But you need to be very careful with accessing it on startup - it shouldn't be started before all applications had been loaded if transaction recovery is enabled on startup.
>
> -marina
>
> forums_at_java.net wrote:
>
>> Hi all,
>>
>> I'm currently writing a Startup module for Glassfish v3.1 by
>> implementing the org.glassfish.api.Startup interface.
>>
>> I just want to get the java:appserver/TransactionManager from the
>> naming environment.
>>
>>
>>
>> Is there any way to get a reference to the current InitialContext as
>> it exists in the old fashion LifecycleListener event context
>> : http://docs.oracle.com/cd/E18930_01/html/821-2418/beans.html#beanw [1].
>>
>> Otherwise, any other way to do this ?
>>
>> Thanks
>>
>>
>>
>>
>> [1] http://docs.oracle.com/cd/E18930_01/html/821-2418/beans.html#beanw
>>
>> --
>>
>> [Message sent by forum member 'brasseld']
>>
>> View Post: http://forums.java.net/node/883879
>>
>>
>>