org.apache.camel.nosuchlanguageexception:找不到语言:simple

wvmv3b1j  于 2021-07-09  发布在  Java
关注(0)|答案(1)|浏览(455)

我有以下例外: org.apache.camel.NoSuchLanguageException: No language could be found for: simple 打电话的时候 DefaultCamelContext.start(); 在我的路线上我需要使用 .recipientList(exchangeProperty("name")) 这就是为什么我已经从camel2.12.0迁移到camel3.4.0,现在我甚至不能启动上下文。
pom.xml相关依赖项:

<dependencies>
      <dependency>
        <groupId>org.apache.camel</groupId>
        <artifactId>camel-api</artifactId>
        <version>3.4.0</version>
    </dependency>
    <dependency>
        <groupId>org.apache.camel</groupId>
        <artifactId>camel-base</artifactId>
        <version>3.4.0</version>
    </dependency>
    <dependency>
        <groupId>org.apache.camel</groupId>
        <artifactId>camel-language</artifactId>
        <version>3.4.0</version>
    </dependency>    
    <dependency>
        <groupId>org.apache.camel</groupId>
        <artifactId>camel-jetty</artifactId>
        <version>3.4.0</version>
    </dependency>
    <dependency>
        <groupId>org.apache.camel</groupId>
        <artifactId>camel-http</artifactId>
        <version>3.4.0</version>
    </dependency>   
  </dependencies>

我加了 Camel 语以防万一。
我知道模块系统,我已经试过教程中的dependencymanagement块了(https://camel.apache.org/releases/release-3.4.0/)也犯了同样的错误。所以我决定不包括不必要的jar。
我在eclipseide(版本2021-03)中开发。maven会自动选择j2se-1.5系统库(但是我的默认jre是1.8),我无法更改它:更新maven项目后,它会返回到1.5。
下面是带有一些调试消息的完整stacktrace:

[                          main] ResolverHelper                 DEBUG Lookup Language with name simple in registry. Found: null
[                          main] ResolverHelper                 DEBUG Lookup Language with name simple-language in registry. Found: null
org.apache.camel.NoSuchLanguageException: No language could be found for: simple
    at org.apache.camel.impl.engine.DefaultLanguageResolver.noSpecificLanguageFound(DefaultLanguageResolver.java:92)
    at org.apache.camel.impl.engine.DefaultLanguageResolver.resolveLanguage(DefaultLanguageResolver.java:68)
    at org.apache.camel.impl.engine.AbstractCamelContext.resolveLanguage(AbstractCamelContext.java:1730)
    at org.apache.camel.impl.engine.AbstractCamelContext.doStartStandardServices(AbstractCamelContext.java:3205)
    at org.apache.camel.impl.DefaultCamelContext.doStartStandardServices(DefaultCamelContext.java:297)
    at org.apache.camel.impl.engine.AbstractCamelContext.forceLazyInitialization(AbstractCamelContext.java:3148)
    at org.apache.camel.impl.engine.AbstractCamelContext.doInit(AbstractCamelContext.java:2550)
    at org.apache.camel.support.service.BaseService.init(BaseService.java:83)
    at org.apache.camel.impl.engine.AbstractCamelContext.init(AbstractCamelContext.java:2435)
    at org.apache.camel.support.service.BaseService.start(BaseService.java:111)
    at org.apache.camel.impl.engine.AbstractCamelContext.start(AbstractCamelContext.java:2452)
    at my.camel.MainApp.main(MainApp.java:16)

任何帮助都将不胜感激:)

isr3a4wc

isr3a4wc1#

我不明白 camel-core 作为您的一个依赖项,如您提供的url所述。
根据有关表达式语言的文档 Simple 语言是作为 camel-core-languages 工件,它是 camel-core .
我建议再次尝试使用camel pom进行依赖关系管理,确保显式地包含 camel-core 作为依赖项的工件。如果 camel-core 单独解决不了你的问题,那就考虑添加 camel-core-languages 也。

<dependencyManagement>
  <dependencies>
    <dependency>
      <groupId>org.apache.camel</groupId>
      <artifactId>camel-bom</artifactId>
      <version>3.4.0</version>
      <type>pom</type>
      <scope>import</scope>
    </dependency>
  </dependencies>
</dependencyManagement>

<dependencies>
  <dependency>
    <groupId>org.apache.camel</groupId>
    <artifactId>camel-core</artifactId>
  </dependency>
  <dependency>
    <groupId>org.apache.camel</groupId>
    <artifactId>camel-core-languages</artifactId>
  </dependency>
</dependencies>

相关问题