So, I have stumbled on this error too, and it really got on my nerves. So, without further due
environment:
Wildfly 20.0.1.Final
Java 11
objectives:
I just want to add cxf so that I could use cxf - spring descriptors (in particular jaxws:endpoint) in my applicationContext.xml, i.e
<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:jaxws="http://cxf.apache.org/jaxws" xsi:schemaLocation=" http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://cxf.apache.org/jaxws http://cxf.apache.org/schemas/jaxws.xsd">
<!-- one or more jaxws:endpoint POJO declarations -->
<jaxws:endpoint id="POJOEndpoint" address="/test" implementor="com.test.myRandomPojoEndpoint">
<jaxws:invoker>
<bean class="org.jboss.wsf.stack.cxf.InvokerJSE"/>
</jaxws:invoker>
</jaxws:endpoint>
</beans>
issue:
but all I get is
Invalid NamespaceHandler class
[org.apache.cxf.jaxws.spring.NamespaceHandler] for namespace
[http://cxf.apache.org/jaxws]: problem with handler class file or
dependent class; nested exception is java.lang.NoClassDefFoundError:
org/springframework/beans/factory/xml/NamespaceHandlerSupport
Solution:
before you begin you SHOULD KNOW that for this stuff to work you have to INSTALL SPRING LIBRARIES to your wildfly application server and so...
The list of spring libraries in my wildfly environment:
spring-aop-5.2.9.RELEASE.jar
spring-beans-5.2.9.RELEASE.jar
spring-context-5.2.9.RELEASE.jar
spring-core-5.2.9.RELEASE.jar
spring-expression-5.2.9.RELEASE.jar
spring-jcl-5.2.9.RELEASE.jar
spring-tx-5.2.9.RELEASE.jar
spring-web-5.2.9.RELEASE.jar
Installation path is as follows
wildfly-20.0.1.Final\modules\system\layers\base\org\springframework\spring\main
just put spring libraries in this path and add module.txt (that same folder as spring libraries) as follows
module.txt
<?xml version="1.0" encoding="UTF-8"?>
<!--
~ JBoss, Home of Professional Open Source.
~ Copyright 2010, Red Hat, Inc., and individual contributors
~ as indicated by the @author tags. See the copyright.txt file in the
~ distribution for a full listing of individual contributors.
~
~ This is free software; you can redistribute it and/or modify it
~ under the terms of the GNU Lesser General Public License as
~ published by the Free Software Foundation; either version 2.1 of
~ the License, or (at your option) any later version.
~
~ This software is distributed in the hope that it will be useful,
~ but WITHOUT ANY WARRANTY; without even the implied warranty of
~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
~ Lesser General Public License for more details.
~
~ You should have received a copy of the GNU Lesser General Public
~ License along with this software; if not, write to the Free
~ Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
~ 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-->
<module name="org.springframework.spring" xmlns="urn:jboss:module:1.6">
<resources>
<resource-root path="spring-aop-5.2.9.RELEASE.jar"/>
<resource-root path="spring-beans-5.2.9.RELEASE.jar"/>
<resource-root path="spring-context-5.2.9.RELEASE.jar"/>
<resource-root path="spring-core-5.2.9.RELEASE.jar"/>
<resource-root path="spring-expression-5.2.9.RELEASE.jar"/>
<resource-root path="spring-jcl-5.2.9.RELEASE.jar"/>
<resource-root path="spring-tx-5.2.9.RELEASE.jar"/>
<resource-root path="spring-web-5.2.9.RELEASE.jar"/>
</resources>
<dependencies>
<module name="org.reactivestreams" />
<module name="org.apache.commons.logging" />
<module name="javaee.api"/>
<module name="javax.api" export="true" />
<module name="javax.servlet.api" />
<module name="org.jboss.vfs" />
</dependencies>
</module>
======THE END==========
NOTES:
So, if that is so simple why did I fail? WHY?
At first I installed spring libraries in
wildfly-20.0.1.Final\modules\system\layers\base\org\spring\main
and that cause a lot of misery, because
if you looked at
wildfly-20.0.1.Final\modules\system\layers\base\org\apache\cxf\impl\main\module.xml, you would see that it has a dependency on spring, i.e
<module name="org.springframework.spring" optional="true">
<imports>
<include path="META-INF"/>
</imports>
</module>
however, I installed spring libraries under different name which was org.spring and not org.springframework.spring, so that was the root of my failure.
my jboss-deployment-structure.xml (in WEB-INF folder) is
<?xml version="1.0" encoding="UTF-8"?>
<jboss-deployment-structure>
<deployment>
<dependencies>
<module name="org.springframework.spring">
<imports>
<include path="META-INF"/>
</imports>
<exports>
<include path="META-INF"/>
</exports>
</module>
<module name="org.apache.cxf">
<imports>
<include path="META-INF/cxf"/>
<include path="META-INF"/>
</imports>
<exports>
<include path="META-INF/cxf"/>
<include path="META-INF"/>
</exports>
</module>
<module name="org.apache.cxf.impl">
<imports>
<include path="META-INF/cxf"/>
<include path="META-INF"/>
</imports>
<exports>
<include path="META-INF/cxf"/>
<include path="META-INF"/>
</exports>
</module>
</dependencies>
</deployment>
</jboss-deployment-structure>
Related threads (to name a few)
https://mcmap.net/q/1704821/-jboss-eap-7-exclude-webservices-subsystem-gives-noclassdeffounderror-failed-to-link-endpointdefinitionparser-springendpointimpl
http://www.mastertheboss.com/javaee/jboss-web-services/using-spring-cxf-descriptors-in-wildfly
http://www.mastertheboss.com/javaee/jboss-web-services/using-spring-cxf-descriptors-in-wildfly
https://cxf.apache.org/docs/embedding-cxf-inside-spring.html
Hope it helps other lost souls.