You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@camel.apache.org by "Jan Bednar (Jira)" <ji...@apache.org> on 2020/09/22 22:26:00 UTC

[jira] [Resolved] (CAMEL-15569) Nullpointer exception at Timer component

     [ https://issues.apache.org/jira/browse/CAMEL-15569?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Jan Bednar resolved CAMEL-15569.
--------------------------------
    Fix Version/s:     (was: Future)
         Assignee: Jan Bednar
       Resolution: Information Provided

Please dont create Jira issue for something, what is clearly your error and not a bug in Apache Camel. We are active on mailing list, zulip and StackOverflow and ready to help you. Jira is here for reporting bugs.

First read this - [https://camel.apache.org/manual/latest/support.html]
{quote}Please refrain from immediately opening a ticket in the issue tracker unless you are certain it’s a problem in the Camel software. If you are in doubt, we appreciate asking the [mailing list|https://camel.apache.org/manual/latest/mailing-lists.html], or [Chat room|https://camel.zulipchat.com/] first.
{quote}
And then look at my answer to your question on SO - [https://stackoverflow.com/a/64018354/8576169]
{quote}Shadowing jars is quite magic, because you need to handle duplicate entries somehow. In Apache Camel there are many {{META-INF}} service files, which are getting overwritten with your simple {{jar}} approach. Use {{com.github.johnrengelman.shadow}} which is allowing you to customize merging process.
{code:java}
shadowJar {
    mergeServiceFiles() // Tell plugin to merge duplicate service files
    manifest {
        attributes 'Main-Class': 'com.eip.App'
    }
}
apply plugin: 'com.github.johnrengelman.shadow'
{code}
{quote}

> Nullpointer exception at Timer component
> ----------------------------------------
>
>                 Key: CAMEL-15569
>                 URL: https://issues.apache.org/jira/browse/CAMEL-15569
>             Project: Camel
>          Issue Type: Bug
>          Components: camel-core
>    Affects Versions: 3.5.0
>         Environment: *Java*
> openjdk version "1.8.0_265"
> OpenJDK Runtime Environment (build 1.8.0_265-8u265-b01-0ubuntu2~18.04-b01)
> OpenJDK 64-Bit Server VM (build 25.265-b01, mixed mode)
>  
> *Gradle 6.5*
>            Reporter: Gonzalo Mendoza
>            Assignee: Jan Bednar
>            Priority: Major
>         Attachments: Screenshot from 2020-09-22 16-42-44.png
>
>
> I'm trying to implement a timer using Camel 3.5 at Gradle project with OpenJDK8 as next
> {code:java}
> from("timer://watchexpiration?fixedRate=true&period=600000&delay=0")...
> {code}
> But, after build the fat jar using 
> 1. Build with:  {code}./gradlew build{code} 
> 2. Run with:  {code}java -jar build/libs/app.jar{code}
> After that  I receive the next error at console
> {code:java}
> Caused by: org.apache.camel.ResolveEndpointFailedException: Failed to resolve endpoint: timer://watchexpiration?delay=0&fixedRate=true&period=600000 due to: Error binding property (delay=0) with name: delay on bean: timer://watchexpiration?delay=0&fixedRate=true&period=600000 with value: 0
>     at org.apache.camel.impl.engine.AbstractCamelContext.doGetEndpoint(AbstractCamelContext.java:888)
>     at org.apache.camel.impl.engine.AbstractCamelContext.getEndpoint(AbstractCamelContext.java:777)
>     at org.apache.camel.support.CamelContextHelper.getMandatoryEndpoint(CamelContextHelper.java:58)
>     at org.apache.camel.reifier.AbstractReifier.resolveEndpoint(AbstractReifier.java:177)
>     at org.apache.camel.reifier.RouteReifier.doCreateRoute(RouteReifier.java:250)
>     at org.apache.camel.reifier.RouteReifier.createRoute(RouteReifier.java:112)
> {code}
> But If I run using {code}./gradlew run{code} then works fine as I expected. I don't want to use any frameworks for this project. I feel this is just a config issue or something is wrong with my configuration I guess.
> How can I fix it?
> *build.gradle*
> {code:java}
>  plugins {
>     id 'java'
>     id 'application'
>     id 'com.github.sherter.google-java-format' version '0.8'
> }
> repositories {
>     jcenter()
> }
> dependencies {
>     implementation 'com.google.guava:guava:29.0-jre'
>     testImplementation 'org.junit.jupiter:junit-jupiter-api:5.6.2'
>     testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.6.2'
>     // Camel
>     compile group: 'org.apache.camel', name: 'camel-core', version: '3.5.0'
>     compile group: 'org.apache.camel', name: 'camel-file', version: '3.5.0'
>     compile group: 'org.apache.camel', name: 'camel-file-watch', version: '3.5.0'
>     compile group: 'org.apache.camel', name: 'camel-xstream', version: '3.5.0'
>     compile group: 'org.apache.camel', name: 'camel-gson', version: '3.5.0'
>     compile group: 'org.apache.camel', name: 'camel-rest', version: '3.5.0'
>     compile group: 'org.apache.camel', name: 'camel-servlet', version: '3.5.0'
>     compile group: 'org.apache.camel', name: 'camel-http', version: '3.5.0'
>     compile group: 'org.apache.camel', name: 'camel-jackson', version: '3.5.0'
>     compile group: 'org.apache.camel', name: 'camel-quartz', version: '3.5.0'
>     compile group: 'org.apache.camel', name: 'camel-timer', version: '3.5.0'
>     compile group: 'org.slf4j', name: 'slf4j-simple', version: '1.7.30'
>     compile group: 'org.slf4j', name: 'slf4j-api', version: '1.7.30'
>     // Dev Libs
>     compileOnly("org.projectlombok:lombok:1.18.12")
>     annotationProcessor("org.projectlombok:lombok:1.18.12")
>     compile group: 'org.apache.commons', name: 'commons-csv', version: '1.4'
> }
> application {
>     mainClassName = 'com.eip.App'
> }
> configurations {
>     // configuration that holds jars to include in the jar
>     extraLibs
> }
> jar {
>     manifest {
>         attributes(
>                 'Main-Class': 'com.beam.agent.App'
>         )
>     }
>     from {
>         configurations.runtimeClasspath.collect { it.isDirectory() ? it : zipTree(it) }
>     }
> }
> test {
>     useJUnitPlatform()
> }
> googleJavaFormat {
>     exclude '**/App.java'
> }
> {code}



--
This message was sent by Atlassian Jira
(v8.3.4#803005)