Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error with leader election examples #548

Closed
nicolaferraro opened this issue Nov 10, 2020 · 1 comment · Fixed by #549
Closed

Error with leader election examples #548

nicolaferraro opened this issue Nov 10, 2020 · 1 comment · Fixed by #549
Labels
kind/bug Something isn't working

Comments

@nicolaferraro
Copy link
Member

Simple java integration:

import org.apache.camel.builder.RouteBuilder;

public class Master extends RouteBuilder {
  @Override
  public void configure() throws Exception {
	  from("master:lock:timer:tick")
	  .setHeader("m").constant("string!")
	  .setBody().simple("Magic${header.m}")
      .log("${body}");
  }
}

When running I get:

master-6f6d965bbb-vwvvg integration Exception in thread "main" java.lang.ExceptionInInitializerError
master-6f6d965bbb-vwvvg integration 	at io.quarkus.runner.ApplicationImpl.<clinit>(ApplicationImpl.zig:47)
master-6f6d965bbb-vwvvg integration 	at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
master-6f6d965bbb-vwvvg integration 	at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
master-6f6d965bbb-vwvvg integration 	at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
master-6f6d965bbb-vwvvg integration 	at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:490)
master-6f6d965bbb-vwvvg integration 	at java.base/java.lang.Class.newInstance(Class.java:584)
master-6f6d965bbb-vwvvg integration 	at io.quarkus.runtime.Quarkus.run(Quarkus.java:61)
master-6f6d965bbb-vwvvg integration 	at io.quarkus.runtime.Quarkus.run(Quarkus.java:38)
master-6f6d965bbb-vwvvg integration 	at io.quarkus.runtime.Quarkus.run(Quarkus.java:104)
master-6f6d965bbb-vwvvg integration 	at io.quarkus.runner.GeneratedMain.main(GeneratedMain.zig:29)
master-6f6d965bbb-vwvvg integration Caused by: java.lang.RuntimeException: java.io.IOException: Is a directory
master-6f6d965bbb-vwvvg integration 	at org.apache.camel.k.support.RuntimeSupport.loadUserProperties(RuntimeSupport.java:375)
master-6f6d965bbb-vwvvg integration 	at org.apache.camel.k.quarkus.ApplicationConfigSourceProvider.getConfigSources(ApplicationConfigSourceProvider.java:31)
master-6f6d965bbb-vwvvg integration 	at io.smallrye.config.SmallRyeConfigBuilder.lambda$discoverSources$0(SmallRyeConfigBuilder.java:95)
master-6f6d965bbb-vwvvg integration 	at java.base/java.lang.Iterable.forEach(Iterable.java:75)
master-6f6d965bbb-vwvvg integration 	at io.smallrye.config.SmallRyeConfigBuilder.discoverSources(SmallRyeConfigBuilder.java:95)
master-6f6d965bbb-vwvvg integration 	at io.smallrye.config.SmallRyeConfig.buildConfigSources(SmallRyeConfig.java:80)
master-6f6d965bbb-vwvvg integration 	at io.smallrye.config.SmallRyeConfig.<init>(SmallRyeConfig.java:63)
master-6f6d965bbb-vwvvg integration 	at io.smallrye.config.SmallRyeConfigBuilder.build(SmallRyeConfigBuilder.java:337)
master-6f6d965bbb-vwvvg integration 	at io.quarkus.runtime.generated.Config.<clinit>(Config.zig:293)
master-6f6d965bbb-vwvvg integration 	... 10 more
master-6f6d965bbb-vwvvg integration Caused by: java.io.IOException: Is a directory
master-6f6d965bbb-vwvvg integration 	at java.base/sun.nio.ch.FileDispatcherImpl.read0(Native Method)
master-6f6d965bbb-vwvvg integration 	at java.base/sun.nio.ch.FileDispatcherImpl.read(FileDispatcherImpl.java:48)
master-6f6d965bbb-vwvvg integration 	at java.base/sun.nio.ch.IOUtil.readIntoNativeBuffer(IOUtil.java:276)
master-6f6d965bbb-vwvvg integration 	at java.base/sun.nio.ch.IOUtil.read(IOUtil.java:245)
master-6f6d965bbb-vwvvg integration 	at java.base/sun.nio.ch.FileChannelImpl.read(FileChannelImpl.java:223)
master-6f6d965bbb-vwvvg integration 	at java.base/sun.nio.ch.ChannelInputStream.read(ChannelInputStream.java:65)
master-6f6d965bbb-vwvvg integration 	at java.base/sun.nio.ch.ChannelInputStream.read(ChannelInputStream.java:109)
master-6f6d965bbb-vwvvg integration 	at java.base/sun.nio.ch.ChannelInputStream.read(ChannelInputStream.java:103)
master-6f6d965bbb-vwvvg integration 	at java.base/java.nio.file.Files.read(Files.java:3158)
master-6f6d965bbb-vwvvg integration 	at java.base/java.nio.file.Files.readAllBytes(Files.java:3212)
master-6f6d965bbb-vwvvg integration 	at java.base/java.nio.file.Files.readString(Files.java:3283)
master-6f6d965bbb-vwvvg integration 	at org.apache.camel.k.support.RuntimeSupport$1.visitFile(RuntimeSupport.java:362)
master-6f6d965bbb-vwvvg integration 	at org.apache.camel.k.support.RuntimeSupport$1.visitFile(RuntimeSupport.java:347)
master-6f6d965bbb-vwvvg integration 	at java.base/java.nio.file.Files.walkFileTree(Files.java:2724)
master-6f6d965bbb-vwvvg integration 	at java.base/java.nio.file.Files.walkFileTree(Files.java:2796)
master-6f6d965bbb-vwvvg integration 	at org.apache.camel.k.support.RuntimeSupport.loadUserProperties(RuntimeSupport.java:373)
master-6f6d965bbb-vwvvg integration 	... 18 more
@nicolaferraro nicolaferraro added the kind/bug Something isn't working label Nov 10, 2020
lburgazzoli added a commit to lburgazzoli/apache-camel-k-runtime that referenced this issue Nov 10, 2020
@nicolaferraro
Copy link
Member Author

