[英]Camel Java DSL: Could not resolve bean definition resource pattern [META-INF/spring/*.xml]
I have recently run into a situation with Camel after merging an unrelated change which has caused this stack trace: 在合并了导致此堆栈跟踪的无关更改之后,我最近遇到了Camel的情况:
java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.apache.camel.maven.RunMojo$1.run(RunMojo.java:519)
at java.lang.Thread.run(Thread.java:745)
Caused by: org.springframework.beans.factory.BeanDefinitionStoreException: Could not resolve bean definition resource pattern [META-INF/spring/*.xml]; nested exception is java.io.FileNotFoundException: class path resource [META-INF/spring/] cannot be resolved to URL because it does not exist
at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:229)
at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:188)
at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:252)
at org.springframework.context.support.AbstractXmlApplicationContext.loadBeanDefinitions(AbstractXmlApplicationContext.java:127)
at org.springframework.context.support.AbstractXmlApplicationContext.loadBeanDefinitions(AbstractXmlApplicationContext.java:93)
at org.springframework.context.support.AbstractRefreshableApplicationContext.refreshBeanFactory(AbstractRefreshableApplicationContext.java:129)
at org.springframework.context.support.AbstractApplicationContext.obtainFreshBeanFactory(AbstractApplicationContext.java:612)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:513)
at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:139)
at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:93)
at org.apache.camel.spring.Main.createDefaultApplicationContext(Main.java:222)
at org.apache.camel.spring.Main.doStart(Main.java:154)
at org.apache.camel.support.ServiceSupport.start(ServiceSupport.java:61)
at org.apache.camel.main.MainSupport.run(MainSupport.java:170)
at org.apache.camel.main.MainSupport.run(MainSupport.java:501)
at org.apache.camel.spring.Main.main(Main.java:86)
... 6 more
Caused by: java.io.FileNotFoundException: class path resource [META-INF/spring/] cannot be resolved to URL because it does not exist
at org.springframework.core.io.ClassPathResource.getURL(ClassPathResource.java:187)
at org.springframework.core.io.support.PathMatchingResourcePatternResolver.findPathMatchingResources(PathMatchingResourcePatternResolver.java:465)
at org.springframework.core.io.support.PathMatchingResourcePatternResolver.getResources(PathMatchingResourcePatternResolver.java:292)
at org.springframework.context.support.AbstractApplicationContext.getResources(AbstractApplicationContext.java:1291)
at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:216)
... 21 more
The code merge did not mess with anything in the maven pom file and was relatively unrelated to Camel and Spring. 代码合并不会混淆maven pom文件中的任何内容,并且与Camel和Spring无关。 I am using Java DSL to avoid having any xml files to configure Camel.
我正在使用Java DSL来避免使用任何xml文件来配置Camel。 This works if I remove the aforementioned code merge.
如果删除上述代码合并,则此方法有效。 I think this is an odd error related to my pom configuration to begin with... Does anyone have any experience with this error using Java DSL instead of the xml configuration?
我认为这是与我的pom配置相关的一个奇怪错误,首先...使用Java DSL而不是xml配置,有人对这个错误有任何经验吗? Is there a way to specifically mention that I am using DSL?
有没有一种方法可以特别提及我正在使用DSL? If I am using DSL, it should not even look for an xml config file.
如果我使用的是DSL,则它甚至都不应该寻找xml配置文件。
Here is the related section of my POM file for reference: 这是我的POM文件的相关部分,以供参考:
<org.apache.camel.version>2.20.0</org.apache.camel.version>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-dependencies</artifactId>
<version>1.4.1.RELEASE</version>
<type>pom</type>
<scope>import</scope>
</dependency>
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-spring-boot-dependencies</artifactId>
<version>${org.apache.camel.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
<version>1.4.1.RELEASE</version>
</dependency>
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-spring-boot-starter</artifactId>
<version>${org.apache.camel.version}</version>
</dependency>
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-core</artifactId>
<version>${org.apache.camel.version}</version>
</dependency>
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-aws</artifactId>
<version>${org.apache.camel.version}</version>
</dependency>
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-spring</artifactId>
<version>${org.apache.camel.version}</version>
</dependency>
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-spring-javaconfig</artifactId>
<version>${org.apache.camel.version}</version>
</dependency>
I managed to remove the provided tags from any of the dependencies and it worked while launching the spring application , however, I am unable to get Camel to run independently with the mvn camel:run command. 我设法从任何依赖项中删除了提供的标签,并且在启动spring应用程序时它起作用了,但是,我无法使用mvn camel:run命令让Camel独立运行。
<scope>import</scope>
This solved half of the problem which removed the roadblock for now. 这解决了目前消除障碍的一半问题。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.