spring - Apache Camel Spring 配置错误 - 无法找到 XML 模式命名空间的 Spring NamespaceHandler [http ://camel. apache.org/schema/spring]

标签 spring web-applications apache-camel

我已经发布了我的 spring.xml 文件的摘录和我得到的堆栈跟踪。

<?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:lang="http://www.springframework.org/schema/lang"
    xmlns:util="http://www.springframework.org/schema/util" xmlns:jaxws="http://cxf.apache.org/jaxws"
    xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
    http://www.springframework.org/schema/lang http://www.springframework.org/schema/lang/spring-lang-2.5.xsd
    http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-2.5.xsd
    http://cxf.apache.org/jaxws http://cxf.apache.org/schemas/jaxws.xsd
    http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring-2.0.0.xsd"
    default-init-method="init" default-lazy-init="false">

    <!-- import web service configuration -->
    <import resource="classpath:META-INF/cxf/cxf.xml" />
    <import resource="classpath:META-INF/cxf/cxf-extension-soap.xml" />
    <import resource="classpath:META-INF/cxf/cxf-servlet.xml" />

    <camelContext id="camel" xmlns="http://camel.apache.org/schema/spring">
        <package>com.testdomain.testpackage</package>
    </camelContext>
...
</beans>

抛出此异常:

SEVERE: Exception sending context initialized event to listener instance of class org.springframework.web.context.ContextLoaderListener
org.springframework.beans.factory.parsing.BeanDefinitionParsingException: Configuration problem: Unable to locate Spring NamespaceHandler for XML schema namespace [http://camel.apache.org/schema/spring]
Offending resource: class path resource [spring-config.xml]

    at org.springframework.beans.factory.parsing.FailFastProblemReporter.error(FailFastProblemReporter.java:68)
    at org.springframework.beans.factory.parsing.ReaderContext.error(ReaderContext.java:85)
    at org.springframework.beans.factory.parsing.ReaderContext.error(ReaderContext.java:80)
    at org.springframework.beans.factory.xml.BeanDefinitionParserDelegate.error(BeanDefinitionParserDelegate.java:281)
    at org.springframework.beans.factory.xml.BeanDefinitionParserDelegate.parseCustomElement(BeanDefinitionParserDelegate.java:1294)
    at org.springframework.beans.factory.xml.BeanDefinitionParserDelegate.parseCustomElement(BeanDefinitionParserDelegate.java:1287)
    at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.parseBeanDefinitions(DefaultBeanDefinitionDocumentReader.java:135)
    at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.registerBeanDefinitions(DefaultBeanDefinitionDocumentReader.java:92)
    at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.registerBeanDefinitions(XmlBeanDefinitionReader.java:507)
    at.......

有人可以帮忙解决问题吗?

最佳答案

对于 < 3.8 的 Camel 版本,将 camel-spring.jar 添加到您的项目中。对于 3.8 之后的版本,也添加 camel-spring-xml

使用spring xml dsl 已split off

关于spring - Apache Camel Spring 配置错误 - 无法找到 XML 模式命名空间的 Spring NamespaceHandler [http ://camel. apache.org/schema/spring],我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1504163/

相关文章:

java - Apache Camel - Spring DSL - 将字符串参数传递给 bean 方法

java - AngularJS、Spring Social 和 CORS

Spring 事务管理 + Active MQ + 数据源

java - PersistenceUnitInfo [appName] 有事务类型 JTA,但没有定义 jtaDataSource

python - 文本文件在 AWS Elastic Beanstalk(Flask Web 应用程序)上无法正确显示

javascript - 在网络应用程序中获取 iphone ID

java - Apache Camel 与 RabbitMQ : messages in temp reply queue not being acked when autoAck=false on endpoint configuration

java - 为什么 Camel noErrorHandler 使用堆栈跟踪记录警告消息?

java - Spring中如何拦截静态方法?

Java Web App FutureTask 进度条