0

In our company, we do one project and use apache, Cassandra. Until recently, we used an older driver. Yesterday, we tried to replace it with the latest 4.3.0. We connect to the database, everything works as it should. The problem is when I try to replace the ear file or add another subproject that uses the same code.

At this point, I get this error.

13:23:21,142 ERROR [org.jboss.msc.service.fail] (ServerService Thread Pool -- 97) MSC000001: Failed to start service jboss.deployment.subunit."test-ear.ear"."test-ejb.jar".component.TestBean.START: org.jboss.msc.service.StartException in service jboss.deployment.subunit."test-ear.ear"."test-ejb.jar".component.TestBean.START: java.lang.IllegalStateException: WFLYEE0042: Failed to construct component instance
at org.jboss.as.ee@18.0.1.Final//org.jboss.as.ee.component.ComponentStartService$1.run(ComponentStartService.java:57)
at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
at org.jboss.threads@2.3.3.Final//org.jboss.threads.ContextClassLoaderSavingRunnable.run(ContextClassLoaderSavingRunnable.java:35)
at org.jboss.threads@2.3.3.Final//org.jboss.threads.EnhancedQueueExecutor.safeRun(EnhancedQueueExecutor.java:1982)
at org.jboss.threads@2.3.3.Final//org.jboss.threads.EnhancedQueueExecutor$ThreadBody.doRunTask(EnhancedQueueExecutor.java:1486)
at org.jboss.threads@2.3.3.Final//org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1377)
at java.base/java.lang.Thread.run(Thread.java:834)
at org.jboss.threads@2.3.3.Final//org.jboss.threads.JBossThread.run(JBossThread.java:485)
Caused by: java.lang.IllegalStateException: WFLYEE0042: Failed to construct component instance
at org.jboss.as.ee@18.0.1.Final//org.jboss.as.ee.component.BasicComponent.constructComponentInstance(BasicComponent.java:163)
at org.jboss.as.ee@18.0.1.Final//org.jboss.as.ee.component.BasicComponent.constructComponentInstance(BasicComponent.java:134)
at org.jboss.as.ee@18.0.1.Final//org.jboss.as.ee.component.BasicComponent.createInstance(BasicComponent.java:88)
at org.jboss.as.ejb3@18.0.1.Final//org.jboss.as.ejb3.component.singleton.SingletonComponent.getComponentInstance(SingletonComponent.java:127)
at org.jboss.as.ejb3@18.0.1.Final//org.jboss.as.ejb3.component.singleton.SingletonComponent.start(SingletonComponent.java:141)
at org.jboss.as.ee@18.0.1.Final//org.jboss.as.ee.component.ComponentStartService$1.run(ComponentStartService.java:54)
... 8 more
Caused by: javax.ejb.EJBException: com.datastax.oss.driver.api.core.AllNodesFailedException: Could not reach any contact point, make sure you've provided valid addresses (showing first 1, use getErrors() for more: Node(endPoint=/127.0.0.1:9042, hostId=null, hashCode=3bad1448): com.datastax.oss.driver.api.core.connection.ConnectionInitException: [s0|control|connecting...] init query OPTIONS: error writing )
at org.jboss.as.ejb3@18.0.1.Final//org.jboss.as.ejb3.tx.BMTInterceptor.handleException(BMTInterceptor.java:83)
at org.jboss.as.ejb3@18.0.1.Final//org.jboss.as.ejb3.tx.EjbBMTInterceptor.checkStatelessDone(EjbBMTInterceptor.java:91)
at org.jboss.as.ejb3@18.0.1.Final//org.jboss.as.ejb3.tx.EjbBMTInterceptor.handleInvocation(EjbBMTInterceptor.java:106)
at org.jboss.as.ejb3@18.0.1.Final//org.jboss.as.ejb3.tx.BMTInterceptor.processInvocation(BMTInterceptor.java:57)
at org.jboss.invocation@1.5.2.Final//org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:422)
at org.jboss.as.weld@18.0.1.Final//org.jboss.as.weld.injection.WeldInjectionContextInterceptor.processInvocation(WeldInjectionContextInterceptor.java:43)
at org.jboss.invocation@1.5.2.Final//org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:422)
at org.jboss.as.ejb3@18.0.1.Final//org.jboss.as.ejb3.component.interceptors.CurrentInvocationContextInterceptor.processInvocation(CurrentInvocationContextInterceptor.java:41)
at org.jboss.invocation@1.5.2.Final//org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:422)
at org.jboss.as.ee@18.0.1.Final//org.jboss.as.ee.concurrent.ConcurrentContextInterceptor.processInvocation(ConcurrentContextInterceptor.java:45)
at org.jboss.invocation@1.5.2.Final//org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:422)
at org.jboss.invocation@1.5.2.Final//org.jboss.invocation.ContextClassLoaderInterceptor.processInvocation(ContextClassLoaderInterceptor.java:60)
at org.jboss.invocation@1.5.2.Final//org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:422)
at org.jboss.as.ejb3@18.0.1.Final//org.jboss.as.ejb3.component.singleton.StartupCountDownInterceptor.processInvocation(StartupCountDownInterceptor.java:25)
at org.jboss.invocation@1.5.2.Final//org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:422)
at org.jboss.invocation@1.5.2.Final//org.jboss.invocation.ChainedInterceptor.processInvocation(ChainedInterceptor.java:53)
at org.jboss.as.ee@18.0.1.Final//org.jboss.as.ee.component.BasicComponent.constructComponentInstance(BasicComponent.java:161)
... 13 more

I tried to look for this problem on the Internet, study their documentation. I did not find a solution.

My very basic code that connects to the database.

@PostConstruct
public void start() {
    log.info("start");
    CqlSessionBuilder builder = CqlSession.builder();
    builder.addContactEndPoint(new DefaultEndPoint(new InetSocketAddress("127.0.0.1", 9042)));
    builder.withLocalDatacenter("datacenter1");
    session = builder.build();
}

@PreDestroy
public void stop() {
    log.log(Level.INFO, "stop");
    session.close();
}

I use wildfly as a server. When I replace the ear file or add another one with the same code, I get an error.

Any ideas on how to solve it?

Minhaj Patel
  • 579
  • 1
  • 6
  • 21
  • What host and port were you using to connect to Cassandra with before? The `AllNodesFailedException` indicates that the driver can't connect to Cassandra at `127.0.0.1:9042`. Is Cassandra up and running? – ck1 Dec 04 '19 at 13:54
  • @ck1 We use the same host and port as before. As I said during the first deployment, there is no problem. Everything connects and works. When I replace the ear file or deploy a second ear file with the same code, it will produce an error. When the database is unavailable, it writes only "No host Available" but also writes "init query OPTIONS: error writing". At first I thought it was an unfinished session, but I close every session. – Erik Juríček Dec 04 '19 at 14:07
  • You no need to provide the Local host IP and port when you connect to your local datacenter. Cassandra driver default settings would take are of that. Please make sure your Cassandra local data center is up and running – GAK Dec 04 '19 at 15:40
  • @GAK Thank you but on the production version running cassandra on another ip. The data center is running. Unfortunately, this did not solve any problem. – Erik Juríček Dec 05 '19 at 05:57

1 Answers1

1

I have a solution. After 2 days of searching and testing everything, I discovered a mistake. The bug is in Wildfly18, io.netty. Once I packed io.netty-all into the project and removed the provided with Wildfly everything works.

Probably Wildfly18 provides some bad version that bugs it.