스프링에서 카산드라 연결까지는 문제 없이 연결 되었지만, 아래와 같은 에러가 발생하였다.
어플리케이션 실행 시 카산드라 정상 연결 확인
.......
2020-06-05 10:59:55.220 [restartedMain] INFO io.undertow.servlet : Initializing Spring embedded WebApplicationContext
2020-06-05 10:59:55.220 [restartedMain] INFO o.s.web.context.ContextLoader : Root WebApplicationContext: initialization completed in 1233 ms
2020-06-05 10:59:55.276 [restartedMain] INFO com.datastax.driver.core : DataStax Java driver 3.7.2 for Apache Cassandra
2020-06-05 10:59:55.282 [restartedMain] INFO c.d.driver.core.GuavaCompatibility : Detected Guava >= 19 in the classpath, using modern compatibility layer
2020-06-05 10:59:55.418 [restartedMain] INFO com.datastax.driver.core.Native : Could not load JNR C Library, native system calls through this library will not be available (set this logger level to DEBUG to see the full stack trace).
2020-06-05 10:59:55.418 [restartedMain] INFO c.datastax.driver.core.ClockFactory : Using java.lang.System clock to generate timestamps.
2020-06-05 10:59:55.719 [restartedMain] INFO com.datastax.driver.core.NettyUtil : Did not find Netty's native epoll transport in the classpath, defaulting to NIO.
2020-06-05 10:59:56.912 [restartedMain] INFO c.d.d.c.p.DCAwareRoundRobinPolicy : Using data-center name 'datacenter1' for DCAwareRoundRobinPolicy (if this is incorrect, please provide the correct datacenter name with DCAwareRoundRobinPolicy constructor)
2020-06-05 10:59:56.914 [restartedMain] INFO com.datastax.driver.core.Cluster : New Cassandra host /127.0.0.1:9042 added
2020-06-05 10:59:57.102 [restartedMain] INFO n.d.c.c.WebServiceConfiguration : CXF Servlet Registered
2020-06-05 10:59:57.275 [restartedMain] INFO o.s.b.web.servlet.RegistrationBean : Servlet CXFServlet was not registered (possibly already registered?)
.......
처음 호스트와의 연결은 정상적이었지만,
데이터 Insert 실행시 아래와 같은 CassandraConnectionFailureException 이 발생하였다.
2020-06-05 11:05:58.625 [cluster1-nio-worker-1] WARN c.d.driver.core.RequestHandler : /127.0.0.1:9042 replied with server error (java.lang.IllegalArgumentException), defuncting connection.
2020-06-05 11:05:58.634 [cluster1-nio-worker-1] TRACE c.d.driver.core.QueryLogger.ERROR : [cluster1] [/127.0.0.1:9042] Query error after 8693 ms: INSERT INTO emp (name,id,address) VALUES (?,1,?);
com.datastax.driver.core.exceptions.ServerError: An unexpected error occurred server side on /127.0.0.1:9042: java.lang.IllegalArgumentException
at com.datastax.driver.core.Responses$Error.asException(Responses.java:153)
at com.datastax.driver.core.RequestHandler$SpeculativeExecution.onSet(RequestHandler.java:646)
at com.datastax.driver.core.Connection$Dispatcher.channelRead0(Connection.java:1240)
at com.datastax.driver.core.Connection$Dispatcher.channelRead0(Connection.java:1158)
at io.netty.channel.SimpleChannelInboundHandler.channelRead(SimpleChannelInboundHandler.java:99)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:377)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:363)
at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:355)
at io.netty.handler.timeout.IdleStateHandler.channelRead(IdleStateHandler.java:286)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:377)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:363)
at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:355)
at io.netty.handler.codec.MessageToMessageDecoder.channelRead(MessageToMessageDecoder.java:102)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:377)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:363)
at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:355)
at io.netty.handler.codec.ByteToMessageDecoder.fireChannelRead(ByteToMessageDecoder.java:321)
at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:295)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:377)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:363)
at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:355)
at io.netty.channel.ChannelInboundHandlerAdapter.channelRead(ChannelInboundHandlerAdapter.java:93)
at com.datastax.driver.core.InboundTrafficMeter.channelRead(InboundTrafficMeter.java:38)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:377)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:363)
at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:355)
at io.netty.channel.DefaultChannelPipeline$HeadContext.channelRead(DefaultChannelPipeline.java:1410)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:377)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:363)
at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:919)
at io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:163)
at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:714)
at io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:650)
at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:576)
at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:493)
at io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:989)
at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74)
at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
at java.lang.Thread.run(Thread.java:748)
.......
Caused by: org.springframework.data.cassandra.CassandraConnectionFailureException: SessionCallback; CQL [INSERT INTO emp (name,id,address) VALUES ('log',123,'seoul');]; All host(s) tried for query failed (tried: /127.0.0.1:9042 (com.datastax.driver.core.exceptions.ServerError: An unexpected error occurred server side on /127.0.0.1:9042: java.lang.IllegalArgumentException)); nested exception is com.datastax.driver.core.exceptions.NoHostAvailableException: All host(s) tried for query failed (tried: /127.0.0.1:9042 (com.datastax.driver.core.exceptions.ServerError: An unexpected error occurred server side on /127.0.0.1:9042: java.lang.IllegalArgumentException))
at org.springframework.data.cassandra.core.cql.CassandraExceptionTranslator.translate(CassandraExceptionTranslator.java:155)
at org.springframework.data.cassandra.core.cql.CassandraAccessor.translate(CassandraAccessor.java:334)
at org.springframework.data.cassandra.core.cql.CqlTemplate.translateException(CqlTemplate.java:732)
at org.springframework.data.cassandra.core.cql.CqlTemplate.execute(CqlTemplate.java:134)
at org.springframework.data.cassandra.core.CassandraTemplate.executeSave(CassandraTemplate.java:860)
at org.springframework.data.cassandra.core.CassandraTemplate.executeSave(CassandraTemplate.java:851)
at org.springframework.data.cassandra.core.CassandraTemplate.doInsert(CassandraTemplate.java:666)
at org.springframework.data.cassandra.core.CassandraTemplate.doInsert(CassandraTemplate.java:649)
at org.springframework.data.cassandra.core.CassandraTemplate.insert(CassandraTemplate.java:634)
at org.springframework.data.cassandra.repository.support.SimpleCassandraRepository.save(SimpleCassandraRepository.java:95)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.springframework.data.repository.core.support.RepositoryComposition$RepositoryFragments.invoke(RepositoryComposition.java:371)
at org.springframework.data.repository.core.support.RepositoryComposition.invoke(RepositoryComposition.java:204)
at org.springframework.data.repository.core.support.RepositoryFactorySupport$ImplementationMethodExecutionInterceptor.invoke(RepositoryFactorySupport.java:657)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186)
at org.springframework.data.repository.core.support.RepositoryFactorySupport$QueryExecutorMethodInterceptor.doInvoke(RepositoryFactorySupport.java:621)
at org.springframework.data.repository.core.support.RepositoryFactorySupport$QueryExecutorMethodInterceptor.invoke(RepositoryFactorySupport.java:605)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186)
at org.springframework.data.projection.DefaultMethodInvokingMethodInterceptor.invoke(DefaultMethodInvokingMethodInterceptor.java:80)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186)
at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:95)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186)
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:212)
at com.sun.proxy.$Proxy99.save(Unknown Source)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:344)
at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:198)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:163)
at org.springframework.dao.support.PersistenceExceptionTranslationInterceptor.invoke(PersistenceExceptionTranslationInterceptor.java:139)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186)
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:212)
at com.sun.proxy.$Proxy99.save(Unknown Source)
at net.doople.consumer.service.transformation.TraceReportMessage.saveAndPrintReport(TraceReportMessage.java:97)
at net.doople.consumer.service.transformation.TraceReportMessage.makeReportMessage(TraceReportMessage.java:87)
at net.doople.consumer.service.transformation.NewDataService.transformNewdata(NewDataService.java:65)
at net.doople.consumer.service.E134DcpConsumerImpl.newData(E134DcpConsumerImpl.java:62)
at net.doople.consumer.controller.DoopleConsumerImpl.newData(DoopleConsumerImpl.java:126)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.apache.cxf.service.invoker.AbstractInvoker.performInvocation(AbstractInvoker.java:179)
at org.apache.cxf.jaxws.JAXWSMethodInvoker.performInvocation(JAXWSMethodInvoker.java:66)
at org.apache.cxf.service.invoker.AbstractInvoker.invoke(AbstractInvoker.java:96)
... 17 common frames omitted
Caused by: com.datastax.driver.core.exceptions.NoHostAvailableException: All host(s) tried for query failed (tried: /127.0.0.1:9042 (com.datastax.driver.core.exceptions.ServerError: An unexpected error occurred server side on /127.0.0.1:9042: java.lang.IllegalArgumentException))
at com.datastax.driver.core.exceptions.NoHostAvailableException.copy(NoHostAvailableException.java:83)
at com.datastax.driver.core.exceptions.NoHostAvailableException.copy(NoHostAvailableException.java:37)
at com.datastax.driver.core.DriverThrowables.propagateCause(DriverThrowables.java:35)
at com.datastax.driver.core.DefaultResultSetFuture.getUninterruptibly(DefaultResultSetFuture.java:293)
at com.datastax.driver.core.AbstractSession.execute(AbstractSession.java:58)
at org.springframework.data.cassandra.core.CassandraTemplate$StatementCallback.doInSession(CassandraTemplate.java:974)
at org.springframework.data.cassandra.core.CassandraTemplate$StatementCallback.doInSession(CassandraTemplate.java:964)
at org.springframework.data.cassandra.core.cql.CqlTemplate.execute(CqlTemplate.java:132)
... 63 common frames omitted
Caused by: com.datastax.driver.core.exceptions.NoHostAvailableException: All host(s) tried for query failed (tried: /127.0.0.1:9042 (com.datastax.driver.core.exceptions.ServerError: An unexpected error occurred server side on /127.0.0.1:9042: java.lang.IllegalArgumentException))
at com.datastax.driver.core.RequestHandler.reportNoMoreHosts(RequestHandler.java:284)
at com.datastax.driver.core.RequestHandler.access$1200(RequestHandler.java:62)
at com.datastax.driver.core.RequestHandler$SpeculativeExecution.findNextHostAndQuery(RequestHandler.java:376)
at com.datastax.driver.core.RequestHandler$SpeculativeExecution.retry(RequestHandler.java:558)
at com.datastax.driver.core.RequestHandler$SpeculativeExecution.processRetryDecision(RequestHandler.java:540)
at com.datastax.driver.core.RequestHandler$SpeculativeExecution.onSet(RequestHandler.java:810)
at com.datastax.driver.core.Connection$Dispatcher.channelRead0(Connection.java:1240)
at com.datastax.driver.core.Connection$Dispatcher.channelRead0(Connection.java:1158)
at io.netty.channel.SimpleChannelInboundHandler.channelRead(SimpleChannelInboundHandler.java:99)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:377)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:363)
at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:355)
at io.netty.handler.timeout.IdleStateHandler.channelRead(IdleStateHandler.java:286)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:377)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:363)
at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:355)
at io.netty.handler.codec.MessageToMessageDecoder.channelRead(MessageToMessageDecoder.java:102)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:377)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:363)
at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:355)
at io.netty.handler.codec.ByteToMessageDecoder.fireChannelRead(ByteToMessageDecoder.java:321)
at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:295)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:377)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:363)
at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:355)
at io.netty.channel.ChannelInboundHandlerAdapter.channelRead(ChannelInboundHandlerAdapter.java:93)
at com.datastax.driver.core.InboundTrafficMeter.channelRead(InboundTrafficMeter.java:38)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:377)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:363)
at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:355)
at io.netty.channel.DefaultChannelPipeline$HeadContext.channelRead(DefaultChannelPipeline.java:1410)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:377)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:363)
at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:919)
at io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:163)
at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:714)
at io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:650)
at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:576)
at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:493)
at io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:989)
at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74)
at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
... 1 common frames omitted
발견한 Exception 종류는 3가지이다.
- com.datastax.driver.core.exceptions.ServerError: An unexpected error occurred server side on /127.0.0.1:9042: java.lang.IllegalArgumentException
- org.springframework.data.cassandra.CassandraConnectionFailureException
- com.datastax.driver.core.exceptions.NoHostAvailableException: All host(s) tried for query failed
Exception의 키워드를 살펴보면 카산드라 호스트 연결 문제인거같고, 외부 연결문제인 것 같기도 해서 조금 해맸지만,
원인은 keyspace에 table이 없어서 발생했던 오류 였다.
음.. 카산드라의 Exception이 친절하진 않은 것 같다.
이런 비슷한 에러를 만나 해매고 있는 분들은 테이블 이름 같은 기본적인 설정을 확인해보면 좋을것 같다.
'Database > Cassandra' 카테고리의 다른 글
[Cassandra][datastax]Physical Analysis (0) | 2020.06.17 |
---|---|
[Cassandra] Compression Configuration (0) | 2020.06.03 |
[cassandra] blob type (0) | 2020.06.02 |