The Chronicle Queue JDBC test code:
try (JDBCService service = new JDBCService(in, out, () -> DriverManager.getConnection("jdbc:hsqldb:file:" + file.getAbsolutePath(), "SA", ""))) {
JDBCStatement writer = service.createWriter();
writer.executeUpdate("CREATE TABLE tableName (\n" +
"name VARCHAR(64) NOT NULL,\n" +
"num INT\n" +
")\n");
for (int i = 1; i < (long) noUpdates; i++)
writer.executeUpdate("INSERT INTO tableName (name, num)\n" +
"VALUES (?, ?)", "name", i);
written = System.nanoTime() - start;
AtomicLong queries = new AtomicLong();
AtomicLong updates = new AtomicLong();
CountingJDBCResult countingJDBCResult = new CountingJDBCResult(queries, updates);
MethodReader methodReader = service.createReader(countingJDBCResult);
while (updates.get() < noUpdates) {
if (!methodReader.readOne())
Thread.yield();
}
Closeable.closeQuietly(service);
}
}
}
appears to fail with:
java.lang.ClassNotFoundException: net.openhft.chronicle.queue.JDBCStatementBinarylightMethodWriterpackage net.openhft.chronicle.queue;
at java.net.URLClassLoader.findClass(URLClassLoader.java:382)
at java.lang.ClassLoader.loadClass(ClassLoader.java:418)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:355)
at java.lang.ClassLoader.loadClass(ClassLoader.java:351)
at net.openhft.compiler.CachedCompiler.loadFromJava(CachedCompiler.java:163)
at net.openhft.compiler.CachedCompiler.loadFromJava(CachedCompiler.java:76)
at net.openhft.chronicle.wire.GenerateMethodWriter.createClass(GenerateMethodWriter.java:257)
at net.openhft.chronicle.wire.GenerateMethodWriter.newClass(GenerateMethodWriter.java:101)
at net.openhft.chronicle.wire.VanillaMethodWriterBuilder.newClass(VanillaMethodWriterBuilder.java:202)
at java.util.concurrent.ConcurrentHashMap.computeIfAbsent(ConcurrentHashMap.java:1660)
at net.openhft.chronicle.wire.VanillaMethodWriterBuilder.get(VanillaMethodWriterBuilder.java:180)
at net.openhft.chronicle.queue.JDBCService.createWriter(JDBCService.java:82)
at fm.jdbc.Application.run(Application.java:73)
at fm.jdbc.Application.main(Application.java:45)
java.lang.AssertionError: java.lang.LinkageError: loader (instance of sun/misc/Launcher$AppClassLoader): attempted duplicate class definition for name: "net/openhft/chronicle/queue/JDBCResultBinarylightMethodWriter"
at net.openhft.compiler.CompilerUtils.defineClass(CompilerUtils.java:164)
at net.openhft.compiler.CachedCompiler.loadFromJava(CachedCompiler.java:157)
at net.openhft.compiler.CachedCompiler.loadFromJava(CachedCompiler.java:76)
at net.openhft.chronicle.wire.GenerateMethodWriter.createClass(GenerateMethodWriter.java:257)
at net.openhft.chronicle.wire.GenerateMethodWriter.newClass(GenerateMethodWriter.java:101)
at net.openhft.chronicle.wire.VanillaMethodWriterBuilder.newClass(VanillaMethodWriterBuilder.java:202)
at java.util.concurrent.ConcurrentHashMap.computeIfAbsent(ConcurrentHashMap.java:1660)
at net.openhft.chronicle.wire.VanillaMethodWriterBuilder.get(VanillaMethodWriterBuilder.java:180)
at net.openhft.chronicle.queue.JDBCService.runLoop(JDBCService.java:58)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
at net.openhft.chronicle.core.threads.CleaningThread.run(CleaningThread.java:38)
Caused by: java.lang.LinkageError: loader (instance of sun/misc/Launcher$AppClassLoader): attempted duplicate class definition for name: "net/openhft/chronicle/queue/JDBCResultBinarylightMethodWriter"
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:756)
at java.lang.ClassLoader.defineClass(ClassLoader.java:635)
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 net.openhft.compiler.CompilerUtils.defineClass(CompilerUtils.java:159)
... 12 more
starting with:
<groupId>net.openhft</groupId>
<artifactId>chronicle-bom</artifactId>
<version>2.19.291</version>
up to and including the latest version 2.19.360. Prior to that, version 2.19.290 appears to work. Any way to fix this other than downgrading?
This is a bug in Chronicle-Wire that's now been fixed.