Problem with accessing Spring NamespaceHandler inside EAR file due to class loading issue.
ksiczek Feb 24, 2017 4:14 AMHi,
it is my first post here so please be lenient if possible
We migrate from EAP 6.1 to EAP 6.4 and have a strange issue regarding Spring startup. Our EAR structure is as follows
dev_production.ear ├── atg_admin.war ├── atg_bootstrap_ejb.jar ├── atg_bootstrap.war ├── atglib ├── atg-rest-web-1.0.war ├── generic.war ├── Integration.war ├── META-INF ├── PhoenixStore.war ├── siebel.war ├── Static.war └── VideoIdent-rs.war
where Integration.war has defined Spring context (and some CXF stuff) but all jar artifacts are placed in atglib and atg_bootstrap_ejb.jar refers to them at MANIFEST.MF Class-Path entry. The problem we have is that during start we get
09:19:26,378 ERROR [org.springframework.web.context.ContextLoader] (ServerService Thread Pool -- 117) Context initialization failed: org.springframework.beans.factory.parsing.BeanDefinitionParsingException: Configuration problem: Unable to locate Spring NamespaceHandler for XML schema namespace [http://www.springframework.org/schema/context] Offending resource: class path resource [META-INF/app-context.xml]
We checked and it seems that during context start there is no META-INF/spring.handlers available to classloader but handler org.springframework.context.config.ContextNamespaceHandler is accessible so we can access it using
getResourceLoader().getClassLoader().getResources("org/springframework/context/config/ContextNamespaceHandler.class")
I did several configurations in jboss-deployment-structure.xml but nothing works for me:
<jboss-deployment-structure xmlns="urn:jboss:deployment-structure:1.2" > <deployment> <dependencies> <system export="true"> <paths> <path name="sun/net/util"/> <path name="sun/net/www"/> <path name="com/sun/crypto/provider"/> <path name="sun/awt"/> <path name="sun/rmi/server"/> </paths> </system> </dependencies> </deployment> <sub-deployment name="atg_bootstrap_ejb.jar"> <exports> <include path="META-INF/*"/> <include path="META-INF/cxf/*"/> </exports> </sub-deployment> <sub-deployment name="Integration.war"> <!-- <resources> <resource-root path="../atglib/_Integration.Integration_slib_sspring-context-4.1.1.RELEASE.jar"> <filter> <include path="META-INF/*"/> <include path="META-INF/cxf/*"/> </filter> </resource-root> </resources> --> <dependencies> <module name="deployment.dev_production.ear.atg_bootstrap_ejb.jar" slot="main" meta-inf="import"> <!-- <exports> <include path="META-INF/*"/> </exports> --> </module> </dependencies> </sub-deployment> </jboss-deployment-structure>
and the only solution by now was to put spring-context to Integration.war/WEB-INF/lib. We did not have that problems using jBoss EAP 6.1.
It might be an unusual setup in terms of using Spring in JEE application but it is something I inherited and I do not want to change too much (e.g. Spring version or ear dependency to moduled one) without a good reason and I do not want to let jBoss beat me so do you have any idea how to configure it properly? Also I'm wondering what exactly has changed that jBoss has problems with such configuration.
P.S. I attached server logs and configuration XML.
-
dev_production.xml_cfg.zip 4.4 KB
-
dev_productionconsole.log.zip 52.8 KB