Reputation: 1022
I'm trying to build an integration test for Datastax CDC. I'm trying to follow the directions here to create a containerized Stargate instance running the CDC Java agent. I'm using the following docker file:
FROM stargateio/coordinator-4_0:v2
ENV CLUSTER_NAME="test"
ENV CLUSTER_VERSION="4.0"
ENV DEVELOPER_MODE="true"
ENV ENABLE_AUTH="true"
RUN (curl -L https://github.com/datastax/cdc-apache-cassandra/releases/download/v2.2.9/agent-c4-2.2.9-all.jar --output agent-c4-2.2.9-all.jar)
ENV JAVA_OPTS="$JAVA_OPTS -javaagent:agent-c4-2.2.9-all.jar"
I'm using JAVA_OPTS
because JVM_EXTRA_OPTS
appears to have no effect. Stargate inserts these into the start command. I'm getting this error:
Using environment for config
2023-05-18T20:53:28.708821506Z Running java -server -javaagent:agent-c4-2.2.9-all.jar -Dcassandra.libjemalloc=/usr/lib/aarch64-linux-gnu/libjemalloc.so.2 -Dstargate.libdir=./stargate-lib -Djava.awt.headless=true -jar ./stargate-lib/stargate-starter-2.0.13.jar --cluster-name test --cluster-version 4.0 --listen 172.17.0.2 --enable-auth --developer-mode
2023-05-18T20:53:28.771770673Z SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
2023-05-18T20:53:28.771806548Z SLF4J: Defaulting to no-operation (NOP) logger implementation
2023-05-18T20:53:28.771810090Z SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
2023-05-18T20:53:28.773310423Z Exception in thread "main" java.lang.reflect.InvocationTargetException
2023-05-18T20:53:28.773331381Z at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
2023-05-18T20:53:28.773333715Z at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
2023-05-18T20:53:28.773336006Z at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
2023-05-18T20:53:28.773337756Z at java.lang.reflect.Method.invoke(Method.java:498)
2023-05-18T20:53:28.773339298Z at sun.instrument.InstrumentationImpl.loadClassAndStartAgent(InstrumentationImpl.java:386)
2023-05-18T20:53:28.773341298Z at sun.instrument.InstrumentationImpl.loadClassAndCallPremain(InstrumentationImpl.java:401)
2023-05-18T20:53:28.773343131Z Caused by: java.lang.NoClassDefFoundError: org/apache/cassandra/config/DatabaseDescriptor
2023-05-18T20:53:28.773344881Z at com.datastax.oss.cdc.agent.Agent.main(Agent.java:49)
2023-05-18T20:53:28.773346631Z at com.datastax.oss.cdc.agent.Agent.premain(Agent.java:31)
2023-05-18T20:53:28.773348715Z ... 6 more
2023-05-18T20:53:28.773350340Z Caused by: java.lang.ClassNotFoundException: org.apache.cassandra.config.DatabaseDescriptor
2023-05-18T20:53:28.773352090Z at java.net.URLClassLoader.findClass(URLClassLoader.java:387)
2023-05-18T20:53:28.773353798Z at java.lang.ClassLoader.loadClass(ClassLoader.java:418)
2023-05-18T20:53:28.773355465Z at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:352)
2023-05-18T20:53:28.773357131Z at java.lang.ClassLoader.loadClass(ClassLoader.java:351)
2023-05-18T20:53:28.773358756Z ... 8 more
2023-05-18T20:53:28.773360340Z FATAL ERROR in native method: processing of -javaagent failed
I've tried downloading the Cassandra .jar
files and adding them to the classpath (as described in this question) to no avail. How do I resolve this error?
Upvotes: 1
Views: 113
Reputation: 41
Based on the Java stack trace above, the likely reason you are encountering the exception is because the jar file containing the Java agent code (agent-c4-2.2.9-all.jar
) is missing Apache Cassandra dependencies.
Here are some possible solutions:
The JDK documentation for insrumentation has a section on how agent classes are loaded and also a section on how agent jar files can specify their Boot-Class-Path
for loading dependencies.
Hope that helps.
Cheers
Upvotes: 0
Reputation: 16353
It doesn't look like we've attempted this before so we don't have a working example to show you.
We are looking into it and will attempt to get it to work in the next few days. I will post an update once I have something to report. Cheers!
[UPDATE] CDC integration with Stargate is not supported yet. I've logged a feature request on your behalf (ref #2587) in an attempt to get it on the roadmap.
Upvotes: 1