0
votes

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 [email protected]//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 [email protected]//org.jboss.threads.ContextClassLoaderSavingRunnable.run(ContextClassLoaderSavingRunnable.java:35)
at [email protected]//org.jboss.threads.EnhancedQueueExecutor.safeRun(EnhancedQueueExecutor.java:1982)
at [email protected]//org.jboss.threads.EnhancedQueueExecutor$ThreadBody.doRunTask(EnhancedQueueExecutor.java:1486)
at [email protected]//org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1377)
at java.base/java.lang.Thread.run(Thread.java:834)
at [email protected]//org.jboss.threads.JBossThread.run(JBossThread.java:485)
Caused by: java.lang.IllegalStateException: WFLYEE0042: Failed to construct component instance
at [email protected]//org.jboss.as.ee.component.BasicComponent.constructComponentInstance(BasicComponent.java:163)
at [email protected]//org.jboss.as.ee.component.BasicComponent.constructComponentInstance(BasicComponent.java:134)
at [email protected]//org.jboss.as.ee.component.BasicComponent.createInstance(BasicComponent.java:88)
at [email protected]//org.jboss.as.ejb3.component.singleton.SingletonComponent.getComponentInstance(SingletonComponent.java:127)
at [email protected]//org.jboss.as.ejb3.component.singleton.SingletonComponent.start(SingletonComponent.java:141)
at [email protected]//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 [email protected]//org.jboss.as.ejb3.tx.BMTInterceptor.handleException(BMTInterceptor.java:83)
at [email protected]//org.jboss.as.ejb3.tx.EjbBMTInterceptor.checkStatelessDone(EjbBMTInterceptor.java:91)
at [email protected]//org.jboss.as.ejb3.tx.EjbBMTInterceptor.handleInvocation(EjbBMTInterceptor.java:106)
at [email protected]//org.jboss.as.ejb3.tx.BMTInterceptor.processInvocation(BMTInterceptor.java:57)
at [email protected]//org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:422)
at [email protected]//org.jboss.as.weld.injection.WeldInjectionContextInterceptor.processInvocation(WeldInjectionContextInterceptor.java:43)
at [email protected]//org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:422)
at [email protected]//org.jboss.as.ejb3.component.interceptors.CurrentInvocationContextInterceptor.processInvocation(CurrentInvocationContextInterceptor.java:41)
at [email protected]//org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:422)
at [email protected]//org.jboss.as.ee.concurrent.ConcurrentContextInterceptor.processInvocation(ConcurrentContextInterceptor.java:45)
at [email protected]//org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:422)
at [email protected]//org.jboss.invocation.ContextClassLoaderInterceptor.processInvocation(ContextClassLoaderInterceptor.java:60)
at [email protected]//org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:422)
at [email protected]//org.jboss.as.ejb3.component.singleton.StartupCountDownInterceptor.processInvocation(StartupCountDownInterceptor.java:25)
at [email protected]//org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:422)
at [email protected]//org.jboss.invocation.ChainedInterceptor.processInvocation(ChainedInterceptor.java:53)
at [email protected]//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?

1
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
@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
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 runningGAK
@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

1 Answers

1
votes

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.