Spring Apache Camel命名空间处理程序无效

Spring Apache Camel命名空间处理程序无效,spring,apache-camel,Spring,Apache Camel,我有一个在Eclipse上开发(返工)的应用程序。它在开发环境中运行良好。但是,当它加载到Tomcat中时,会出现名称空间异常: org.springframework.beans.factory.parsing.BeanDefinitionParsingException: Configuration problem: Failed to import bean definitions from relative location [camel-config.xml] Offending r

我有一个在Eclipse上开发(返工)的应用程序。它在开发环境中运行良好。但是,当它加载到Tomcat中时,会出现名称空间异常:

org.springframework.beans.factory.parsing.BeanDefinitionParsingException: Configuration problem: Failed to import bean definitions from relative location [camel-config.xml] 
Offending resource: class path resource [spring-config.xml]; nested exception is org.springframework.beans.factory.BeanDefinitionStoreException: Unexpected exception parsing XML document from class path resource [camel-config.xml]; nested exception is 
org.springframework.beans.FatalBeanException: Invalid NamespaceHandler class [org.apache.camel.spring.handler.CamelNamespaceHandler] for namespace [http://camel.apache.org/schema/spring]: problem with handler class file or dependent class; nested excep
tion is java.lang.NoClassDefFoundError: javax/xml/bind/JAXBException
下面是我的spring配置和camel配置

<?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:p="http://www.springframework.org/schema/p"
    xmlns:aop="http://www.springframework.org/schema/aop" xmlns:context="http://www.springframework.org/schema/context"
    xmlns:jee="http://www.springframework.org/schema/jee" xmlns:tx="http://www.springframework.org/schema/tx"
    xmlns:task="http://www.springframework.org/schema/task"
    xsi:schemaLocation="
   http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-3.1.xsd
   http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.1.xsd
   http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.1.xsd
   http://www.springframework.org/schema/jee http://www.springframework.org/schema/jee/spring-jee-3.1.xsd
   http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.1.xsd
   http://www.springframework.org/schema/task http://www.springframework.org/schema/task/spring-task-3.1.xsd">

    <context:component-scan base-package="foo.bar.agent" />
    <task:annotation-driven />  
    <import resource="camel-config.xml" />
</beans>

camel-config.xml

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
    xmlns:camel="http://camel.apache.org/schema/spring" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns:context="http://www.springframework.org/schema/context"
    xsi:schemaLocation="http://www.springframework.org/schema/beans
            http://www.springframework.org/schema/beans/spring-beans.xsd
        http://camel.apache.org/schema/spring
            http://camel.apache.org/schema/spring/camel-spring.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd">

    <!-- enable Spring @Component scan -->
    <context:component-scan base-package="com.altegix.agent.hl7" />

    <bean id="properties" class="org.apache.camel.component.properties.PropertiesComponent">
        <property name="ignoreMissingLocation" value="true" />
        <property name="locations">
            <list>
                <value>classpath:default.properties</value>
                <value>file:/opt/altegix/agent/application.properties</value>
            </list>
        </property>
    </bean>

    <bean id="myhl7codec" class="org.apache.camel.component.hl7.HL7MLLPCodec">
        <property name="charset" value="iso-8859-1" />
        <property name="validate" value="false" />
    </bean>

    <camelContext xmlns="http://camel.apache.org/schema/spring"
        id="resultsCamelContext">
        <contextScan />
        <camel:endpoint id="hl7listener"
            uri="mina2:tcp://{{results.endpoint.server}}:{{results.endpoint.port}}?sync=true&amp;codec=#myhl7codec" />
    </camelContext>

    <context:annotation-config />

    <bean class="com.altegix.agent.hl7.HL7ListenerConfiguration" />

classpath:default.properties
文件:/opt/altegix/agent/application.properties

我不明白为什么会出现InvalidNamespace异常?还有一个我以前从未见过的noClassDefFoundError——也许我缺少了Eclipse中的一些类?

您是否包含了
camel jaxb
依赖项?您在Eclipse工作区中使用了哪个JVM版本并加载Tomcat?是一样的吗?可能Eclipse在Java8上,Tomcat在Java11上。我想你是对的——事实上,服务器(Ubuntu18.04)正在运行OpenJDK10(我想)。月食在8号