4.5. Spring in Application Archives
Packaging Spring in application archives is a more common approach than installing Spring as a shared library in the application server. In this method, the Spring files are required to be at the following locations inside the application archives:
- In WAR
- In the
WEB-INF/libdirectory. - In EAR
- In the
/libfolder of the archive, or another folder specified in theMETA-INF/application.xmldescriptor.In EARs that contain WARs, package Spring either in the shared library directory of the EAR, or in theWEB-INF/libdirectory of individual WARs that use Spring. Unless the WARs use different versions of Spring (not a common case), Red Hat recommends you to package Spring as a shared library of the EARs. - In RAR
- In the root directory of the archive.
Warning
TheSpringContextResourceAdaptorpresent in Spring 3.0.7.RELEASE and Spring 2.5.6.SEC03 violates section 5.3.1 of the JCA 1.5 specification. As a consequence, RARs containing packaged Spring files from these versions cause deployment errors on Red Hat JBoss Enterprise Application Platform.To work around this issue, disable archive validation in the JCA subsystem by adding the following code to the server configuration: <subsystem xmlns="urn:jboss:domain:jca:1.1"> <archive-validation enabled="false" /> </subsystem>