Apache Camel: 无法访问 org.apache.camel.spi.ResourceAware

huangapple go评论68阅读模式
英文:

Apache Camel: cannot access org.apache.camel.spi.ResourceAware

问题

我正在创建 Apache Camel REST 服务但这一行无法解析
`@Component
public class MySpringBootRouter extends RouteBuilder {`
maven 安装和清理都正常运行项目重建也成功但每当我尝试运行应用程序时我会得到 `无法访问 org.apache.camel.spi.ResourceAware`。我也尝试了无效缓存并重新启动 Intelij但没有成功痛苦的部分是在网上找不到这个包以下是我的 pom 文件
英文:

I'm creating apache camel REST service but this line cannot resolve. @Component
public class MySpringBootRouter extends RouteBuilder {

maven install and clean run fine and also project rebuild is success, whenever I try to run the application I'm getting cannot access org.apache.camel.spi.ResourceAware. I've also tried to invalidate cache and restart intelij but to no success. The painful part is that this package is nowhere to be found online. Below is my pom file.

<?xml version="1.0" encoding="UTF-8"?>

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd&quot;>

&lt;modelVersion&gt;4.0.0&lt;/modelVersion&gt;
&lt;groupId&gt;com.safaricom.integrations&lt;/groupId&gt;
&lt;artifactId&gt;ms-ussd-puk-outbound-dialer&lt;/artifactId&gt;
&lt;packaging&gt;jar&lt;/packaging&gt;
&lt;version&gt;1.0-SNAPSHOT&lt;/version&gt;
&lt;name&gt;ms-ussd-puk-outbound-dialer&lt;/name&gt;
&lt;properties&gt;
&lt;project.build.sourceEncoding&gt;UTF-8&lt;/project.build.sourceEncoding&gt;
&lt;project.reporting.outputEncoding&gt;UTF-8&lt;/project.reporting.outputEncoding&gt;
&lt;spring.boot-version&gt;3.1.0&lt;/spring.boot-version&gt;
&lt;/properties&gt;
&lt;dependencyManagement&gt;
&lt;dependencies&gt;
&lt;!-- Spring Boot BOM --&gt;
&lt;dependency&gt;
&lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
&lt;artifactId&gt;spring-boot-dependencies&lt;/artifactId&gt;
&lt;version&gt;${spring.boot-version}&lt;/version&gt;
&lt;type&gt;pom&lt;/type&gt;
&lt;scope&gt;import&lt;/scope&gt;
&lt;/dependency&gt;
&lt;!-- Camel BOM --&gt;
&lt;dependency&gt;
&lt;groupId&gt;org.apache.camel.springboot&lt;/groupId&gt;
&lt;artifactId&gt;camel-spring-boot-bom&lt;/artifactId&gt;
&lt;version&gt;4.0.0-M2&lt;/version&gt;
&lt;type&gt;pom&lt;/type&gt;
&lt;scope&gt;import&lt;/scope&gt;
&lt;/dependency&gt;
&lt;dependency&gt;
&lt;groupId&gt;org.springframework.cloud&lt;/groupId&gt;
&lt;artifactId&gt;spring-cloud-dependencies&lt;/artifactId&gt;
&lt;version&gt;2022.0.2&lt;/version&gt;
&lt;type&gt;pom&lt;/type&gt;
&lt;scope&gt;import&lt;/scope&gt;
&lt;/dependency&gt;
&lt;/dependencies&gt;
&lt;/dependencyManagement&gt;
&lt;dependencies&gt;
&lt;dependency&gt;
&lt;groupId&gt;org.yaml&lt;/groupId&gt;
&lt;artifactId&gt;snakeyaml&lt;/artifactId&gt;
&lt;version&gt;2.0&lt;/version&gt;
&lt;/dependency&gt;
&lt;!-- Spring Boot --&gt;
&lt;dependency&gt;
&lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
&lt;artifactId&gt;spring-boot-starter-web&lt;/artifactId&gt;
&lt;exclusions&gt;
&lt;exclusion&gt;
&lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
&lt;artifactId&gt;spring-boot-starter-tomcat&lt;/artifactId&gt;
&lt;/exclusion&gt;
&lt;/exclusions&gt;
&lt;/dependency&gt;
&lt;dependency&gt;
&lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
&lt;artifactId&gt;spring-boot-starter-undertow&lt;/artifactId&gt;
&lt;/dependency&gt;
&lt;dependency&gt;
&lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
&lt;artifactId&gt;spring-boot-starter-actuator&lt;/artifactId&gt;
&lt;/dependency&gt;
&lt;dependency&gt;
&lt;groupId&gt;org.projectlombok&lt;/groupId&gt;
&lt;artifactId&gt;lombok&lt;/artifactId&gt;
&lt;version&gt;1.18.26&lt;/version&gt;
&lt;scope&gt;provided&lt;/scope&gt;
&lt;/dependency&gt;
&lt;!-- Camel --&gt;
&lt;dependency&gt;
&lt;groupId&gt;org.apache.camel.springboot&lt;/groupId&gt;
&lt;artifactId&gt;camel-spring-boot-starter&lt;/artifactId&gt;
&lt;/dependency&gt;
&lt;dependency&gt;
&lt;groupId&gt;org.apache.camel.springboot&lt;/groupId&gt;
&lt;artifactId&gt;camel-stream-starter&lt;/artifactId&gt;
&lt;/dependency&gt;
&lt;dependency&gt;
&lt;groupId&gt;org.apache.camel.springboot&lt;/groupId&gt;
&lt;artifactId&gt;camel-servlet-starter&lt;/artifactId&gt;
&lt;/dependency&gt;
&lt;dependency&gt;
&lt;groupId&gt;org.apache.camel.springboot&lt;/groupId&gt;
&lt;artifactId&gt;camel-http-starter&lt;/artifactId&gt;
&lt;/dependency&gt;
&lt;dependency&gt;
&lt;groupId&gt;org.apache.camel.springboot&lt;/groupId&gt;
&lt;artifactId&gt;camel-jackson-starter&lt;/artifactId&gt;
&lt;/dependency&gt;
&lt;!-- Oracle JDBC --&gt;
&lt;dependency&gt;
&lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
&lt;artifactId&gt;spring-boot-starter-jdbc&lt;/artifactId&gt;
&lt;/dependency&gt;
&lt;dependency&gt;
&lt;groupId&gt;com.oracle.database.jdbc&lt;/groupId&gt;
&lt;artifactId&gt;ojdbc11&lt;/artifactId&gt;
&lt;version&gt;21.1.0.0&lt;/version&gt;
&lt;/dependency&gt;
&lt;!--database &amp; jpa stuff--&gt;
&lt;dependency&gt;
&lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
&lt;artifactId&gt;spring-boot-starter-data-jpa&lt;/artifactId&gt;
&lt;/dependency&gt;
&lt;dependency&gt;
&lt;groupId&gt;jakarta.persistence&lt;/groupId&gt;
&lt;artifactId&gt;jakarta.persistence-api&lt;/artifactId&gt;
&lt;version&gt;3.1.0&lt;/version&gt;
&lt;/dependency&gt;
&lt;!-- Kafka --&gt;
&lt;dependency&gt;
&lt;groupId&gt;org.apache.camel&lt;/groupId&gt;
&lt;artifactId&gt;camel-kafka&lt;/artifactId&gt;
&lt;version&gt;3.4.0&lt;/version&gt;
&lt;/dependency&gt;
&lt;!-- JSON --&gt;
&lt;dependency&gt;
&lt;groupId&gt;org.json&lt;/groupId&gt;
&lt;artifactId&gt;json&lt;/artifactId&gt;
&lt;version&gt;20230227&lt;/version&gt;
&lt;/dependency&gt;
&lt;!-- Security --&gt;
&lt;dependency&gt;
&lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
&lt;artifactId&gt;spring-boot-starter-oauth2-client&lt;/artifactId&gt;
&lt;/dependency&gt;
&lt;dependency&gt;
&lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
&lt;artifactId&gt;spring-boot-starter-security&lt;/artifactId&gt;
&lt;/dependency&gt;
&lt;dependency&gt;
&lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
&lt;artifactId&gt;spring-boot-starter-oauth2-resource-server&lt;/artifactId&gt;
&lt;/dependency&gt;
&lt;!-- End Security --&gt;
&lt;!-- Veracode dependencies --&gt;
&lt;dependency&gt;
&lt;groupId&gt;org.springframework&lt;/groupId&gt;
&lt;artifactId&gt;spring-webmvc&lt;/artifactId&gt;
&lt;version&gt;6.0.8&lt;/version&gt;
&lt;/dependency&gt;
&lt;dependency&gt;
&lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
&lt;artifactId&gt;spring-boot-actuator-autoconfigure&lt;/artifactId&gt;
&lt;version&gt;3.0.6&lt;/version&gt;
&lt;/dependency&gt;
&lt;dependency&gt;
&lt;groupId&gt;org.springframework&lt;/groupId&gt;
&lt;artifactId&gt;spring-expression&lt;/artifactId&gt;
&lt;version&gt;6.0.8&lt;/version&gt;
&lt;/dependency&gt;
&lt;dependency&gt;
&lt;groupId&gt;org.springframework.security&lt;/groupId&gt;
&lt;artifactId&gt;spring-security-web&lt;/artifactId&gt;
&lt;version&gt;6.0.3&lt;/version&gt;
&lt;/dependency&gt;
&lt;dependency&gt;
&lt;groupId&gt;net.minidev&lt;/groupId&gt;
&lt;artifactId&gt;json-smart&lt;/artifactId&gt;
&lt;version&gt;2.4.10&lt;/version&gt;
&lt;/dependency&gt;
&lt;!-- end --&gt;
&lt;!-- Test --&gt;
&lt;dependency&gt;
&lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
&lt;artifactId&gt;spring-boot-starter-test&lt;/artifactId&gt;
&lt;scope&gt;test&lt;/scope&gt;
&lt;/dependency&gt;
&lt;dependency&gt;
&lt;groupId&gt;org.apache.camel&lt;/groupId&gt;
&lt;artifactId&gt;camel-test-spring-junit5&lt;/artifactId&gt;
&lt;scope&gt;test&lt;/scope&gt;
&lt;/dependency&gt;
&lt;/dependencies&gt;
&lt;build&gt;
&lt;plugins&gt;
&lt;plugin&gt;
&lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;
&lt;artifactId&gt;maven-compiler-plugin&lt;/artifactId&gt;
&lt;version&gt;3.10.1&lt;/version&gt;
&lt;configuration&gt;
&lt;release&gt;11&lt;/release&gt;
&lt;/configuration&gt;
&lt;/plugin&gt;
&lt;plugin&gt;
&lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
&lt;artifactId&gt;spring-boot-maven-plugin&lt;/artifactId&gt;
&lt;version&gt;${spring.boot-version}&lt;/version&gt;
&lt;executions&gt;
&lt;execution&gt;
&lt;goals&gt;
&lt;goal&gt;repackage&lt;/goal&gt;
&lt;/goals&gt;
&lt;/execution&gt;
&lt;/executions&gt;
&lt;/plugin&gt;
&lt;/plugins&gt;
&lt;/build&gt;

</project>

答案1

得分: 1

你在pom.xml中混合使用了不同版本的Camel。对于Spring Boot 3,你必须使用Camel v4。而且在pom.xml中使用了camel-kafka 3.4.0,请不要这样做。请使用Camel v4配合camel-kafka(如果使用Spring Boot,请使用camel-kafka-starter)。

英文:

You have mixed versions of Camel in the pom.xml. For Spring Boot 3 you MUST use Camel v4. And you have a camel-kafka 3.4.0 in the pom.xml. Do not do that. Use camel-kafka with camel v4 (and use camel-kafka-starter if using spring boot)

huangapple
  • 本文由 发表于 2023年7月17日 14:39:48
  • 转载请务必保留本文链接:https://go.coder-hub.com/76702019.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定