java - 名称的重复类定义:“net/openhft/chronicle/queue/JDBCResultBinarylightMethodWriter”
问题描述
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);
}
}
}
似乎失败了:
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
从...开始:
<groupId>net.openhft</groupId>
<artifactId>chronicle-bom</artifactId>
<version>2.19.291</version>
直到并包括最新版本 2.19.360。在此之前,版本 2.19.290 似乎可以工作。除了降级还有什么办法解决这个问题?
解决方案
这是Chronicle-Wire中的一个错误,现已修复。
推荐阅读
- nuxt.js - nuxt-link 在无序列表中不起作用
- c - 函数指针存在于 C 中的结构内
- reactjs - Create React App 4.0 无法解析公用文件夹中的图像路径
- c - 如何删除具有链表特定数据的所有节点
- perl - 使用纯 Perl 获取 blob 上传的数据
- kotlin - 更新 Kotlin 中的随机类属性
- react-router - React-router 5.2 无法从 URL 获取参数
- python-3.x - 删除中文字符的所有空格,同时在 Python 正则表达式中保留英文的必要空格
- uwp - 即使在用户控件中处理后,父页面的 keyDown 事件也会触发
- html - 如何使我的哪个具有背景图像可链接?