SpringBoot: Unable to locate Spring NamespaceHandler for XML schema namespace [http://cxf.apache.org/jaxws]

Viewed 41

When I start up my SpringBoot application I see the following exception:

2022-09-16 16:54:35.435  WARN 13916 --- [cutor-thread-13] ConfigServletWebServerApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.parsing.BeanDefinitionParsingException: Configuration problem: Unable to locate Spring NamespaceHandler for XML schema namespace [http://cxf.apache.org/jaxws]
Offending resource: URL [file:/C:/xxxx/xxxx/git/xxx-xxx-service/xxxx/target/classes/applicationContext.xml]
2022-09-16 16:54:35.448  INFO 13916 --- [cutor-thread-13] ConditionEvaluationReportLoggingListener :
Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
2022-09-16 16:54:35.545 ERROR 13916 --- [cutor-thread-13] o.s.boot.SpringApplication               : Application run failed
org.springframework.beans.factory.parsing.BeanDefinitionParsingException: Configuration problem: Unable to locate Spring NamespaceHandler for XML schema namespace [http://cxf.apache.org/jaxws]
Offending resource: URL [file:/C:/xxx/xxx/git/xx-xx-service/xxx/target/classes/applicationContext.xml]
              at org.springframework.beans.factory.parsing.FailFastProblemReporter.error(FailFastProblemReporter.java:72) ~[spring-beans-5.3.14.jar:5.3.14]
              at org.springframework.beans.factory.parsing.ReaderContext.error(ReaderContext.java:119) ~[spring-beans-5.3.14.jar:5.3.14]
              at org.springframework.beans.factory.parsing.ReaderContext.error(ReaderContext.java:111) ~[spring-beans-5.3.14.jar:5.3.14]
              at org.springframework.beans.factory.xml.BeanDefinitionParserDelegate.error(BeanDefinitionParserDelegate.java:281) ~[spring-beans-5.3.14.jar:5.3.14]
              at org.springframework.beans.factory.xml.BeanDefinitionParserDelegate.parseCustomElement(BeanDefinitionParserDelegate.java:1388) ~[spring-beans-5.3.14.jar:5.3.14]
              at org.springframework.beans.factory.xml.BeanDefinitionParserDelegate.parseCustomElement(BeanDefinitionParserDelegate.java:1371) ~[spring-beans-5.3.14.jar:5.3.14]
              at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.parseBeanDefinitions(DefaultBeanDefinitionDocumentReader.java:179) ~[spring-beans-5.3.14.jar:5.3.14]
              at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.doRegisterBeanDefinitions(DefaultBeanDefinitionDocumentReader.java:149) ~[spring-beans-5.3.14.jar:5.3.14]
              at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.registerBeanDefinitions(DefaultBeanDefinitionDocumentReader.java:96) ~[spring-beans-5.3.14.jar:5.3.14]
              at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.registerBeanDefinitions(XmlBeanDefinitionReader.java:511) ~[spring-beans-5.3.14.jar:5.3.14]
              at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:391) ~[spring-beans-5.3.14.jar:5.3.14]
              at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:338) ~[spring-beans-5.3.14.jar:5.3.14]
              at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:310) ~[spring-beans-5.3.14.jar:5.3.14]
              at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:188) ~[spring-beans-5.3.14.jar:5.3.14]
              at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:224) ~[spring-beans-5.3.14.jar:5.3.14]
              at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:195) ~[spring-beans-5.3.14.jar:5.3.14]
              at org.springframework.context.annotation.ConfigurationClassBeanDefinitionReader.lambda$loadBeanDefinitionsFromImportedResources$0(ConfigurationClassBeanDefinitionReader.java:390) ~[spring-context-5.3.14.jar:5.3.14]
              at java.util.LinkedHashMap.forEach(LinkedHashMap.java:684) ~[na:1.8.0_271]
              at org.springframework.context.annotation.ConfigurationClassBeanDefinitionReader.loadBeanDefinitionsFromImportedResources(ConfigurationClassBeanDefinitionReader.java:354) ~[spring-context-5.3.14.jar:5.3.14]
              at org.springframework.context.annotation.ConfigurationClassBeanDefinitionReader.loadBeanDefinitionsForConfigurationClass(ConfigurationClassBeanDefinitionReader.java:156) ~[spring-context-5.3.14.jar:5.3.14]
              at org.springframework.context.annotation.ConfigurationClassBeanDefinitionReader.loadBeanDefinitions(ConfigurationClassBeanDefinitionReader.java:129) ~[spring-context-5.3.14.jar:5.3.14]
              at org.springframework.context.annotation.ConfigurationClassPostProcessor.processConfigBeanDefinitions(ConfigurationClassPostProcessor.java:343) ~[spring-context-5.3.14.jar:5.3.14]
              at org.springframework.context.annotation.ConfigurationClassPostProcessor.postProcessBeanDefinitionRegistry(ConfigurationClassPostProcessor.java:247) ~[spring-context-5.3.14.jar:5.3.14]
              at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanDefinitionRegistryPostProcessors(PostProcessorRegistrationDelegate.java:311) ~[spring-context-5.3.14.jar:5.3.14]
              at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanFactoryPostProcessors(PostProcessorRegistrationDelegate.java:112) ~[spring-context-5.3.14.jar:5.3.14]
              at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:746) ~[spring-context-5.3.14.jar:5.3.14]
              at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:564) ~[spring-context-5.3.14.jar:5.3.14]
              at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:145) ~[spring-boot-2.6.2.jar:2.6.2]
              at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:730) ~[spring-boot-2.6.2.jar:2.6.2]
              at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:412) ~[spring-boot-2.6.2.jar:2.6.2]
              at org.springframework.boot.SpringApplication.run(SpringApplication.java:302) ~[spring-boot-2.6.2.jar:2.6.2]
              at org.springframework.boot.web.servlet.support.SpringBootServletInitializer.run(SpringBootServletInitializer.java:175) [spring-boot-2.6.2.jar:2.6.2]
              at org.springframework.boot.web.servlet.support.SpringBootServletInitializer.createRootApplicationContext(SpringBootServletInitializer.java:155) [spring-boot-2.6.2.jar:2.6.2]
              at org.springframework.boot.web.servlet.support.SpringBootServletInitializer.onStartup(SpringBootServletInitializer.java:97) [spring-boot-2.6.2.jar:2.6.2]
              at org.springframework.web.SpringServletContainerInitializer.onStartup(SpringServletContainerInitializer.java:174) [spring-web-5.3.14.jar:5.3.14]
              at com.ibm.ws.webcontainer.webapp.WebApp.initializeServletContainerInitializers(WebApp.java:2550) [com.ibm.ws.webcontainer_1.1.48.jar:na]
              at com.ibm.ws.webcontainer.webapp.WebApp.initialize(WebApp.java:1031) [com.ibm.ws.webcontainer_1.1.48.jar:na]
              at com.ibm.ws.webcontainer.webapp.WebApp.initialize(WebApp.java:6683) [com.ibm.ws.webcontainer_1.1.48.jar:na]
              at com.ibm.ws.webcontainer.osgi.DynamicVirtualHost.startWebApp(DynamicVirtualHost.java:470) [com.ibm.ws.webcontainer_1.1.48.jar:na]
              at com.ibm.ws.webcontainer.osgi.DynamicVirtualHost.startWebApplication(DynamicVirtualHost.java:465) [com.ibm.ws.webcontainer_1.1.48.jar:na]
              at com.ibm.ws.webcontainer.osgi.WebContainer.startWebApplication(WebContainer.java:1179) [com.ibm.ws.webcontainer_1.1.48.jar:na]
              at com.ibm.ws.webcontainer.osgi.WebContainer.access$100(WebContainer.java:110) [com.ibm.ws.webcontainer_1.1.48.jar:na] 
              at com.ibm.ws.webcontainer.osgi.WebContainer$3.run(WebContainer.java:976) [com.ibm.ws.webcontainer_1.1.48.jar:na]
              at com.ibm.ws.threading.internal.ExecutorServiceImpl$RunnableWrapper.run(ExecutorServiceImpl.java:239) [com.ibm.ws.threading_1.1.48.jar:na]
              at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) [na:1.8.0_271]
              at java.util.concurrent.FutureTask.run(FutureTask.java:266) [na:1.8.0_271]
              at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [na:1.8.0_271]
              at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [na:1.8.0_271]
              at java.lang.Thread.run(Thread.java:748) [na:1.8.0_271]