Is it right that we have two dirs /etc/camel/config and /etc/camel/config.d ?

Directory content:

root@master-6bfb555c7-2vmhs-debug:/etc/camel# ls
conf  conf.d  sources
root@master-6bfb555c7-2vmhs-debug:/etc/camel# cd conf
root@master-6bfb555c7-2vmhs-debug:/etc/camel/conf# ls
application.properties
root@master-6bfb555c7-2vmhs-debug:/etc/camel/conf# cat application.properties 
camel.k.sources[0].language=java
camel.k.sources[0].location=file:/etc/camel/sources/i-source-000/Master.java
camel.k.sources[0].name=Master
root@master-6bfb555c7-2vmhs-debug:/etc/camel/conf# cd ../conf.d/
root@master-6bfb555c7-2vmhs-debug:/etc/camel/conf.d# ls
user.properties
root@master-6bfb555c7-2vmhs-debug:/etc/camel/conf.d# cat user.properties 
customizer.master.enabled=true
customizer.master.configMapName=master-lock
customizer.master.labelKey=camel.apache.org/integration
customizer.master.labelValue=master
root@master-6bfb555c7-2vmhs-debug:/etc/camel/conf.d# cd ../sources/
root@master-6bfb555c7-2vmhs-debug:/etc/camel/sources# ls
i-source-000
root@master-6bfb555c7-2vmhs-debug:/etc/camel/sources# cd i-source-000/
root@master-6bfb555c7-2vmhs-debug:/etc/camel/sources/i-source-000# ls
Master.java
root@master-6bfb555c7-2vmhs-debug:/etc/camel/sources/i-source-000# cat Master.java 
/*
 * Licensed to the Apache Software Foundation (ASF) under one or more
 * contributor license agreements.  See the NOTICE file distributed with
 * this work for additional information regarding copyright ownership.
 * The ASF licenses this file to You under the Apache License, Version 2.0
 * (the "License"); you may not use this file except in compliance with
 * the License.  You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

import org.apache.camel.builder.RouteBuilder;

public class Master extends RouteBuilder {
  @Override
  public void configure() throws Exception {
          from("master:lock:timer:tick")
          .setHeader("m").constant("string!")
          .setBody().simple("Magic${header.m}")
      .log("${body}");
  }
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant