Deploying multiple Struts 2 wars in a single ear may not work, due to each Struts 2 instance seeing configuration from the other war. Struts 2 doesn't allow multiple configuration files for the same package, or more specifically in this case, multiple struts-default.xml files. If possible, configure your application server to better isolate wars using a child first strategy for classloading.

Wander Grevink reported the following (on GlassFish 2.1):

 
EAR
    WAR-1
        META-INF
            MANIFEST.MF
            
    lib
        struts*.jar
        struts*.xml
        
    META-INF
        application.xml
        
    WAR-2
        META-INF
            MANIFEST.MF

Where both MANIFEST.MF files contain the following entry:

MANIFEST.MF
Class-Path: lib

And application.xml contains this entry:

 
<library-directory>/lib</library-directory>

All struts related files go into the shared lib directory.

  • No labels

2 Comments

  1. Anonymous

    This setup works for me (on glassfish v2.1)

    EAR
        WAR-1
            META-INF
                MANIFEST.MF
                
        lib
            struts*.jar
            struts*.xml
            
        META-INF
            application.xml
            
        WAR-2
            META-INF
                MANIFEST.MF
    

    Where both MANIFEST.MF files contain the following entry:
    Class-Path: lib

    And application.xml contains this entry:
    <library-directory>/lib</library-directory>

    All struts related files go into the shared lib directory.

    Regards
    Wander Grevink

    1. Thanks for reporting, Wander. I've added it to the main page to ensure visibility for those with comments hidden.