The applicationContext.xml is as follows:

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
              xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
             xmlns:context="http://www.springframework.org/schema/context"
              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://www.springframework.org/schema/context
                        http://www.springframework.org/schema/context/spring-context.xsd
                        http://cxf.apache.org/jaxws
                        http://cxf.apache.org/schemas/jaxws.xsd">
 
              <jaxws:client id="alisAuditPortType"
              serviceClass="com.xxx.xxx.xxx.webservice.ALISAuditPortType">
              </jaxws:client>
</beans>

Any ideas on what may be the issue here? I have looked through a lot of other Stackoverflow items that deal with Spring. I was thinking the Spring Boot might be slightly different with this issue.

I have also tried testing changing the CXF from 3.1.18 to 3.3.13 and Spring version from 5.0.3.RELEASE to 5.2.21.RELEASE in the pom.xml. These both had the same error condition.

Here is some of the pom.xml:

<properties>
<java.version>1.8</java.version>
<log4j2.version>2.16.0</log4j2.version>
<cxf.version>3.1.18</cxf.version>
<spring.version>5.0.3.RELEASE</spring.version>                            <junit.platform.version>1.2.0</junit.platform.version>
<jacoco.version>0.8.1</jacoco.version>                          <jacoco.outputDir>${project.build.directory}</jacoco.outputDir>                             <jacoco.out.ut.file>jacoco.exec</jacoco.out.ut.file>
<jacoco.out.it.file>jacoco-it.exec</jacoco.out.it.file>
</properties>

          <dependencies>
                         <dependency>                                           <groupId>org.springframework.boot</groupId>
                                       <artifactId>spring-boot-configuration-processor</artifactId>
                         </dependency>
                         <dependency>                                           <groupId>org.springframework.boot</groupId>
                                       <artifactId>spring-boot-starter-webflux</artifactId>
                         </dependency>
                         <dependency>                                           <groupId>org.springframework.boot</groupId>
                                       <artifactId>spring-boot-starter-web</artifactId>
                         </dependency>
                         <dependency>                                           <groupId>org.springframework.boot</groupId>
                                       <artifactId>spring-boot-starter-test</artifactId>
                                       <scope>test</scope>
                         </dependency>
                         <dependency>                                           <groupId>org.springframework.boot</groupId>
                                       <artifactId>spring-boot-starter-validation</artifactId>
                         </dependency>
                         <dependency>                                       

    <groupId>ch.qos.logback</groupId>
                                           <artifactId>logback-core</artifactId>
                             </dependency>
                             <dependency>                                           <groupId>org.springframework</groupId>
                                           <artifactId>spring-jdbc</artifactId>
                             </dependency>
                             <dependency>
   <groupId>org.projectlombok</groupId>
                <artifactId>lombok</artifactId>
                             </dependency>
                             <dependency>                                         <groupId>com.fasterxml.jackson.core</groupId>
                                           <artifactId>jackson-databind</artifactId>
                             </dependency>
                             <dependency>                                           <groupId>com.squareup.okhttp3</groupId>                                           <artifactId>okhttp</artifactId>
                                           <version>4.0.1</version>
                                           <scope>test</scope>
                             </dependency>
                             <dependency>                                           <groupId>com.squareup.okhttp3</groupId>                                           <artifactId>mockwebserver</artifactId>
                                           <version>4.0.1</version>
                                           <scope>test</scope>
                             </dependency>
                             <dependency>
                           <groupId>org.apache.cxf</groupId>
                                           <artifactId>cxf-core</artifactId>
                                           <version>${cxf.version}</version>
                             </dependency>
                             <dependency>
       <groupId>org.apache.cxf</groupId>
                                           <artifactId>cxf-rt-frontend-jaxws</artifactId>
                                           <version>${cxf.version}</version>
                             </dependency>
                             <dependency>
           <groupId>org.apache.cxf</groupId>
                                           <artifactId>cxf-rt-frontend-simple</artifactId>
                                           <version>${cxf.version}</version>
                             </dependency>
                             <dependency>
        <groupId>org.apache.cxf</groupId>
                                           <artifactId>cxf-rt-ws-security</artifactId>
                                           <version>${cxf.version}</version>
                             </dependency>
                             <dependency>
              <groupId>org.apache.cxf</groupId>
                                           <artifactId>cxf-rt-transports-http</artifactId>
                                           <version>${cxf.version}</version>
                             </dependency>
                             <dependency>
    <groupId>org.apache.cxf</groupId>
                                           <artifactId>cxf-rt-rs-client</artifactId>
                                           <version>${cxf.version}</version>
                             </dependency>
              </dependencies>

This is deployed on Liberty Server 21.0.0.1

0 Answers
Related