vitaB opened a new issue #1200:
URL: https://github.com/apache/camel-quarkus/issues/1200
When starting a webhook telegram route the class `TelegramEndpoint` is
throwing a null pointer exception, because TelegramService is not initialized.
I don't think it's due to `camel-telegram`, because it works without quarkus.
Here the exception:
```
2020-05-07 19:11:05,616 ERROR [io.qua.run.Application] (main) Error running
Quarkus application: java.lang.RuntimeException: Failed to start quarkus
at io.quarkus.runner.ApplicationImpl.doStart(ApplicationImpl.zig:315)
at io.quarkus.runtime.Application.start(Application.java:89)
at
io.quarkus.runtime.ApplicationLifecycleManager.run(ApplicationLifecycleManager.java:90)
at io.quarkus.runtime.Quarkus.run(Quarkus.java:61)
at io.quarkus.runtime.Quarkus.run(Quarkus.java:38)
at io.quarkus.runtime.Quarkus.run(Quarkus.java:106)
at io.quarkus.runner.GeneratedMain.main(GeneratedMain.zig:29)
Caused by: java.lang.RuntimeException:
org.apache.camel.FailedToStartRouteException: Failed to start route route1
because of null
at
org.apache.camel.quarkus.core.CamelMainRecorder.start(CamelMainRecorder.java:98)
at
io.quarkus.deployment.steps.Main$start49.deploy_0(Main$start49.zig:97)
at io.quarkus.deployment.steps.Main$start49.deploy(Main$start49.zig:36)
at io.quarkus.runner.ApplicationImpl.doStart(ApplicationImpl.zig:254)
... 6 more
Caused by: org.apache.camel.FailedToStartRouteException: Failed to start
route route1 because of null
at
org.apache.camel.impl.engine.RouteService.warmUp(RouteService.java:125)
at
org.apache.camel.impl.engine.AbstractCamelContext.doWarmUpRoutes(AbstractCamelContext.java:3313)
at
org.apache.camel.impl.engine.AbstractCamelContext.safelyStartRouteServices(AbstractCamelContext.java:3206)
at
org.apache.camel.impl.engine.AbstractCamelContext.doStartOrResumeRoutes(AbstractCamelContext.java:2992)
at
org.apache.camel.impl.engine.AbstractCamelContext.doStartCamel(AbstractCamelContext.java:2790)
at
org.apache.camel.impl.engine.AbstractCamelContext.doStartContext(AbstractCamelContext.java:2643)
at
org.apache.camel.impl.engine.AbstractCamelContext.doStart(AbstractCamelContext.java:2606)
at
org.apache.camel.support.service.BaseService.start(BaseService.java:115)
at
org.apache.camel.impl.engine.AbstractCamelContext.start(AbstractCamelContext.java:2448)
at org.apache.camel.quarkus.core.CamelMain.doStart(CamelMain.java:56)
at
org.apache.camel.support.service.BaseService.start(BaseService.java:115)
at
org.apache.camel.quarkus.core.CamelMainRecorder.start(CamelMainRecorder.java:96)
... 9 more
Caused by: java.lang.NullPointerException
at
org.apache.camel.component.telegram.TelegramEndpoint.registerWebhook(TelegramEndpoint.java:139)
at
org.apache.camel.component.webhook.WebhookEndpoint.doStart(WebhookEndpoint.java:88)
at
org.apache.camel.support.service.BaseService.start(BaseService.java:115)
at
org.apache.camel.support.service.ServiceHelper.startService(ServiceHelper.java:84)
at
org.apache.camel.impl.engine.RouteService.doWarmUp(RouteService.java:141)
at
org.apache.camel.impl.engine.RouteService.warmUp(RouteService.java:123)
... 20 more
```
my code example
```
import org.apache.camel.quarkus.kotlin.routes
import javax.enterprise.context.ApplicationScoped
import javax.enterprise.inject.Produces
@ApplicationScoped
class TelegramRoute() {
@Produces
fun myRoutes() = routes {
from("webhook:telegram:bots")
.log("\${body}")
}
}
```
and the pom
```
<?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/xsd/maven-4.0.0.xsd">
<parent>
<groupId>org.apache.camel.quarkus</groupId>
<artifactId>camel-quarkus-bom</artifactId>
<version>1.0.0-M7</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<groupId>com.bot-test</groupId>
<artifactId>camel-quarkus-telegram-bot</artifactId>
<version>1.0-SNAPSHOT</version>
<properties>
<compiler-plugin.version>3.8.1</compiler-plugin.version>
<kotlin.version>1.3.72</kotlin.version>
<surefire-plugin.version>2.22.1</surefire-plugin.version>
</properties>
<dependencies>
<dependency>
<groupId>org.apache.camel.quarkus</groupId>
<artifactId>camel-quarkus-kotlin</artifactId>
</dependency>
<dependency>
<groupId>org.apache.camel.quarkus</groupId>
<artifactId>camel-quarkus-platform-http</artifactId>
</dependency>
<dependency>
<groupId>org.apache.camel.quarkus</groupId>
<artifactId>camel-quarkus-log</artifactId>
</dependency>
<dependency>
<groupId>org.apache.camel.quarkus</groupId>
<artifactId>camel-quarkus-telegram</artifactId>
</dependency>
<dependency>
<groupId>org.apache.camel.quarkus</groupId>
<artifactId>camel-quarkus-rest</artifactId>
</dependency>
</dependencies>
<build>
<sourceDirectory>src/main/kotlin</sourceDirectory>
<testSourceDirectory>src/test/kotlin</testSourceDirectory>
<plugins>
<plugin>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-maven-plugin</artifactId>
<executions>
<execution>
<id>build</id>
<goals>
<goal>build</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>${compiler-plugin.version}</version>
</plugin>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<version>${surefire-plugin.version}</version>
<configuration>
<systemProperties>
<java.util.logging.manager>org.jboss.logmanager.LogManager</java.util.logging.manager>
</systemProperties>
</configuration>
</plugin>
<plugin>
<groupId>org.jetbrains.kotlin</groupId>
<artifactId>kotlin-maven-plugin</artifactId>
<version>${kotlin.version}</version>
<executions>
<execution>
<id>compile</id>
<goals>
<goal>compile</goal>
</goals>
</execution>
<execution>
<id>test-compile</id>
<goals>
<goal>test-compile</goal>
</goals>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>org.jetbrains.kotlin</groupId>
<artifactId>kotlin-maven-allopen</artifactId>
<version>${kotlin.version}</version>
</dependency>
</dependencies>
<configuration>
<javaParameters>true</javaParameters>
<compilerPlugins>
<plugin>all-open</plugin>
</compilerPlugins>
<pluginOptions>
<option>all-open:annotation=javax.ws.rs.Path</option>
<option>all-open:annotation=javax.enterprise.context.ApplicationScoped</option>
<option>all-open:annotation=io.quarkus.test.junit.QuarkusTest</option>
</pluginOptions>
</configuration>
</plugin>
</plugins>
</build>
<profiles>
<profile>
<id>native</id>
<activation>
<property>
<name>native</name>
</property>
</activation>
<properties>
<quarkus.package.type>native</quarkus.package.type>
</properties>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>integration-test</goal>
<goal>verify</goal>
</goals>
<configuration>
<systemProperties>
<native.image.path>
${project.build.directory}/${project.build.finalName}-runner
</native.image.path>
</systemProperties>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project>
```
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]