Child pages
  • Multiple Struts 2 wars in a single ear

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migrated to Confluence 5.3

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):

No Format
 
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:

Code Block
titleMANIFEST.MF

Class-Path: lib

And application.xml contains this entry:

Code Block
xml
xml
 
<library-directory>/lib</library-directory>

All struts related files go into the shared lib directory.