Skip to main content

Glassfish 2 EAR component deploy order

Please note these java.net forums are being decommissioned and use the new and improved forums at https://community.oracle.com/community/java.
2 replies [Last post]
whartung
Offline
Joined: 2003-06-13

We have an EAR for Glassfish v2. We currently rely on a Web Context Listener to do some code at application deploy/startup.

The problem is that there are several WARs in the EAR, and one of the WARs is firing up before the other WAR gets a chance to do it initial work.

So, I am wondering how the deploy order is managed in an EAR.

Is it alpabetical based on the WAR name? Location of the WAR in the EAR artifact? Based on the application.xml/sun-application.xml? Is it deterministic at all?

I know there is no portable mechanism for this in JEE5, I'm not particularly interested in portable. I'm interested specifically in GFv2.1.1 behavior. Is GFv3 behavior any different? Is there anything I can do to force the deployment order?

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
hzhang_jn
Offline
Joined: 2005-07-22

No, there was not a standard way to do it in EE 5. I believe the
behavior in GF v2.1 is to load the modules based on the declaration
order of the modules in the application.xml. You can give it a try.

In EE 6, the spec has standardized the loading order of the modules with
the "initialize-in-order" element in application.xml.

If initialize-in-order is true, modules must be initialized
in the order they're listed in this deployment descriptor,
with the exception of application client modules, which can
be initialized in any order.
If initialize-in-order is not set or set to false, the order
of initialization is unspecified and may be product-dependent.

- Hong

On 12/14/2011 7:30 PM, forums@java.net wrote:
> We have an EAR for Glassfish v2. We currently rely on a Web Context
> Listener to do some code at application deploy/startup.
>
> The problem is that there are several WARs in the EAR, and one of the
> WARs is
> firing up before the other WAR gets a chance to do it initial work.
>
> So, I am wondering how the deploy order is managed in an EAR.
>
> Is it alpabetical based on the WAR name? Location of the WAR in the EAR
> artifact? Based on the application.xml/sun-application.xml? Is it
> deterministic at all?
>
> I know there is no portable mechanism for this in JEE5, I'm not
> particularly
> interested in portable. I'm interested specifically in GFv2.1.1
> behavior. Is
> GFv3 behavior any different? Is there anything I can do to force the
> deployment order?
>
>
>
>
> --
>
> [Message sent by forum member 'whartung']
>
> View Post: http://forums.java.net/node/874267
>
>

alexismp
Offline
Joined: 2005-01-06

http://blogs.oracle.com/alexismp/entry/module_initialization_order_in_java
If order of separate artifacts matters, then deploying in disabled mode and enabling them in the appropriate order (using asadmin or RESTful interface) is one solution.
-Alexis

On 15 déc. 2011, at 03:43, hong.hz.zhang... wrote:

> No, there was not a standard way to do it in EE 5. I believe the behavior in GF v2.1 is to load the modules based on the declaration order of the modules in the application.xml. You can give it a try.
>
> In EE 6, the spec has standardized the loading order of the modules with the "initialize-in-order" element in application.xml.
>
> type="javaee:generic-booleanType"
> minOccurs="0"
> maxOccurs="1">
>
>
>
> If initialize-in-order is true, modules must be initialized
> in the order they're listed in this deployment descriptor,
> with the exception of application client modules, which can
> be initialized in any order.
> If initialize-in-order is not set or set to false, the order
> of initialization is unspecified and may be product-dependent.
>
>
>
>
> - Hong
>
> On 12/14/2011 7:30 PM, forums@java.net wrote:
>> We have an EAR for Glassfish v2. We currently rely on a Web Context
>> Listener to do some code at application deploy/startup.
>>
>> The problem is that there are several WARs in the EAR, and one of the WARs is
>> firing up before the other WAR gets a chance to do it initial work.
>>
>> So, I am wondering how the deploy order is managed in an EAR.
>>
>> Is it alpabetical based on the WAR name? Location of the WAR in the EAR
>> artifact? Based on the application.xml/sun-application.xml? Is it
>> deterministic at all?
>>
>> I know there is no portable mechanism for this in JEE5, I'm not particularly
>> interested in portable. I'm interested specifically in GFv2.1.1 behavior. Is
>> GFv3 behavior any different? Is there anything I can do to force the
>> deployment order?
>>
>>
>>
>>
>> --
>>
>> [Message sent by forum member 'whartung']
>>
>> View Post: http://forums.java.net/node/874267
>>
>>