开发者社区> 问答> 正文

springMVC 整合camel-ftp启动时报错?报错


我的代码在

https://github.com/winfan/springMVC-camel-ftp


org.springframework.beans.factory.parsing.BeanDefinitionParsingException: Configuration problem: Failed to import bean definitions from URL location [classpath*:spring-core.xml]
Offending resource: ServletContext resource [/WEB-INF/spring-servlet.xml]; nested exception is org.springframework.beans.factory.parsing.BeanDefinitionParsingException: Configuration problem: Failed to import bean definitions from relative location [spring-ftp.xml]
Offending resource: URL [file:/D:/Intellij_IDEA_project/java/upgrade/target/upgrade-web/WEB-INF/classes/spring-core.xml]; nested exception is org.springframework.beans.factory.BeanDefinitionStoreException: Failed to create the JAXB binder; nested exception is javax.xml.bind.JAXBException: Provider com.sun.xml.bind.v2.ContextFactory could not be instantiated: com.sun.xml.bind.v2.runtime.IllegalAnnotationsException: 2 counts of IllegalAnnotationExceptions
Two classes have the same XML type name "{http://camel.apache.org/schema/spring}propertyDefinition". Use @XmlType.name and @XmlType.namespace to assign different names to them.
this problem is related to the following location:
at org.apache.camel.model.config.PropertyDefinition
at private java.util.List org.apache.camel.model.config.PropertiesDefinition.properties
at org.apache.camel.model.config.PropertiesDefinition
at private org.apache.camel.model.config.PropertiesDefinition org.apache.camel.spring.CamelContextFactoryBean.properties
at org.apache.camel.spring.CamelContextFactoryBean
this problem is related to the following location:
at org.apache.camel.model.PropertyDefinition
at private java.util.List org.apache.camel.model.PropertiesDefinition.properties
at org.apache.camel.model.PropertiesDefinition
Two classes have the same XML type name "{http://camel.apache.org/schema/spring}propertiesDefinition". Use @XmlType.name and @XmlType.namespace to assign different names to them.
this problem is related to the following location:
at org.apache.camel.model.config.PropertiesDefinition
at private org.apache.camel.model.config.PropertiesDefinition org.apache.camel.spring.CamelContextFactoryBean.properties
at org.apache.camel.spring.CamelContextFactoryBean
this problem is related to the following location:
at org.apache.camel.model.PropertiesDefinition

