Отсутствует опция конфигурации "advanced.netty.daemon" при попытке создать CqlSession - PullRequest
0 голосов
/ 04 ноября 2019

Я пытаюсь использовать Java-драйвер datastax в пакете OSGi в Apache Karaf. Я получил разрешение всех зависимостей, но теперь я столкнулся с проблемой, когда драйвер не может найти необходимые параметры конфигурации.

Я изменил загрузчик класса Thread, который заставил его распознавать «application.conf»Я скопировал с https://github.com/datastax/java-driver/blob/4.3.0/examples/src/main/resources/application.conf, но по-прежнему отсутствует ключ "advanced.netty.daemon"

public class CassandraAPIImpl implements CassandraAPI {

    private CqlSession session;

    public CassandraAPIImpl() {

        ClassLoader regularClassLoader = Thread.currentThread().getContextClassLoader();
        Thread.currentThread().setContextClassLoader(CassandraAPIImpl.class.getClassLoader());
        try {
            session = CqlSession.builder().build();
        } finally {
            Thread.currentThread().setContextClassLoader(regularClassLoader);
        }

    }
}

Ошибка, о которой идет речь:

ndraAPIImpl(13)] Error during instantiation of the implementation object
com.typesafe.config.ConfigException$Missing: application.conf @ bundle://211.3:1/application.conf: 16: No configuration setting found for key 'advanced.netty.daemon'
    at com.typesafe.config.impl.SimpleConfig.findKeyOrNull(SimpleConfig.java:156) ~[?:?]
    at com.typesafe.config.impl.SimpleConfig.findOrNull(SimpleConfig.java:174) ~[?:?]
    at com.typesafe.config.impl.SimpleConfig.findOrNull(SimpleConfig.java:180) ~[?:?]
    at com.typesafe.config.impl.SimpleConfig.findOrNull(SimpleConfig.java:180) ~[?:?]
    at com.typesafe.config.impl.SimpleConfig.find(SimpleConfig.java:188) ~[?:?]
    at com.typesafe.config.impl.SimpleConfig.find(SimpleConfig.java:193) ~[?:?]
    at com.typesafe.config.impl.SimpleConfig.getBoolean(SimpleConfig.java:218) ~[?:?]
    at java.util.concurrent.ConcurrentHashMap.computeIfAbsent(ConcurrentHashMap.java:1660) ~[?:?]
    at com.datastax.oss.driver.internal.core.config.typesafe.TypesafeDriverExecutionProfile.getCached(TypesafeDriverExecutionProfile.java:291) ~[?:?]
    at com.datastax.oss.driver.internal.core.config.typesafe.TypesafeDriverExecutionProfile.getBoolean(TypesafeDriverExecutionProfile.java:64) ~[?:?]
    at com.datastax.oss.driver.internal.core.context.DefaultNettyOptions.<init>(DefaultNettyOptions.java:64) ~[?:?]
    at com.datastax.oss.driver.internal.core.context.DefaultDriverContext.buildNettyOptions(DefaultDriverContext.java:403) ~[?:?]
    at com.datastax.oss.driver.internal.core.util.concurrent.LazyReference.get(LazyReference.java:55) ~[?:?]
    at com.datastax.oss.driver.internal.core.context.DefaultDriverContext.getNettyOptions(DefaultDriverContext.java:654) ~[?:?]
    at com.datastax.oss.driver.internal.core.session.DefaultSession.<init>(DefaultSession.java:100) ~[?:?]
    at com.datastax.oss.driver.internal.core.session.DefaultSession.init(DefaultSession.java:85) ~[?:?]
    at com.datastax.oss.driver.api.core.session.SessionBuilder.buildDefaultSessionAsync(SessionBuilder.java:548) ~[?:?]
    at com.datastax.oss.driver.api.core.session.SessionBuilder.buildAsync(SessionBuilder.java:487) ~[?:?]
    at com.datastax.oss.driver.api.core.session.SessionBuilder.build(SessionBuilder.java:501) ~[?:?]
    at command.login.CassandraAPIImpl.<init>(CassandraAPIImpl.java:17) ~[?:?]

...