Camel example can't find org.apache.camel.impl.DefaultComponent

时光毁灭记忆、已成空白 提交于 2019-12-24 00:37:34

问题


I've created a small Apache Camel example, but it can't find the class org.apache.camel.impl.DefaultComponent. Here the full error log.

I've looked the class up on search.maven.org, which says it should be contained in org.apache.camel:camel-core. Adding it does not solve my problem. What's wrong in this example?


This is the application

@SpringBootApplication
public class Application {

    public static void main(String[] args) {
        SpringApplication app = new SpringApplication(Application.class);
        app.setWebApplicationType(WebApplicationType.NONE);
        app.run(args);
    }
}

and here the route.

@Component
public class ZmqRoute extends RouteBuilder {

    @Override
    public void configure() throws Exception {
        //from("stream:in").to("stream:out");

        String host = "zmq.devnet.iota.org";
        from("zeromq:tcp://" + host + ":5556?socketType=SUBSCRIBE&topics=tx")
                .to("stream:out")
                .log("${body}");
    }
}

Lastly, here the build.gradle.kts

plugins {
    java
    application
    id("org.springframework.boot") version "2.1.2.RELEASE"
    id("io.spring.dependency-management") version "1.0.6.RELEASE"
}

repositories {
    jcenter()
}

application {
    mainClassName = "org.example.camel.Application"
}

java {
    sourceCompatibility = JavaVersion.VERSION_1_8
    targetCompatibility = JavaVersion.VERSION_1_8
}

tasks.withType<JavaCompile>().configureEach {
    options.compilerArgs.addAll(arrayOf("-Xlint:all"))
    options.encoding = "UTF-8"
}

dependencies {
    val camelVersion = "3.0.0-M1"

    implementation("org.springframework.boot:spring-boot-starter-web")

    implementation("org.apache.camel:camel-spring-boot-starter:$camelVersion")

    implementation("org.apache.camel:camel-stream-starter:$camelVersion")

    //implementation("org.apache.camel:camel-core:$camelVersion")

    implementation("org.apache-extras.camel-extra:camel-zeromq:2.22.0") {
        exclude(module = "zeromq-scala-binding_2.10")
    }

    implementation("org.zeromq:jeromq:0.5.0")

    testImplementation("junit:junit:4.12")
}

回答1:


So basically, after looking at Camel Core 3.0.0.M1, I discovered the .class file for

org.apache.camel.impl.DefaultComponent

doesn't exists anymore!

camel-core-3.0.0-M1.jar\org\apache\camel\impl 

Honestly it seems like a bug to me, or incompatibility with core-zeromq.




回答2:


The class has been moved to https://github.com/apache/camel/blob/master/core/camel-support/src/main/java/org/apache/camel/support/DefaultComponent.java

so on a different package. This was reported also on the migration guide

https://github.com/apache/camel/blob/master/MIGRATION.md#migrating-custom-components



来源:https://stackoverflow.com/questions/55314360/camel-example-cant-find-org-apache-camel-impl-defaultcomponent

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!