展开
收起
爱吃鱼的程序员 2020-06-14 16:27:49 562 0
1 条回答
写回答
取消 提交回答
  • https://developer.aliyun.com/profile/5yerqm5bn5yqg?spm=a2c6h.12873639.0.0.6eae304abcjaIB
    在pom.xml加了一下依懒即可 <dependency><groupId>org.apache.camel</groupId><artifactId>camel-core</artifactId><version>2.15.1</version></dependency><dependency><groupId>org.apache.camel</groupId><artifactId>camel-spring</artifactId><version>2.15.1</version></dependency><dependency><groupId>org.apache.camel</groupId><artifactId>camel-ftp</artifactId><version>2.15.1</version></dependency>



    在resources目录下加入以下xml文件

    spring-camel.xml

    <?xmlversion="1.0"encoding="UTF-8"?><beansxmlns="http://www.springframework.org/schema/beans"xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"xsi:schemaLocation="http://www.springframework.org/schema/beanshttp://www.springframework.org/schema/beans/spring-beans.xsdhttp://camel.apache.org/schema/springhttp://camel.apache.org/schema/spring/camel-spring.xsd"><camelContextid="testCamelContext"xmlns="http://camel.apache.org/schema/spring"><package>com.xxxx.camel</package></camelContext><!--enableSpring@Componentscan--><!--<context:component-scanbase-package="com.xxxx.camel"/>--><camelContextxmlns="http://camel.apache.org/schema/spring"><!--andthenletCamelusethose@Componentscannedroutebuilders--><contextScan/></camelContext><!--LetSpringcreatetheCamelcontextandtheCameltemplate,includinglifecyclemanagementsuchasstartingandstoppingthem--><!--<camel:camelContextid="camelContext"><camel:templateid="camelTemplate"/></camel:camelContext>--><!--UseSpringcomponentscantofindtheFtpSenderImplimplementation--><!--<context:component-scanbase-package="com.xxxx.service.*"/>--><beanclass="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"/><camelContextxmlns="http://camel.apache.org/schema/spring"><templateid="camelTemplate"/><route><fromuri="file:D:/Intellij_IDEA_project/java/xxxx/src/main/webapp/upload"/><touri="ftp://bbbb@localhost/testjava?password=111111&passiveMode=true"/><touri="ftp://aaaaa@localhost2/testjava?password=222222&passiveMode=true"/></route></camelContext><!--<beanid="myConfig"class="org.apache.commons.net.ftp.FTPClientConfig"><propertyname="lenientFutureDates"value="true"/><propertyname="serverLanguageCode"value="zh"/></bean>--><!--<camelContextid="camel5"xmlns="http://camel.apache.org/schema/spring"><routeBuilderref="myBuilder"/></camelContext>--><!--<beanid="myBuilder"class="com.xxxx.camel.FtpRouteBuilder"/>--><!--<!–weusetheAntPathMatcherRemoteFileFiltertouseantpathsforincludesandexclude–><beanid="myAntFilter"class="org.apache.camel.component.file.AntPathMatcherGenericFileFilter"><!–includeanyfilesinthesubfolderthathasdayinthename–><propertyname="includes"value="**/subfolder/**/*day*"/><!–excludeallfileswithbadinnameor.xmlfiles.Usecommatoseparatemultipleexcludes–><propertyname="excludes"value="**/*bad*,**/*.xml"/></bean>--></beans>






    引用来自“唐小明生”的评论

    在pom.xml加了一下依懒即可 <dependency><groupId>org.apache.camel</groupId><artifactId>camel-core</artifactId><version>2.15.1</version></dependency><dependency><groupId>org.apache.camel</groupId><artifactId>camel-spring</artifactId><version>2.15.1</version></dependency><dependency><groupId>org.apache.camel</groupId><artifactId>camel-ftp</artifactId><version>2.15.1</version></dependency>



    在resources目录下加入以下xml文件

    spring-camel.xml

    <?xmlversion="1.0"encoding="UTF-8"?><beansxmlns="http://www.springframework.org/schema/beans"xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"xsi:schemaLocation="http://www.springframework.org/schema/beanshttp://www.springframework.org/schema/beans/spring-beans.xsdhttp://camel.apache.org/schema/springhttp://camel.apache.org/schema/spring/camel-spring.xsd"><camelContextid="testCamelContext"xmlns="http://camel.apache.org/schema/spring"><package>com.xxxx.camel</package></camelContext><!--enableSpring@Componentscan--><!--<context:component-scanbase-package="com.xxxx.camel"/>--><camelContextxmlns="http://camel.apache.org/schema/spring"><!--andthenletCamelusethose@Componentscannedroutebuilders--><contextScan/></camelContext><!--LetSpringcreatetheCamelcontextandtheCameltemplate,includinglifecyclemanagementsuchasstartingandstoppingthem--><!--<camel:camelContextid="camelContext"><camel:templateid="camelTemplate"/></camel:camelContext>--><!--UseSpringcomponentscantofindtheFtpSenderImplimplementation--><!--<context:component-scanbase-package="com.xxxx.service.*"/>--><beanclass="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"/><camelContextxmlns="http://camel.apache.org/schema/spring"><templateid="camelTemplate"/><route><fromuri="file:D:/Intellij_IDEA_project/java/xxxx/src/main/webapp/upload"/><touri="ftp://bbbb@localhost/testjava?password=111111&passiveMode=true"/><touri="ftp://aaaaa@localhost2/testjava?password=222222&passiveMode=true"/></route></camelContext><!--<beanid="myConfig"class="org.apache.commons.net.ftp.FTPClientConfig"><propertyname="lenientFutureDates"value="true"/><propertyname="serverLanguageCode"value="zh"/></bean>--><!--<camelContextid="camel5"xmlns="http://camel.apache.org/schema/spring"><routeBuilderref="myBuilder"/></camelContext>--><!--<beanid="myBuilder"class="com.xxxx.camel.FtpRouteBuilder"/>--><!--<!–weusetheAntPathMatcherRemoteFileFiltertouseantpathsforincludesandexclude–><beanid="myAntFilter"class="org.apache.camel.component.file.AntPathMatcherGenericFileFilter"><!–includeanyfilesinthesubfolderthathasdayinthename–><propertyname="includes"value="**/subfolder/**/*day*"/><!–excludeallfileswithbadinnameor.xmlfiles.Usecommatoseparatemultipleexcludes–><propertyname="excludes"value="**/*bad*,**/*.xml"/></bean>--></beans>






    2020-06-14 16:28:07
    赞同 展开评论 打赏
问答分类:
问答标签:
问答地址:
问答排行榜
最热
最新

相关电子书

更多
低代码开发师(初级)实战教程 立即下载
冬季实战营第三期:MySQL数据库进阶实战 立即下载
阿里巴巴DevOps 最佳实践手册 立即下载

相关实验场景

更多